Example #1
0
 public static void ArrayTest()
 {
     arrayclass a = new arrayclass();
     a.ints = new int[] { 3, 1, 4 };
     a.strs = new string[] { "a", "b", "c" };
     var s = fastBinaryJSON.BJSON.ToBJSON(a);
     var o = fastBinaryJSON.BJSON.ToObject(s);
 }
        public static void ArrayTest()
        {
            arrayclass a = new arrayclass();

            a.ints = new int[] { 3, 1, 4 };
            a.strs = new string[] { "a", "b", "c" };
            var s = fastJSON.JSON.Instance.ToJSON(a);
            var o = fastJSON.JSON.Instance.ToObject(s);
        }
Example #3
0
        public void ArrayTest()
        {
            arrayclass a = new arrayclass();

            a.ints = new int[] { 3, 1, 4 };
            a.strs = new string[] { "a", "b", "c" };
            var s = JSON.ToJSON(a);
            var o = JSON.ToObject <arrayclass> (s);

            CollectionAssert.AreEqual(a.ints, o.ints);
            CollectionAssert.AreEqual(a.strs, o.strs);
        }
Example #4
0
        public void ArrayToDictionaryTest()
        {
            arrayclass a = new arrayclass();

            a.ints = new int[] { 3, 1, 4 };
            a.strs = new string[] { "a", "b", "c" };
            var s = Json.ToJson(a);

            Console.WriteLine(Json.Beautify(s));
            var o = Json.ToObject <Dictionary <string, object> >(s);

            CollectionAssert.AreEqual(a.ints, ((List <object>)o["ints"]).Select(ob => int.Parse(ob.ToString())).ToArray());
            CollectionAssert.AreEqual(a.strs, ((List <object>)o["strs"]).Select(ob => ob.ToString()).ToArray());
        }