public void TestSerializeDeserialize() { IGraphController graphController = new GraphController(null); IStorage storage = new BinaryStorage(); IVisualNode node1 = new RenderNode(graphController, 1); IVisualNode node2 = new RenderNode(graphController, 1); node1.Serialize(storage); storage.Seek(0, SeekOrigin.Begin); node2.Deserialize(storage); Assert.AreEqual(NodeType.Render, node2.VisualType); Assert.AreEqual(node1.NodeId, node2.NodeId); Assert.AreEqual(true, ((RenderNode)node2).Dirty); Assert.AreEqual(((RenderNode)node1).Text, ((RenderNode)node2).Text); Assert.AreEqual(((RenderNode)node1).Caption, ((RenderNode)node2).Caption); Assert.AreEqual(node1.X, node2.X); Assert.AreEqual(node1.Y, node2.Y); //Assert.AreEqual(1, node2.GetInputSlots().Length); //Assert.AreEqual(0, node2.GetOutputSlots().Length); }
public void TestSerializeNullException() { IGraphController graphController = new GraphController(null); IStorage storage = null; IVisualNode node = new RenderNode(graphController, 1); Assert.Throws<ArgumentNullException>(() => { node.Serialize(storage); }); }