public void DeleteMaterial_NullMaterial_ExpectArgumentNullException() { //Arrange var modelProblem = new ModelProblem("problem"); //Act //Assert Assert.Throws <ArgumentNullException>(() => modelProblem.DeleteMaterial(null)); }
public void DeleteMaterial_MaterialIsUsedByElement_ExpectInvalidOperationException() { //Arrange var modelProblem = new ModelProblem("problem"); var element = modelProblem.AddElement(modelProblem.AddNode(), modelProblem.AddNode()); //Act //Assert Assert.Throws <InvalidOperationException>(() => modelProblem.DeleteMaterial(element.Material)); }
public void DeleteMaterial_MaterialDoesExistInProblem_ExpectMaterialRemovedFromCollection() { //Arrange var modelProblem = new ModelProblem("problem"); var material = modelProblem.AddMaterial(); //Act modelProblem.DeleteMaterial(material); //Assert Assert.That(modelProblem.Materials, Is.Empty); }
public void DeleteMaterial_MaterialDoesNotExistInProblem_ExpectNothingHappens() { //Arrange var modelProblem = new ModelProblem("problem"); var otherProblem = new ModelProblem("otherProblem"); var strayMaterial = new ModelMaterial(otherProblem, 666, "strayMaterial", 1); //Act modelProblem.DeleteMaterial(strayMaterial); //Assert Assert.That(modelProblem.Materials, Is.Empty); }
public void DeleteMaterial_ProblemWithSeveralMaterials_ExpectMaterialIdsAreCorrect() { //Arrange var modelProblem = new ModelProblem("problem"); var material1 = modelProblem.AddMaterial(); var material2 = modelProblem.AddMaterial(); var material3 = modelProblem.AddMaterial(); var material4 = modelProblem.AddMaterial(); var material5 = modelProblem.AddMaterial(); //Act modelProblem.DeleteMaterial(material1); //Assert Assert.AreEqual(material2.Id, 1); Assert.AreEqual(material3.Id, 2); Assert.AreEqual(material4.Id, 3); Assert.AreEqual(material5.Id, 4); }