Пример #1
0
        public void DeleteForce_NullForce_ExpectArgumentNullException()
        {
            //Arrange
            var modelProblem = new ModelProblem("problem");

            //Act
            //Assert
            Assert.Throws <ArgumentNullException>(() => modelProblem.DeleteForce(null));
        }
Пример #2
0
        public void DeleteForce_ForceDoesExistInProblem_ExpectForceRemovedFromCollection()
        {
            //Arrange
            var modelProblem = new ModelProblem("problem");

            var force = modelProblem.AddForce(modelProblem.AddNode());

            //Act
            modelProblem.DeleteForce(force);

            //Assert
            Assert.That(modelProblem.Forces, Is.Empty);
        }
Пример #3
0
        public void DeleteForce_ForceDoesNotExistInProblem_ExpectNothingHappens()
        {
            //Arrange
            var modelProblem = new ModelProblem("problem");

            var otherProblem = new ModelProblem("otherProblem");
            var strayForce   = new ModelForce(otherProblem, 345, new ModelNode(otherProblem, 1234));

            //Act
            modelProblem.DeleteForce(strayForce);

            //Assert
            Assert.That(modelProblem.Forces, Is.Empty);
        }
Пример #4
0
        public void DeleteForce_ProblemWithSeveralForces_ExpectForceIdsAreCorrect()
        {
            //Arrange
            var modelProblem = new ModelProblem("problem");

            var force1 = modelProblem.AddForce(modelProblem.AddNode());
            var force2 = modelProblem.AddForce(modelProblem.AddNode());
            var force3 = modelProblem.AddForce(modelProblem.AddNode());
            var force4 = modelProblem.AddForce(modelProblem.AddNode());
            var force5 = modelProblem.AddForce(modelProblem.AddNode());

            //Act
            modelProblem.DeleteForce(force1);

            //Assert
            Assert.AreEqual(force2.Id, 1);
            Assert.AreEqual(force3.Id, 2);
            Assert.AreEqual(force4.Id, 3);
            Assert.AreEqual(force5.Id, 4);
        }