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\":[{"); }
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); }
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); }
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); }
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); }