Add regression TestJsonGetValueJson()

user_profiles
Justin Clark-Casey (justincc) 2013-02-11 23:47:49 +00:00
parent 6924bd21f4
commit d55974bcb7
1 changed files with 33 additions and 0 deletions

View File

@ -180,6 +180,39 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
} }
} }
[Test]
public void TestJsonGetValueJson()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : 'Two' } }");
{
string value = (string)InvokeOp("JsonGetValueJson", storeId, "Hello.World");
Assert.That(value, Is.EqualTo("'Two'"));
}
// Test get of path section instead of leaf
{
string value = (string)InvokeOp("JsonGetValueJson", storeId, "Hello");
Assert.That(value, Is.EqualTo("{\"World\":\"Two\"}"));
}
// Test get of non-existing value
{
string fakeValueGet = (string)InvokeOp("JsonGetValueJson", storeId, "foo");
Assert.That(fakeValueGet, Is.EqualTo(""));
}
// Test get from non-existing store
{
UUID fakeStoreId = TestHelpers.ParseTail(0x500);
string fakeStoreValueGet = (string)InvokeOp("JsonGetValueJson", fakeStoreId, "Hello");
Assert.That(fakeStoreValueGet, Is.EqualTo(""));
}
}
// [Test] // [Test]
// public void TestJsonTakeValue() // public void TestJsonTakeValue()
// { // {