From 216ef7522af6edf32d4799104df77ecc1b4f72d2 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 11 Feb 2013 22:56:43 +0000 Subject: [PATCH] Add section to TestJsonGetValue() to test call on a sub-tree --- .../Tests/JsonStoreScriptModuleTests.cs | 30 +++++++++++++------ 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs index 98d8ff6082..a2d065cb9c 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs @@ -153,19 +153,31 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests TestHelpers.InMethod(); // TestHelpers.EnableLogging(); - UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : 'World' }"); + UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : 'Two' } }"); - string value = (string)InvokeOp("JsonGetValue", storeId, "Hello"); - Assert.That(value, Is.EqualTo("World")); + { + 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"); + Assert.That(value, Is.EqualTo("")); + } // Test get of non-existing value - string fakeValueGet = (string)InvokeOp("JsonGetValue", storeId, "foo"); - Assert.That(fakeValueGet, Is.EqualTo("")); + { + string fakeValueGet = (string)InvokeOp("JsonGetValue", storeId, "foo"); + Assert.That(fakeValueGet, Is.EqualTo("")); + } // Test get from non-existing store - UUID fakeStoreId = TestHelpers.ParseTail(0x500); - string fakeStoreValueGet = (string)InvokeOp("JsonGetValue", fakeStoreId, "Hello"); - Assert.That(fakeStoreValueGet, Is.EqualTo("")); + { + UUID fakeStoreId = TestHelpers.ParseTail(0x500); + string fakeStoreValueGet = (string)InvokeOp("JsonGetValue", fakeStoreId, "Hello"); + Assert.That(fakeStoreValueGet, Is.EqualTo("")); + } } // [Test] @@ -432,7 +444,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests // Try read notecard to fake store. UUID fakeStoreId = TestHelpers.ParseTail(0x500); 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"); Assert.That(value, Is.EqualTo(""));