public void ValidateElement_SetStraMaterial_ExpectInvalidOperationException() { //Arrange ModelProblem problem = new ModelProblem("problem"); var node1 = problem.AddNode(); var node2 = problem.AddNode(); var element = problem.AddElement(node1, node2); var otherProblem = new ModelProblem("otherProblem"); var material = otherProblem.AddMaterial(); //Act //Assert Assert.Throws <InvalidOperationException>(() => element.Material = material); }
public (NodeViewModel, NodeViewModel, MaterialViewModel, IModelElement) BuildTestElement() { var modelProblem = new ModelProblem("test"); var node1 = modelProblem.AddNode(); var node2 = modelProblem.AddNode(); var element = modelProblem.AddElement(node1, node2); var nodeViewModel1 = new NodeViewModel(node1); var nodeViewModel2 = new NodeViewModel(node2); var materialViewModel = new MaterialViewModel(element.Material); return(nodeViewModel1, nodeViewModel2, materialViewModel, element); }
public void ValidateElement_SetStrayNodeAsDestinationNode_ExpectInvalidOperationException() { //Arrange ModelProblem problem = new ModelProblem("problem"); var node1 = problem.AddNode(); var node2 = problem.AddNode(); var element = problem.AddElement(node1, node2); var otherProblem = new ModelProblem("otherProblem"); var strayNode = otherProblem.AddNode(); //Act //Assert Assert.Throws <InvalidOperationException>(() => element.DestinationNode = strayNode); }
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); }