コード例 #1
0
        public void CircularGraph()
        {
            var parent = new CI { Title = "parent" };
            var child = new CI { Title = "child" };
            child.AddTo(parent);

            var result = parent.ToJson();

            result.ShouldContain("\"Title\":\"parent\"");
            result.ShouldContain("\"Title\":\"child\"");
            result.ShouldContain("\"Parent\":null");
            result.ShouldNotContain("\"Parent\":{");
            result.ShouldContain("\"Children\":[{");
        }
コード例 #2
0
        public void CircularGraph_Child()
        {
            var parent = new CI {
                ID = 1, Title = "parent"
            };
            var child = new CI {
                ID = 2, Title = "child"
            };

            child.AddTo(parent);

            var result       = child.ToJson();
            var deserialized = new JavaScriptSerializer().Deserialize <Dictionary <string, object> >(result);

            deserialized["Title"].ShouldBe("child");
            deserialized["Parent"].ShouldBe(1);
        }
コード例 #3
0
        public void CircularGraph_Parent()
        {
            var parent = new CI {
                ID = 1, Title = "parent"
            };
            var child = new CI {
                ID = 2, Title = "child"
            };

            child.AddTo(parent);

            var result       = parent.ToJson();
            var deserialized = new JavaScriptSerializer().Deserialize <Dictionary <string, object> >(result);

            deserialized["Title"].ShouldBe("parent");
            deserialized.ContainsKey("Children").ShouldBe(false);
        }
コード例 #4
0
        public void CircularGraph()
        {
            var parent = new CI {
                Title = "parent"
            };
            var child = new CI {
                Title = "child"
            };

            child.AddTo(parent);

            var result = parent.ToJson();

            result.ShouldContain("\"Title\":\"parent\"");
            result.ShouldContain("\"Title\":\"child\"");
            result.ShouldContain("\"Parent\":null");
            result.ShouldNotContain("\"Parent\":{");
            result.ShouldContain("\"Children\":[{");
        }
コード例 #5
0
ファイル: JsonWriterTests.cs プロジェクト: nicklv/n2cms
        public void CircularGraph_Child()
        {
            var parent = new CI { ID = 1, Title = "parent" };
            var child = new CI { ID = 2, Title = "child" };
            child.AddTo(parent);

            var result = child.ToJson();
            var deserialized = new JavaScriptSerializer().Deserialize<Dictionary<string, object>>(result);

            deserialized["Title"].ShouldBe("child");
            deserialized["Parent"].ShouldBe(1);
        }
コード例 #6
0
ファイル: JsonWriterTests.cs プロジェクト: nicklv/n2cms
        public void CircularGraph_Parent()
        {
            var parent = new CI { ID = 1, Title = "parent" };
            var child = new CI { ID = 2, Title = "child" };
            child.AddTo(parent);

            var result = parent.ToJson();
            var deserialized = new JavaScriptSerializer().Deserialize<Dictionary<string, object>>(result);

            deserialized["Title"].ShouldBe("parent");
            deserialized.ContainsKey("Children").ShouldBe(false);
        }