Add section to TestJsonGetValue() to test call on a sub-tree

0.7.4-extended
Justin Clark-Casey (justincc) 2013-02-11 22:56:43 +00:00
parent ccd1bac994
commit 216ef7522a
1 changed files with 21 additions and 9 deletions

View File

@ -153,20 +153,32 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
TestHelpers.InMethod(); TestHelpers.InMethod();
// TestHelpers.EnableLogging(); // TestHelpers.EnableLogging();
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : 'World' }"); UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : 'Two' } }");
{
string value = (string)InvokeOp("JsonGetValue", storeId, "Hello.World");
Assert.That(value, Is.EqualTo("Two"));
}
// Test get of path section instead of leaf
{
string value = (string)InvokeOp("JsonGetValue", storeId, "Hello"); string value = (string)InvokeOp("JsonGetValue", storeId, "Hello");
Assert.That(value, Is.EqualTo("World")); Assert.That(value, Is.EqualTo(""));
}
// Test get of non-existing value // Test get of non-existing value
{
string fakeValueGet = (string)InvokeOp("JsonGetValue", storeId, "foo"); string fakeValueGet = (string)InvokeOp("JsonGetValue", storeId, "foo");
Assert.That(fakeValueGet, Is.EqualTo("")); Assert.That(fakeValueGet, Is.EqualTo(""));
}
// Test get from non-existing store // Test get from non-existing store
{
UUID fakeStoreId = TestHelpers.ParseTail(0x500); UUID fakeStoreId = TestHelpers.ParseTail(0x500);
string fakeStoreValueGet = (string)InvokeOp("JsonGetValue", fakeStoreId, "Hello"); string fakeStoreValueGet = (string)InvokeOp("JsonGetValue", fakeStoreId, "Hello");
Assert.That(fakeStoreValueGet, Is.EqualTo("")); Assert.That(fakeStoreValueGet, Is.EqualTo(""));
} }
}
// [Test] // [Test]
// public void TestJsonTakeValue() // public void TestJsonTakeValue()
@ -432,7 +444,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
// Try read notecard to fake store. // Try read notecard to fake store.
UUID fakeStoreId = TestHelpers.ParseTail(0x500); UUID fakeStoreId = TestHelpers.ParseTail(0x500);
UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, fakeStoreId, "", notecardName); UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, fakeStoreId, "", notecardName);
Assert.That(fakeStoreId, Is.Not.EqualTo(UUID.Zero)); Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero));
string value = (string)InvokeOp("JsonGetValue", fakeStoreId, "Hello"); string value = (string)InvokeOp("JsonGetValue", fakeStoreId, "Hello");
Assert.That(value, Is.EqualTo("")); Assert.That(value, Is.EqualTo(""));