public void TestEdgesSerialization() { MemoryStream ms = new MemoryStream(); var f = new VirEntityFactory(); var ns = new NodeSerializer(ms, f, new DummyContextFactory()); var node = f.CreateNode(); node.ConnectTo(f.CreateNode(), Core.Interfaces.EdgeDirection.Both); ns.Serialize(node); ms.Position = 0; Assert.Single(XDocument.Load(ms).Descendants("Edge")); }
public void TestEdgeDeserialization() { MemoryStream ms = new MemoryStream(); var f = new VirEntityFactory(); var ns = new NodeSerializer(ms, f, new DummyContextFactory()); var node = new Person(f); node.ConnectTo(f.CreateNode(), Core.Interfaces.EdgeDirection.Both); ns.Serialize(node); ms.Position = 0; var nOut = ns.Deserialize(); Assert.Single(nOut.Edges); Assert.IsAssignableFrom <IRemoteNode>(nOut.Edges.Single().GetOtherNode(nOut)); }