示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }
示例#4
0
        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);
        }