Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.Test/ClosingStructuresFailureMechanismSectionResultTest.cs =================================================================== diff -u -r3fad85f24665fdcfe75cba4e2f9ab30c2ca6a4b6 -r673e35de0df920529e5dda63ea8b4dfb08ed65a8 --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.Test/ClosingStructuresFailureMechanismSectionResultTest.cs (.../ClosingStructuresFailureMechanismSectionResultTest.cs) (revision 3fad85f24665fdcfe75cba4e2f9ab30c2ca6a4b6) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.Test/ClosingStructuresFailureMechanismSectionResultTest.cs (.../ClosingStructuresFailureMechanismSectionResultTest.cs) (revision 673e35de0df920529e5dda63ea8b4dfb08ed65a8) @@ -31,52 +31,33 @@ public class ClosingStructuresFailureMechanismSectionResultTest { [Test] - public void Constructor_WithoutSection_ThrowsArgumentNullException() + public void Constructor_WithParameters_ExpectedValues() { - // Call - TestDelegate test = () => new ClosingStructuresFailureMechanismSectionResult(null); - - // Assert - var paramName = Assert.Throws(test).ParamName; - Assert.AreEqual("section", paramName); - } - - [Test] - public void Constructor_WithSection_ResultCreatedForSection() - { // Setup - var section = new FailureMechanismSection("Section", new[] - { - new Point2D(0, 0) - }); + FailureMechanismSection section = CreateSection(); // Call var result = new ClosingStructuresFailureMechanismSectionResult(section); // Assert Assert.IsInstanceOf(result); Assert.AreSame(section, result.Section); - Assert.IsFalse(result.AssessmentLayerOne); Assert.IsNaN(result.AssessmentLayerTwoA); - Assert.IsNaN(result.AssessmentLayerThree); } [Test] [TestCase(-20)] [TestCase(-1e-6)] [TestCase(1 + 1e-6)] [TestCase(12)] - public void AssessmentLayerTwoA_ForInvalidValues_ThrowsException(double a) + public void AssessmentLayerTwoA_ForInvalidValues_ThrowsException(double newValue) { // Setup - var section = new FailureMechanismSection("Section", new[] - { - new Point2D(0, 0) - }); + FailureMechanismSection section = CreateSection(); var result = new ClosingStructuresFailureMechanismSectionResult(section); // Call - TestDelegate test = () => result.AssessmentLayerTwoA = a; + TestDelegate test = () => result.AssessmentLayerTwoA = newValue; // Assert var message = Assert.Throws(test).Message; @@ -91,20 +72,25 @@ [TestCase(0.5)] [TestCase(1 - 1e-6)] [TestCase(1)] - public void AssessmentLayerTwoA_ForValidValues_NewValueSet(double a) + public void AssessmentLayerTwoA_ForValidValues_NewValueSet(double newValue) { // Setup - var section = new FailureMechanismSection("Section", new[] - { - new Point2D(0, 0) - }); + FailureMechanismSection section = CreateSection(); var result = new ClosingStructuresFailureMechanismSectionResult(section); // Call - result.AssessmentLayerTwoA = a; + result.AssessmentLayerTwoA = newValue; // Assert - Assert.AreEqual(a, result.AssessmentLayerTwoA); + Assert.AreEqual(newValue, result.AssessmentLayerTwoA); } + + private static FailureMechanismSection CreateSection() + { + return new FailureMechanismSection("Section", new[] + { + new Point2D(0, 0) + }); + } } } \ No newline at end of file