public void DeleteElement_NullElement_ExpectArgumentNullException() { //Arrange var modelProblem = new ModelProblem("problem"); //Act //Assert Assert.Throws <ArgumentNullException>(() => modelProblem.DeleteElement(null)); }
public void DeleteElement_ElementDoesNotExistInProblem_ExpectNothingHappens() { //Arrange var modelProblem = new ModelProblem("problem"); var otherProblem = new ModelProblem("otherProblem"); var strayElement = new ModelBarElement(otherProblem, 1234, new ModelNode(otherProblem, 123), new ModelNode(otherProblem, 1234)); //Act modelProblem.DeleteElement(strayElement); //Assert Assert.That(modelProblem.Elements, Is.Empty); }
public void DeleteElement_ElementDoesExistInProblem_ExpectElementMaterialRemovedFromCollection() { //Arrange var modelProblem = new ModelProblem("problem"); var origin = modelProblem.AddNode(); var destination = modelProblem.AddNode(); var element = modelProblem.AddElement(origin, destination); //Act modelProblem.DeleteElement(element); //Assert Assert.That(modelProblem.Elements, Is.Empty); }
public void DeleteElement_ProblemWithSeveralElements_ExpectElementIdsAreCorrect() { //Arrange var modelProblem = new ModelProblem("problem"); var element1 = modelProblem.AddElement(modelProblem.AddNode(), modelProblem.AddNode()); var element2 = modelProblem.AddElement(modelProblem.AddNode(), modelProblem.AddNode()); var element3 = modelProblem.AddElement(modelProblem.AddNode(), modelProblem.AddNode()); var element4 = modelProblem.AddElement(modelProblem.AddNode(), modelProblem.AddNode()); //Act modelProblem.DeleteElement(element1); //Assert Assert.AreEqual(element2.Id, 1); Assert.AreEqual(element3.Id, 2); Assert.AreEqual(element4.Id, 3); }