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); }
public void AddNode_GivenNodeIsNull_ThrowsException() { //Arrange var reactor = new Reactor("R1"); //Act reactor.AddNode(null); }
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); }
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); }
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); }
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); }