public void TestSerializeDeserialize() { IGraphController graphController = new GraphController(null); IStorage storage = new BinaryStorage(); IVisualNode node1 = new IdentifierNode(graphController, "a"); IVisualNode node2 = new IdentifierNode(graphController, "b"); node1.Serialize(storage); storage.Seek(0, SeekOrigin.Begin); node2.Deserialize(storage); Assert.AreEqual(NodeType.Identifier, node2.VisualType); Assert.AreEqual(node1.NodeId, node2.NodeId); Assert.AreEqual(true, ((IdentifierNode)node2).Dirty); Assert.AreEqual(((IdentifierNode)node1).Text, ((IdentifierNode)node2).Text); Assert.AreEqual(((IdentifierNode)node1).Caption, ((IdentifierNode)node2).Caption); Assert.AreEqual(node1.X, node2.X); Assert.AreEqual(node1.Y, node2.Y); Assert.AreEqual(1, node2.GetInputSlots().Length); Assert.AreEqual(1, node2.GetOutputSlots().Length); }
public void TestSerializeDeserialize() { IGraphController graphController = new GraphController(null); IStorage storage = new BinaryStorage(); IVisualNode node1 = new IdentifierNode(graphController, "a"); IVisualNode node2 = new IdentifierNode(graphController, "b"); node1.Serialize(storage); storage.Seek(0, SeekOrigin.Begin); node2.Deserialize(storage); Assert.AreEqual(NodeType.Identifier, node2.VisualType); Assert.AreEqual(node1.NodeId, node2.NodeId); Assert.AreEqual(true, ((IdentifierNode)node2).Dirty); Assert.AreEqual(((IdentifierNode)node1).Text, ((IdentifierNode)node2).Text); Assert.AreEqual(((IdentifierNode)node1).Caption, ((IdentifierNode)node2).Caption); Assert.AreEqual(node1.X, node2.X); Assert.AreEqual(node1.Y, node2.Y); Assert.AreEqual(1, node2.GetInputSlots().Length); Assert.AreEqual(1, node2.GetOutputSlots().Length); }