public void DeleteNode_NullNode_ExpectArgumentNullException() { //Arrange var modelProblem = new ModelProblem("problem"); //Act //Assert Assert.Throws <ArgumentNullException>(() => modelProblem.DeleteNode(null)); }
public void DeleteNode_NodeIsUsedByElementInDestinationNode_ExpectInvalidOperationException() { //Arrange var modelProblem = new ModelProblem("problem"); var node = modelProblem.AddNode(); var element = modelProblem.AddElement(modelProblem.AddNode(), node); //Act //Assert Assert.Throws <InvalidOperationException>(() => modelProblem.DeleteNode(node)); }
public void DeleteNode_NodeDoesExistInProblem_ExpectNodeRemovedFromCollection() { //Arrange var modelProblem = new ModelProblem("problem"); var node = modelProblem.AddNode(); //Act modelProblem.DeleteNode(node); //Assert Assert.That(modelProblem.Nodes, Is.Empty); }
public void DeleteNode_NodeDoesNotExistInProblem_ExpectNothingHappens() { //Arrange var modelProblem = new ModelProblem("problem"); var strayNode = new ModelNode(new ModelProblem("otherProblem"), 666); //Act modelProblem.DeleteNode(strayNode); //Assert Assert.That(modelProblem.Nodes, Is.Empty); }
public void DeleteNode_ProblemWithSeveralNodes_ExpectNodeIdsAreCorrect() { //Arrange var modelProblem = new ModelProblem("problem"); var node1 = modelProblem.AddNode(); var node2 = modelProblem.AddNode(); var node3 = modelProblem.AddNode(); var node4 = modelProblem.AddNode(); var node5 = modelProblem.AddNode(); //Act modelProblem.DeleteNode(node1); //Assert Assert.AreEqual(node2.Id, 1); Assert.AreEqual(node3.Id, 2); Assert.AreEqual(node4.Id, 3); Assert.AreEqual(node5.Id, 4); }