From addf9ada49f35a40f8739d0614c1d48fbbb82ec1 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Wed, 30 Jan 2013 05:39:34 +0000 Subject: [PATCH] Add regression test for script func JsonRemoveValue() --- .../Tests/JsonStoreScriptModuleTests.cs | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs index 9f9172891c..d209551874 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs @@ -111,6 +111,58 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests Assert.That(value, Is.EqualTo("World")); } +// [Test] +// public void TestJsonTakeValue() +// { +// TestHelpers.InMethod(); +//// TestHelpers.EnableLogging(); +// +// UUID storeId +// = (UUID)m_smcm.InvokeOperation( +// UUID.Zero, UUID.Zero, "JsonCreateStore", new object[] { "{ 'Hello' : 'World' }" }); +// +// string value +// = (string)m_smcm.InvokeOperation( +// UUID.Zero, UUID.Zero, "JsonTakeValue", new object[] { storeId, "Hello" }); +// +// Assert.That(value, Is.EqualTo("World")); +// +// string value2 +// = (string)m_smcm.InvokeOperation( +// UUID.Zero, UUID.Zero, "JsonGetValue", new object[] { storeId, "Hello" }); +// +// Assert.That(value, Is.Null); +// } + + [Test] + public void TestJsonRemoveValue() + { + TestHelpers.InMethod(); +// TestHelpers.EnableLogging(); + + UUID storeId + = (UUID)m_smcm.InvokeOperation( + UUID.Zero, UUID.Zero, "JsonCreateStore", new object[] { "{ 'Hello' : 'World' }" }); + + int returnValue + = (int)m_smcm.InvokeOperation( + UUID.Zero, UUID.Zero, "JsonRemoveValue", new object[] { storeId, "Hello" }); + + Assert.That(returnValue, Is.EqualTo(1)); + + int result + = (int)m_smcm.InvokeOperation( + UUID.Zero, UUID.Zero, "JsonTestPath", new object[] { storeId, "Hello" }); + + Assert.That(result, Is.EqualTo(0)); + + string returnValue2 + = (string)m_smcm.InvokeOperation( + UUID.Zero, UUID.Zero, "JsonGetValue", new object[] { storeId, "Hello" }); + + Assert.That(returnValue2, Is.EqualTo("")); + } + [Test] public void TestJsonTestPath() {