コード例 #1
0
        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"));
        }
コード例 #2
0
        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));
        }