Add regression TestJsonList2Path()

0.7.4-extended
Justin Clark-Casey (justincc) 2013-02-15 00:27:30 +00:00
parent 6e612937c7
commit 476ad0550f
1 changed files with 27 additions and 2 deletions

View File

@ -53,6 +53,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
private Scene m_scene; private Scene m_scene;
private MockScriptEngine m_engine; private MockScriptEngine m_engine;
private ScriptModuleCommsModule m_smcm; private ScriptModuleCommsModule m_smcm;
private JsonStoreScriptModule m_jssm;
[TestFixtureSetUp] [TestFixtureSetUp]
public void FixtureInit() public void FixtureInit()
@ -82,10 +83,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
m_engine = new MockScriptEngine(); m_engine = new MockScriptEngine();
m_smcm = new ScriptModuleCommsModule(); m_smcm = new ScriptModuleCommsModule();
JsonStoreModule jsm = new JsonStoreModule(); JsonStoreModule jsm = new JsonStoreModule();
JsonStoreScriptModule jssm = new JsonStoreScriptModule(); m_jssm = new JsonStoreScriptModule();
m_scene = new SceneHelpers().SetupScene(); m_scene = new SceneHelpers().SetupScene();
SceneHelpers.SetupSceneModules(m_scene, configSource, m_engine, m_smcm, jsm, jssm); SceneHelpers.SetupSceneModules(m_scene, configSource, m_engine, m_smcm, jsm, m_jssm);
try try
{ {
@ -478,6 +479,30 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
} }
} }
[Test]
public void TestJsonList2Path()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
// Invoking these methods directly since I just couldn't get comms module invocation to work for some reason
// - some confusion with the methods that take a params object[] invocation.
{
string result = m_jssm.JsonList2Path(UUID.Zero, UUID.Zero, new object[] { "foo" });
Assert.That(result, Is.EqualTo("{foo}"));
}
{
string result = m_jssm.JsonList2Path(UUID.Zero, UUID.Zero, new object[] { "foo", "bar" });
Assert.That(result, Is.EqualTo("{foo}.{bar}"));
}
{
string result = m_jssm.JsonList2Path(UUID.Zero, UUID.Zero, new object[] { "foo", 1, "bar" });
Assert.That(result, Is.EqualTo("{foo}.[1].{bar}"));
}
}
[Test] [Test]
public void TestJsonSetValue() public void TestJsonSetValue()
{ {