Add section to TestJsonSetValue() to test attempted set of value where the penultimate section of path does not exist

0.7.4-extended
Justin Clark-Casey (justincc) 2013-02-11 22:28:50 +00:00
parent 7fe768a98d
commit 182c66cea1
1 changed files with 23 additions and 8 deletions

View File

@ -244,6 +244,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
{
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }");
int result = (int)InvokeOp("JsonSetValue", storeId, "Fun", "Times");
@ -251,12 +252,26 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
string value = (string)InvokeOp("JsonGetValue", storeId, "Fun");
Assert.That(value, Is.EqualTo("Times"));
}
// Test setting to location that does not exist. This should fail.
{
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }");
int result = (int)InvokeOp("JsonSetValue", storeId, "Fun.Circus", "Times");
Assert.That(result, Is.EqualTo(0));
string value = (string)InvokeOp("JsonGetValue", storeId, "Fun.Circus");
Assert.That(value, Is.EqualTo(""));
}
// Test with fake store
{
UUID fakeStoreId = TestHelpers.ParseTail(0x500);
int fakeStoreValueSet = (int)InvokeOp("JsonSetValue", fakeStoreId, "Hello", "World");
Assert.That(fakeStoreValueSet, Is.EqualTo(0));
}
}
/// <summary>
/// Test for writing json to a notecard