Пример #1
0
        public void Builder_LinkBoardToA_BoardIsLinkedToA()
        {
            // Arrange
            var builder = new BoardBuilder();

            // Act
            // Create first board
            var varName1  = "A";
            var compName1 = "Input";

            builder.AddComponent(varName1, compName1);

            var varName2  = "B";
            var compName2 = "Probe";

            builder.AddComponent(varName2, compName2);

            builder.LinkList(varName1, new[] { varName2 });
            var board = builder.Build();

            // Create second board
            builder.AddComponent(varName1, compName1);
            builder.AddBoard("board1", board);

            builder.Link("board1", "A");

            // Assert
            var components = builder.Build().Components;
            var node1      = components[varName1];

            Assert.IsInstanceOfType(node1.Next[0], typeof(Board));
            Assert.AreEqual(node1.Next[0].Name, "board1");
        }
Пример #2
0
        public void Builder_LinkAToB_AIsLinkedToB()
        {
            // Arrange
            var builder = new BoardBuilder();

            // Act
            var varName  = "A";
            var compName = "Input";

            builder.AddComponent(varName, compName);

            var varName2  = "B";
            var compName2 = "OR";

            builder.AddComponent(varName2, compName2);


            builder.Link(varName2, varName);
            // Assert
            var components = builder.Build().Components;
            var node1      = components[varName];
            var node2      = components[varName2];

            Assert.AreEqual(node1, node2.Previous[0]);
            Assert.AreEqual(node2, node1.Next[0]);
        }