コード例 #1
0
        public void TestCanNotAddDuplicateSlotToTestNode()
        {
            var graph = new TestNodeGraph();
            var node  = new TestNode();
            var slot0 = new TestSlot(typeof(Vector3), SlotType.Output, 0);
            var slot1 = new TestSlot(typeof(Vector3), SlotType.Output, 0);

            node.AddSlot(slot0);
            node.AddSlot(slot1);
            node.name = "Test Node";
            graph.AddNode(node);

            Assert.AreEqual(1, graph.GetNodes <INode>().Count());
            var found = graph.GetNodes <INode>().FirstOrDefault();

            Assert.AreEqual(0, found.GetInputSlots <ISlot>().Count());
            Assert.AreEqual(1, found.GetOutputSlots <ISlot>().Count());
            Assert.AreEqual(1, found.GetSlots <ISlot>().Count());
        }
コード例 #2
0
        public void TestCanUpdateSlotPriorityByReaddingSlotToTestNode()
        {
            var graph = new TestNodeGraph();
            var node  = new TestNode();
            var slot0 = new TestSlot(typeof(Vector3), SlotType.Output, 0);
            var slot1 = new TestSlot(typeof(Vector3), SlotType.Output, 0).SetPriority(5);

            node.AddSlot(slot0);
            node.AddSlot(slot1);
            node.name = "Test Node";
            graph.AddNode(node);

            Assert.AreEqual(1, graph.GetNodes <INode>().Count());
            var found = graph.GetNodes <INode>().FirstOrDefault();

            Assert.AreEqual(0, found.GetInputSlots <ISlot>().Count());
            Assert.AreEqual(1, found.GetOutputSlots <ISlot>().Count());
            Assert.AreEqual(1, found.GetSlots <ISlot>().Count());

            var slot = found.GetOutputSlots <ISlot>().FirstOrDefault();

            Assert.AreEqual(5, slot.priority);
        }
コード例 #3
0
        public void TestCanUpdateDisplaynameByReaddingSlotToTestNode()
        {
            var graph = new TestNodeGraph();
            var node  = new TestNode();
            var slot0 = new TestSlot(typeof(Vector3), SlotType.Output, 0).SetDisplayName("output");
            var slot1 = new TestSlot(typeof(Vector3), SlotType.Output, 0).SetDisplayName("output_updated");

            node.AddSlot(slot0);
            node.AddSlot(slot1);
            node.name = "Test Node";
            graph.AddNode(node);

            Assert.AreEqual(1, graph.GetNodes <INode>().Count());
            var found = graph.GetNodes <INode>().FirstOrDefault();

            Assert.AreEqual(0, found.GetInputSlots <ISlot>().Count());
            Assert.AreEqual(1, found.GetOutputSlots <ISlot>().Count());
            Assert.AreEqual(1, found.GetSlots <ISlot>().Count());

            var slot = found.GetOutputSlots <ISlot>().FirstOrDefault();

            Assert.AreEqual("output_updated (Vector3)", slot.displayName);
        }