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