GetLibraryData() 공개 메소드

public GetLibraryData ( ) : string
리턴 string
예제 #1
0
		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"));
		}
예제 #2
0
        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]);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
0
        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);
        }
예제 #6
0
 public void GetLibraryData_NothingCollected_Empty()
 {
     var first = new Configurator(_libraryFolder.Path);
     Assert.AreEqual("{}", first.GetLibraryData());
 }
예제 #7
0
 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());
 }