public void ShowConfigureDialog() { var c = new Configurator(_libraryFolder.Path, new NavigationIsolator()); var stringRep = DynamicJson.Serialize(new { library = new { calendar = new { year = "2088" } } }); c.CollectJsonData(stringRep); c.ShowConfigurationDialog(Get_NotYetConfigured_CalendardBookStorage().FolderPath); Assert.IsTrue(c.GetLibraryData().Contains("year")); }
public void CollectJsonData_HasArrayValue_DataMerged() { var firstData = "{\"library\":{\"days\":[\"1\",\"2\"]}}"; var secondData = "{\"library\":{\"days\":[\"one\",\"two\"]}}"; var first = new Configurator(_libraryFolder.Path); first.CollectJsonData(firstData.ToString()); first.CollectJsonData(secondData.ToString()); var second = new Configurator(_libraryFolder.Path); dynamic j = (DynamicJson)DynamicJson.Parse(second.GetLibraryData()); Assert.AreEqual("one", j.library.days[0]); Assert.AreEqual("two", j.library.days[1]); }
public void CollectJsonData_NewArrayItems_DataMerged() { var firstData = DynamicJson.Serialize(new { library = new {food = new {veg="v", fruit = "f"}} }); var secondData = DynamicJson.Serialize(new { library = new { food = new { bread = "b", fruit = "f" } } }); var first = new Configurator(_libraryFolder.Path); first.CollectJsonData(firstData.ToString()); first.CollectJsonData(secondData.ToString()); var second = new Configurator(_libraryFolder.Path); dynamic j = (DynamicJson)DynamicJson.Parse(second.GetLibraryData()); Assert.AreEqual("v", j.library.food.veg); Assert.AreEqual("f", j.library.food.fruit); Assert.AreEqual("b", j.library.food.bread); }
public void CollectJsonData_NewTopLevelData_DataMerged() { var firstData = DynamicJson.Serialize(new { library = new { one = "1", color="red" } }); var secondData = DynamicJson.Serialize(new { library = new { two = "2", color = "blue" } }); var first = new Configurator(_libraryFolder.Path); first.CollectJsonData(firstData.ToString()); first.CollectJsonData(secondData.ToString()); var second = new Configurator(_libraryFolder.Path); dynamic j= (DynamicJson) DynamicJson.Parse(second.GetLibraryData()); Assert.AreEqual("2", j.library.two); Assert.AreEqual("1", j.library.one); Assert.AreEqual("blue", j.library.color); }
public void LibrarySettingsAreRoundTriped() { var first = new Configurator(_libraryFolder.Path); var stringRep = DynamicJson.Serialize(new { library = new {stuff = "foo"} }); first.CollectJsonData(stringRep.ToString()); var second = new Configurator(_libraryFolder.Path); dynamic j = (DynamicJson)DynamicJson.Parse(second.GetLibraryData()); Assert.AreEqual("foo", j.library.stuff); }
public void GetLibraryData_NothingCollected_Empty() { var first = new Configurator(_libraryFolder.Path); Assert.AreEqual("{}", first.GetLibraryData()); }
public void GetLibraryData_NoGlobalData_Empty() { var first = new Configurator(_libraryFolder.Path); dynamic j = new DynamicJson(); j.one = 1; first.CollectJsonData(j.ToString()); Assert.AreEqual("{}", first.GetLibraryData()); }