Пример #1
0
        public void Scalar()
        {
            var obj = 5;
            var col = TurkSerializer.Collect(obj);

            Assert.Equal(col[""], "5");
        }
Пример #2
0
        public void Object_With_Array_Of_Object()
        {
            var obj = new { A = 1, B = new[] { new { X = 10 } } };
            var col = TurkSerializer.Collect(obj);

            Assert.Equal(col["A"], "1");
            Assert.Equal(col["B.1.X"], "10");
        }
Пример #3
0
        public void Object_With_Null()
        {
            var obj = new { A = 1, B = (string)null, C = 3.5 };
            var col = TurkSerializer.Collect(obj);

            Assert.Equal(col["A"], "1");
            Assert.False(col.AllKeys.Contains("B"));
            Assert.Equal(col["C"], "3.5");
        }
Пример #4
0
        public void Vanilla_Object()
        {
            var obj = new { A = 1, B = "2", C = 3.5 };
            var col = TurkSerializer.Collect(obj);

            Assert.Equal(col["A"], "1");
            Assert.Equal(col["B"], "2");
            Assert.Equal(col["C"], "3.5");
        }
Пример #5
0
        public void Object_With_Array()
        {
            var obj = new { A = 1, B = new[] { "2", "4", "6" }, C = 3.5 };
            var col = TurkSerializer.Collect(obj);

            Assert.Equal(col["A"], "1");
            Assert.Equal(col["B.1"], "2");
            Assert.Equal(col["B.2"], "4");
            Assert.Equal(col["B.3"], "6");
            Assert.Equal(col["C"], "3.5");
        }
Пример #6
0
        public void Null()
        {
            var col = TurkSerializer.Collect(null);

            Assert.Equal(0, col.Count);
        }