コード例 #1
0
        public void AddNode_GivenExistingNode_NodeIsNotAdded()
        {
            //Arrange
            var obj     = new Alfa();
            var node    = new PropertyNode(nameof(obj.A), obj);
            var reactor = new Reactor("R1");

            reactor.AddNode(node);

            //Act
            reactor.AddNode(node);

            //Assert
            Assert.IsTrue(reactor.Nodes.Count == 1);
        }
コード例 #2
0
        public void AddNode_GivenNodeIsNull_ThrowsException()
        {
            //Arrange
            var reactor = new Reactor("R1");

            //Act
            reactor.AddNode(null);
        }
コード例 #3
0
        public void AddNode_GivenValidNode_NodeIsAdded()
        {
            //Arrange
            var obj     = new Alfa();
            var node    = new PropertyNode(nameof(obj.A), obj);
            var reactor = new Reactor("R1");

            //Act
            reactor.AddNode(node);

            //Assert
            Assert.IsTrue(reactor.GetNode(node.Identifier) != null);
        }
コード例 #4
0
        public void GetNode_GivenExistingNode2_ReturnsMatchingNode()
        {
            //Arrange
            var obj     = new Alfa();
            var node    = new PropertyNode(nameof(obj.A), obj);
            var reactor = new Reactor("R1");

            reactor.AddNode(node);

            //Act
            var fetchedNode = reactor.GetNode(node.Identifier);

            //Assert
            Assert.IsNotNull(fetchedNode);
        }
コード例 #5
0
        public void GetNode_GivenNoMatchingNode3_ReturnsNull()
        {
            //Arrange
            var obj     = new Alfa();
            var node    = new PropertyNode(nameof(obj.A), obj);
            var reactor = new Reactor("R1");

            reactor.AddNode(node);

            //Act
            var fetchedNode = reactor.GetNode(nameof(obj.B), obj);

            //Assert
            Assert.IsNull(fetchedNode);
        }
コード例 #6
0
        public void RemoveNode_GivenExistingNode_NodeIsRemoved()
        {
            //Arrange
            var obj     = new Alfa();
            var node    = new PropertyNode(nameof(obj.A), obj);
            var reactor = new Reactor("R1");

            reactor.AddNode(node);

            //Act
            reactor.RemoveNode(node);

            //Assert
            Assert.IsTrue(reactor.GetNode(node.Identifier) == null);
        }