public void FacadeSerializeWithPrintableFormattingTest()
        {
            IDictionary dictionary = new Dictionary <string, object>();

            dictionary["rolling"] = "stones";
            dictionary["flaming"] = "pie";
            dictionary["nine"]    = 9;
            string actual   = "\r\n{\r\n    \"rolling\" : \"stones\",\r\n    \"flaming\" : \"pie\",\r\n    \"nine\"    : 9\r\n}";
            string expected = JSONManager.serializeToJson(dictionary, usePrintableFormatting: true);

            Assert.AreEqual(expected, actual);
        }
Beispiel #2
0
    public void SaveResourceCatalog()
    {
        List <AppResource> list = (TestCatalog = new List <AppResource>());

        foreach (KeyValuePair <string, AppResource> item in ResourceCatalog)
        {
            if (item.Value.ShouldSaveToCatalog())
            {
                list.Add(item.Value);
            }
        }
        string text = JSONManager.serializeToJson(list);

        DisneyMobile.CoreUnitySystems.Logger.LogInfo(this, "Resource Catalog Saved : " + text);
        FileManager.SaveTextFile(AppResource.ResourceSaveLocation, "AppResourceCatalog.txt", text);
    }
        public void FacadeSerializeToJsonTest()
        {
            Dictionary <string, object> dictionary  = new Dictionary <string, object>();
            Dictionary <string, object> dictionary2 = new Dictionary <string, object>();
            List <object> list = new List <object>();

            dictionary2.Add("testB1", 7);
            dictionary2.Add("testB2", "dataB2");
            list.Add(5);
            list.Add("testC");
            dictionary.Add("testA1", dictionary2);
            dictionary.Add("testA2", list);
            string expected = JSONManager.serializeToJson(dictionary);
            string actual   = "{\"testA1\":{\"testB1\":7,\"testB2\":\"dataB2\"},\"testA2\":[5,\"testC\"]}";

            Assert.AreEqual(expected, actual);
        }
Beispiel #4
0
 public string Serialize()
 {
     return(JSONManager.serializeToJson(this, usePrintableFormatting: true));
 }