Example #1
0
        public void AddPredecessor_AddedPredecessorNull_ThrowsArgumentNullException()
        {
            // arrange
            ConcreteNode testNode = new ConcreteNode(0, 0, "testNode");

            // act
            testNode.AddPredecessor(null);
        }
Example #2
0
        public void AddPredecessor_PredecessorAddedFirstTime_PredecessorAddedToPredecessors()
        {
            // arrange
            ConcreteNode testNode = new ConcreteNode(0, 0, "testNode");
            StubNode predecessor = new StubNode();

            // act
            testNode.AddPredecessor(predecessor);

            // assert
            Assert.IsTrue(testNode.Predecessors.Contains(predecessor));
        }
Example #3
0
        public void AddPredecessor_PredecessorAddedTwice_SecondPredecessorNotAddedToPredecessors()
        {
            // arrange
            ConcreteNode testNode = new ConcreteNode(0, 0, "testNode");
            StubNode predecessor = new StubNode();

            // act
            testNode.AddPredecessor(predecessor);
            testNode.AddPredecessor(predecessor);

            // assert
            Assert.AreEqual(1, testNode.Predecessors.Where(pred => pred.Equals(predecessor)).Count());
        }