示例#1
0
        public void TestAddNeighbours()
        {
            MockAutomata mockAutomataA = new MockAutomata();
            MockAutomata mockAutomataB = new MockAutomata();
            MockAutomata mockAutomataC = new MockAutomata();

            MockConnection ab = new MockConnection(true, mockAutomataB, 1.2m);

            mockAutomataA.AddRelationship(ab);

            MockConnection ac = new MockConnection(true, mockAutomataC, 1.4m);

            mockAutomataA.AddRelationship(ac);

            MockConnection bc = new MockConnection(true, mockAutomataC, 0.4m);

            mockAutomataB.AddRelationship(bc);

            MockConnection ca = new MockConnection(true, mockAutomataA, 0.7m);

            mockAutomataC.AddRelationship(ca);

            Assert.Equal(mockAutomataA.GetAllNeighbours().Count, 2);
            Assert.Single(mockAutomataB.GetAllNeighbours());
            Assert.Single(mockAutomataC.GetAllNeighbours());
        }
示例#2
0
 public MockConnection(bool canSend, MockAutomata automata, decimal rate)
 {
     this.canSendData   = canSend;
     this.sendRate      = rate;
     this.connectedNode = automata;
 }