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,18 +244,33 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
TestHelpers.InMethod(); TestHelpers.InMethod();
// TestHelpers.EnableLogging(); // TestHelpers.EnableLogging();
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }"); {
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }");
int result = (int)InvokeOp("JsonSetValue", storeId, "Fun", "Times"); int result = (int)InvokeOp("JsonSetValue", storeId, "Fun", "Times");
Assert.That(result, Is.EqualTo(1)); Assert.That(result, Is.EqualTo(1));
string value = (string)InvokeOp("JsonGetValue", storeId, "Fun"); string value = (string)InvokeOp("JsonGetValue", storeId, "Fun");
Assert.That(value, Is.EqualTo("Times")); 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 // Test with fake store
UUID fakeStoreId = TestHelpers.ParseTail(0x500); {
int fakeStoreValueSet = (int)InvokeOp("JsonSetValue", fakeStoreId, "Hello", "World"); UUID fakeStoreId = TestHelpers.ParseTail(0x500);
Assert.That(fakeStoreValueSet, Is.EqualTo(0)); int fakeStoreValueSet = (int)InvokeOp("JsonSetValue", fakeStoreId, "Hello", "World");
Assert.That(fakeStoreValueSet, Is.EqualTo(0));
}
} }
/// <summary> /// <summary>