Пример #1
0
        public void TestSerializeNullException()
        {
            IGraphController graphController = new GraphController(null);
            IStorage         storage         = null;
            IVisualNode      node            = new IdentifierNode(graphController, "a");

            Assert.Throws <ArgumentNullException>(() =>
            {
                node.Serialize(storage);
            });
        }
Пример #2
0
        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);
        }
Пример #3
0
        public void TestSerializeNullException()
        {
            IGraphController graphController = new GraphController(null);
            IStorage storage = null;
            IVisualNode node = new IdentifierNode(graphController, "a");

            Assert.Throws<ArgumentNullException>(() =>
            {
                node.Serialize(storage);
            });
        }
Пример #4
0
        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);
        }