Beispiel #1
0
        public void TestCreate00()
        {
            IGraphController graphController = null;
            IStorage storage = new BinaryStorage();

            Assert.Throws<ArgumentNullException>(() =>
            {
                ISlot slot = Slot.Create(graphController, storage);
            });
        }
Beispiel #2
0
        public void TestCreate00()
        {
            IStorage storage = new BinaryStorage();
            EdgeController edgeController = null;

            Assert.Throws<ArgumentNullException>(() =>
            {
                IVisualEdge edge = VisualEdge.Create(edgeController, storage);
            });
        }
        public void TestDeserilaizeOperationException()
        {
            IGraphController graphController = new GraphController(null);
            IStorage storage = new BinaryStorage();
            CondensedNode node = new CondensedNode(graphController, "Hello World");

            ulong signature = Utilities.MakeEightCC('T', 'E', 'S', 'T', ' ', ' ', ' ', ' ');
            storage.WriteUnsignedInteger(signature, 21);
            storage.Seek(0, SeekOrigin.Begin);

            bool result = node.Deserialize(storage);
            Assert.AreEqual(result, false);
        }
Beispiel #4
0
        public void TestCreate02()
        {
            IGraphController graphController = new GraphController(null);
            IStorage storage = new BinaryStorage();

            storage.WriteUnsignedInteger(FieldCode.NodeSignature, 12);
            storage.WriteInteger(FieldCode.NodeType, 21);
            storage.Seek(0, SeekOrigin.Begin);

            Assert.Throws<ArgumentException>(() =>
            {
                IVisualNode node = VisualNode.Create(graphController, storage);
            });
        }
Beispiel #5
0
        public void TestDeserilaizeOperationException()
        {
            IGraphController graphController = new GraphController(null);
            IStorage storage = new BinaryStorage();
            DataHeader header = new DataHeader();

            storage.WriteUnsignedInteger(FieldCode.DataHeaderSignature, 21);
            storage.Seek(0, SeekOrigin.Begin);

            Assert.Throws<InvalidOperationException>(() =>
            {
                header.Deserialize(storage);
            });
        }
Beispiel #6
0
        public void TestSerializeDeserialize()
        {
            IGraphController graphController = new GraphController(null);
            IStorage storage = new BinaryStorage();
            DataHeader header1 = new DataHeader();
            header1.DataSize = 21;
            DataHeader header2 = new DataHeader();
            header2.DataSize = 12;

            header1.Serialize(storage);
            storage.Seek(0, SeekOrigin.Begin);
            header2.Deserialize(storage);

            Assert.AreEqual(21, header2.DataSize);
        }
Beispiel #7
0
        public void TestCreate02()
        {
            IStorage storage = new BinaryStorage();
            GraphController graphController = new GraphController(null);
            EdgeController edgeController = new EdgeController(graphController);
            IVisualEdge edge00 = new VisualEdge(edgeController, 0x30000001, 0x30000002, false);

            edge00.Serialize(storage);
            storage.Seek(0, SeekOrigin.Begin);
            IVisualEdge edge01 = VisualEdge.Create(edgeController, storage);

            Assert.AreEqual(edge00.EdgeId, edge01.EdgeId);
            Assert.AreEqual(edge00.StartSlotId, edge01.StartSlotId);
            Assert.AreEqual(edge00.EndSlotId, edge01.EndSlotId);
        }
        public void TestSerializeDeserialize()
        {
            IGraphController graphController = new GraphController(null);
            IStorage storage = new BinaryStorage();

            IVisualNode node1 = new CondensedNode(graphController, "Hello World");
            IVisualNode node2 = new CondensedNode(graphController, "ABC");

            node1.Serialize(storage);
            storage.Seek(0, SeekOrigin.Begin);
            node2.Deserialize(storage);

            Assert.AreEqual(NodeType.Condensed, node2.VisualType);
            Assert.AreEqual(node1.NodeId, node2.NodeId);
            Assert.AreEqual(true, ((CondensedNode)node2).Dirty);
            Assert.AreEqual(((CondensedNode)node1).Text, ((CondensedNode)node2).Text);
            Assert.AreEqual(((CondensedNode)node1).Caption, ((CondensedNode)node2).Caption);
            Assert.AreEqual(node1.X, node2.X);
            Assert.AreEqual(node1.Y, node2.Y);
        }
