private DMT.Partition.Data.Partition CreatePartitionWithChildren(int count, Func <IEntityFactory, INode> createFunc) { var p = new DMT.Partition.Data.Partition(new CoreEntityFactory()); IEntityFactory f = new CoreEntityFactory(); for (int i = 0; i < count; i++) { p.Nodes.Add(createFunc(f)); } return(p); }
public void TestNodeSerialization() { MemoryStream ms = new MemoryStream(); var f = new CoreEntityFactory(); var ns = new NodeSerializer(ms, f, new DummyContextFactory()); ns.Serialize(f.CreateNode()); ms.Position = 0; var doc = XDocument.Load(ms); Assert.Single(doc.Descendants("Node")); }
public void TestDeserializeNode() { MemoryStream ms = new MemoryStream(); var f = new CoreEntityFactory(); var ns = new NodeSerializer(ms, f, new DummyContextFactory()); var nodeOrig = f.CreateNode(); ns.Serialize(nodeOrig); ms.Position = 0; var node = ns.Deserialize(); Assert.Equal(nodeOrig.Id, node.Id); }
public static SuperNode CreateWithChildren(int count, Func <IEntityFactory, INode> createFunc) { IEntityFactory f = new CoreEntityFactory(); return(CreateWithChildren(count, f, createFunc)); }