Beispiel #9
0
        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);
        }
Beispiel #10
0
        public void TestCreate02()
        {
            IGraphController graphController = new GraphController(null);
            IStorage storage = new BinaryStorage();
            IVisualNode node = new FunctionNode(graphController, "", "-", "double,double");
            ISlot slot1 = new Slot(graphController, SlotType.Input, node);

            slot1.Serialize(storage);
            storage.Seek(0, SeekOrigin.Begin);
            ISlot slot2 = Slot.Create(graphController, storage);

            Assert.AreEqual(SlotType.Input, slot2.SlotType);
            Assert.AreEqual(slot1.SlotId, slot2.SlotId);
            Assert.AreEqual(slot1.Owners[0], slot2.Owners[0]);
            Assert.AreEqual(slot1.ConnectingSlots, slot2.ConnectingSlots);
        }
Beispiel #11
0
        public void TestDeserilaizeOperationException()
        {
            IGraphController graphController = new GraphController(null);
            IStorage storage = new BinaryStorage();
            IVisualNode node = new FunctionNode(graphController, "", "-", "double,double");
            ISlot slot = new Slot(graphController, SlotType.Input, node);

            storage.WriteUnsignedInteger(FieldCode.SlotSignature, 21);
            storage.Seek(0, SeekOrigin.Begin);

            Assert.Throws<InvalidOperationException>(() =>
            {
                slot.Deserialize(storage);
            });
        }
Beispiel #12
0
        public void TestDeserialize1()
        {
            string code = "a=1;";
            Dictionary<int, List<VariableLine>> unboundIdentifiers = null;
            List<ProtoCore.AST.Node> astNodes = null;
            GraphUtilities.ParseCodeBlockNodeStatements(code, unboundIdentifiers, out astNodes);

            Ui.Statement statement = new Ui.Statement(astNodes[0]);

            IStorage storage = new BinaryStorage();
            statement.Serialize(storage);
            Ui.Statement newStatement = new Ui.Statement(storage);
            storage.Seek(0, SeekOrigin.Begin);
            newStatement.Deserialize(storage);

            VariableSlotInfo outputExpression = new VariableSlotInfo("a", 1, uint.MaxValue);
            Assert.AreEqual("a", statement.DefinedVariable);
            Assert.AreEqual(outputExpression, statement.OutputExpression);
            Assert.AreEqual(0, statement.References.Count);
            Assert.AreEqual(0, statement.Children.Count);
            Assert.AreEqual(false, statement.IsSwappable);
            Assert.AreEqual(false, statement.IsComplex);
        }
Beispiel #13
0
        public void TestDeserilaizeOperationException()
        {
            IGraphController graphController = new GraphController(null);
            IStorage storage = new BinaryStorage();
            IVisualNode node = new DriverNode(graphController, Configurations.DriverInitialTextValue);

            ulong signature = Utilities.MakeEightCC('T', 'E', 'S', 'T', ' ', ' ', ' ', ' ');
            storage.WriteUnsignedInteger(signature, 21);
            storage.Seek(0, SeekOrigin.Begin);

            bool result = node.Deserialize(storage);
            Assert.AreEqual(result, false);
        }
Beispiel #14
0
        public void TestDeserilaizeOperationException()
        {
            IStorage storage = new BinaryStorage();
            GraphController graphController = new GraphController(null);
            EdgeController edgeController = new EdgeController(graphController);
            IVisualEdge edge = new VisualEdge(edgeController, 0x30000001, 0x30000002, false);

            storage.WriteUnsignedInteger(FieldCode.EdgeSignature, 12);
            storage.Seek(0, SeekOrigin.Begin);

            Assert.Throws<InvalidOperationException>(() =>
            {
                edge.Deserialize(storage);
            });
        }