Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Service.Test/ClosingStructuresCalculationServiceTest.cs =================================================================== diff -u -r80e51fdd446be6524d4f3bcc4175e8d3ae9c86ff -r2ba2957ae849bb05a45cf13f81a8f6464184caef --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Service.Test/ClosingStructuresCalculationServiceTest.cs (.../ClosingStructuresCalculationServiceTest.cs) (revision 80e51fdd446be6524d4f3bcc4175e8d3ae9c86ff) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Service.Test/ClosingStructuresCalculationServiceTest.cs (.../ClosingStructuresCalculationServiceTest.cs) (revision 2ba2957ae849bb05a45cf13f81a8f6464184caef) @@ -468,17 +468,16 @@ { // Setup var closingStructuresFailureMechanism = new ClosingStructuresFailureMechanism(); - - var mockRepository = new MockRepository(); - var assessmentSectionStub = mockRepository.Stub(); - mockRepository.ReplayAll(); - closingStructuresFailureMechanism.AddSection(new FailureMechanismSection("test section", new[] { new Point2D(0, 0), new Point2D(1, 1) })); + var mockRepository = new MockRepository(); + var assessmentSectionStub = mockRepository.Stub(); + mockRepository.ReplayAll(); + var calculation = new TestClosingStructuresCalculation { InputParameters = @@ -519,17 +518,17 @@ { // Setup var closingStructuresFailureMechanism = new ClosingStructuresFailureMechanism(); + closingStructuresFailureMechanism.AddSection(new FailureMechanismSection("test section", new[] + { + new Point2D(0, 0), + new Point2D(1, 1) + })); var mockRepository = new MockRepository(); IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(closingStructuresFailureMechanism, mockRepository); mockRepository.ReplayAll(); - closingStructuresFailureMechanism.AddSection(new FailureMechanismSection("test section", new[] - { - new Point2D(0, 0), - new Point2D(1, 1) - })); var calculation = new TestClosingStructuresCalculation { @@ -605,18 +604,17 @@ { // Setup var closingStructuresFailureMechanism = new ClosingStructuresFailureMechanism(); - - var mockRepository = new MockRepository(); - IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(closingStructuresFailureMechanism, - mockRepository); - mockRepository.ReplayAll(); - closingStructuresFailureMechanism.AddSection(new FailureMechanismSection("test section", new[] { new Point2D(0, 0), new Point2D(1, 1) })); + var mockRepository = new MockRepository(); + IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(closingStructuresFailureMechanism, + mockRepository); + mockRepository.ReplayAll(); + var calculation = new TestClosingStructuresCalculation { InputParameters = @@ -691,18 +689,17 @@ { // Setup var closingStructuresFailureMechanism = new ClosingStructuresFailureMechanism(); - - var mockRepository = new MockRepository(); - IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(closingStructuresFailureMechanism, - mockRepository); - mockRepository.ReplayAll(); - closingStructuresFailureMechanism.AddSection(new FailureMechanismSection("test section", new[] { new Point2D(0, 0), new Point2D(1, 1) })); + var mockRepository = new MockRepository(); + IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(closingStructuresFailureMechanism, + mockRepository); + mockRepository.ReplayAll(); + var calculation = new TestClosingStructuresCalculation { InputParameters = @@ -775,18 +772,17 @@ { // Setup var closingStructuresFailureMechanism = new ClosingStructuresFailureMechanism(); - - var mockRepository = new MockRepository(); - IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(closingStructuresFailureMechanism, - mockRepository); - mockRepository.ReplayAll(); - closingStructuresFailureMechanism.AddSection(new FailureMechanismSection("test section", new[] { new Point2D(0, 0), new Point2D(1, 1) })); + var mockRepository = new MockRepository(); + IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(closingStructuresFailureMechanism, + mockRepository); + mockRepository.ReplayAll(); + var calculation = new TestClosingStructuresCalculation { InputParameters = @@ -842,18 +838,17 @@ { // Setup var closingStructuresFailureMechanism = new ClosingStructuresFailureMechanism(); - - var mockRepository = new MockRepository(); - IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(closingStructuresFailureMechanism, - mockRepository); - mockRepository.ReplayAll(); - closingStructuresFailureMechanism.AddSection(new FailureMechanismSection("test section", new[] { new Point2D(0, 0), new Point2D(1, 1) })); + var mockRepository = new MockRepository(); + IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(closingStructuresFailureMechanism, + mockRepository); + mockRepository.ReplayAll(); + var calculation = new TestClosingStructuresCalculation { InputParameters = @@ -878,25 +873,25 @@ Assert.IsNull(calculation.Output); Assert.IsTrue(calculator.IsCanceled); } + mockRepository.VerifyAll(); } [Test] public void Calculate_CalculationFailedWithExceptionAndLastErrorPresent_LogErrorAndThrowException() { // Setup var failureMechanism = new ClosingStructuresFailureMechanism(); - - var mockRepository = new MockRepository(); - IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, - mockRepository); - mockRepository.ReplayAll(); - failureMechanism.AddSection(new FailureMechanismSection("test section", new[] { new Point2D(0, 0), new Point2D(1, 1) })); + var mockRepository = new MockRepository(); + IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, + mockRepository); + mockRepository.ReplayAll(); + var calculation = new TestClosingStructuresCalculation { InputParameters = @@ -940,26 +935,27 @@ StringAssert.StartsWith(string.Format("Berekening van '{0}' beëindigd om: ", calculation.Name), msgs[3]); }); Assert.IsTrue(exceptionThrown); + Assert.IsNull(calculation.Output); } + mockRepository.VerifyAll(); } [Test] public void Calculate_CalculationFailedWithExceptionAndNoLastErrorPresent_LogErrorAndThrowException() { // Setup var failureMechanism = new ClosingStructuresFailureMechanism(); - - var mockRepository = new MockRepository(); - IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, - mockRepository); - mockRepository.ReplayAll(); - failureMechanism.AddSection(new FailureMechanismSection("test section", new[] { new Point2D(0, 0), new Point2D(1, 1) })); + var mockRepository = new MockRepository(); + IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, + mockRepository); + mockRepository.ReplayAll(); + var calculation = new TestClosingStructuresCalculation { InputParameters = @@ -1002,26 +998,27 @@ StringAssert.StartsWith(string.Format("Berekening van '{0}' beëindigd om: ", calculation.Name), msgs[3]); }); Assert.IsTrue(exceptionThrown); + Assert.IsNull(calculation.Output); } + mockRepository.VerifyAll(); } [Test] public void Calculate_CalculationFailedWithoutExceptionAndWithLastErrorPresent_LogErrorAndThrowException() { // Setup var failureMechanism = new ClosingStructuresFailureMechanism(); - - var mockRepository = new MockRepository(); - IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, - mockRepository); - mockRepository.ReplayAll(); - failureMechanism.AddSection(new FailureMechanismSection("test section", new[] { new Point2D(0, 0), new Point2D(1, 1) })); + var mockRepository = new MockRepository(); + IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, + mockRepository); + mockRepository.ReplayAll(); + var calculation = new TestClosingStructuresCalculation { InputParameters = @@ -1070,6 +1067,7 @@ Assert.IsTrue(exceptionThrown); Assert.AreEqual(calculator.LastErrorFileContent, exceptionMessage); } + mockRepository.VerifyAll(); } /// Index: Ringtoets/Common/src/Ringtoets.Common.Service/MessageProviders/ICalculationMessageProvider.cs =================================================================== diff -u -rc7d39e2c22a5df98a9f398cab98040a51faba283 -r2ba2957ae849bb05a45cf13f81a8f6464184caef --- Ringtoets/Common/src/Ringtoets.Common.Service/MessageProviders/ICalculationMessageProvider.cs (.../ICalculationMessageProvider.cs) (revision c7d39e2c22a5df98a9f398cab98040a51faba283) +++ Ringtoets/Common/src/Ringtoets.Common.Service/MessageProviders/ICalculationMessageProvider.cs (.../ICalculationMessageProvider.cs) (revision 2ba2957ae849bb05a45cf13f81a8f6464184caef) @@ -44,7 +44,7 @@ /// Gets the message that should be used when a calculation fails. /// /// The calculation subject used in the calculation name. - /// The failure message provided from the calculation. + /// The failure message provided by the calculation. /// The message. string GetCalculationFailedMessage(string calculationSubject, string failureMessage); Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Service.Test/GrassCoverErosionInwardsCalculationServiceTest.cs =================================================================== diff -u -r80e51fdd446be6524d4f3bcc4175e8d3ae9c86ff -r2ba2957ae849bb05a45cf13f81a8f6464184caef --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Service.Test/GrassCoverErosionInwardsCalculationServiceTest.cs (.../GrassCoverErosionInwardsCalculationServiceTest.cs) (revision 80e51fdd446be6524d4f3bcc4175e8d3ae9c86ff) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Service.Test/GrassCoverErosionInwardsCalculationServiceTest.cs (.../GrassCoverErosionInwardsCalculationServiceTest.cs) (revision 2ba2957ae849bb05a45cf13f81a8f6464184caef) @@ -441,7 +441,7 @@ } [Test] - public void Calculate_DikeHeightCalculationFails_OutputNaN() + public void Calculate_DikeHeightCalculationFails_OutputNotNull() { // Setup var grassCoverErosionInwardsFailureMechanism = new GrassCoverErosionInwardsFailureMechanism(); @@ -828,6 +828,7 @@ StringAssert.StartsWith(string.Format("Berekening van '{0}' beëindigd om: ", calculation.Name), msgs[3]); }); Assert.IsTrue(exceptionThrown); + Assert.IsNull(calculation.Output); } } @@ -899,6 +900,7 @@ }); Assert.IsTrue(exceptionThrown); Assert.AreEqual(calculator.LastErrorFileContent, exceptionMessage); + Assert.IsNull(calculation.Output); } } Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Service.Test/GrassCoverErosionOutwardsWaveConditionsCalculationServiceTest.cs =================================================================== diff -u -r80e51fdd446be6524d4f3bcc4175e8d3ae9c86ff -r2ba2957ae849bb05a45cf13f81a8f6464184caef --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Service.Test/GrassCoverErosionOutwardsWaveConditionsCalculationServiceTest.cs (.../GrassCoverErosionOutwardsWaveConditionsCalculationServiceTest.cs) (revision 80e51fdd446be6524d4f3bcc4175e8d3ae9c86ff) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Service.Test/GrassCoverErosionOutwardsWaveConditionsCalculationServiceTest.cs (.../GrassCoverErosionOutwardsWaveConditionsCalculationServiceTest.cs) (revision 2ba2957ae849bb05a45cf13f81a8f6464184caef) @@ -586,8 +586,8 @@ StringAssert.StartsWith(string.Format("Berekening van '{0}' beëindigd om: ", calculation.Name), msgs[5]); }); Assert.IsTrue(exception); - mockRepository.VerifyAll(); } + mockRepository.VerifyAll(); } [Test] @@ -648,8 +648,9 @@ StringAssert.StartsWith(string.Format("Berekening van '{0}' beëindigd om: ", calculation.Name), msgs[5]); }); Assert.IsTrue(exception); - mockRepository.VerifyAll(); + Assert.IsNull(calculation.Output); } + mockRepository.VerifyAll(); } [Test] @@ -714,8 +715,9 @@ }); Assert.IsTrue(exception); Assert.AreEqual(calculator.LastErrorFileContent, exceptionMessage); - mockRepository.VerifyAll(); + Assert.IsNull(calculation.Output); } + mockRepository.VerifyAll(); } [Test] Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Service.Test/HeightStructuresCalculationServiceTest.cs =================================================================== diff -u -r80e51fdd446be6524d4f3bcc4175e8d3ae9c86ff -r2ba2957ae849bb05a45cf13f81a8f6464184caef --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Service.Test/HeightStructuresCalculationServiceTest.cs (.../HeightStructuresCalculationServiceTest.cs) (revision 80e51fdd446be6524d4f3bcc4175e8d3ae9c86ff) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Service.Test/HeightStructuresCalculationServiceTest.cs (.../HeightStructuresCalculationServiceTest.cs) (revision 2ba2957ae849bb05a45cf13f81a8f6464184caef) @@ -519,17 +519,16 @@ { // Setup var heightStructuresFailureMechanism = new HeightStructuresFailureMechanism(); - - var mockRepository = new MockRepository(); - IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(heightStructuresFailureMechanism, mockRepository); - mockRepository.ReplayAll(); - heightStructuresFailureMechanism.AddSection(new FailureMechanismSection("test section", new[] { new Point2D(0, 0), new Point2D(1, 1) })); + var mockRepository = new MockRepository(); + IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(heightStructuresFailureMechanism, mockRepository); + mockRepository.ReplayAll(); + var calculation = new TestHeightStructuresCalculation { InputParameters = @@ -587,17 +586,16 @@ { // Setup var heightStructuresFailureMechanism = new HeightStructuresFailureMechanism(); - - var mockRepository = new MockRepository(); - IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(heightStructuresFailureMechanism, mockRepository); - mockRepository.ReplayAll(); - heightStructuresFailureMechanism.AddSection(new FailureMechanismSection("test section", new[] { new Point2D(0, 0), new Point2D(1, 1) })); + var mockRepository = new MockRepository(); + IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(heightStructuresFailureMechanism, mockRepository); + mockRepository.ReplayAll(); + var calculation = new TestHeightStructuresCalculation { InputParameters = @@ -640,17 +638,16 @@ { // Setup var heightStructuresFailureMechanism = new HeightStructuresFailureMechanism(); - - var mockRepository = new MockRepository(); - IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(heightStructuresFailureMechanism, mockRepository); - mockRepository.ReplayAll(); - heightStructuresFailureMechanism.AddSection(new FailureMechanismSection("test section", new[] { new Point2D(0, 0), new Point2D(1, 1) })); + var mockRepository = new MockRepository(); + IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(heightStructuresFailureMechanism, mockRepository); + mockRepository.ReplayAll(); + var calculation = new TestHeightStructuresCalculation { InputParameters = @@ -718,17 +715,16 @@ { // Setup var heightStructuresFailureMechanism = new HeightStructuresFailureMechanism(); - - var mockRepository = new MockRepository(); - IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(heightStructuresFailureMechanism, mockRepository); - mockRepository.ReplayAll(); - heightStructuresFailureMechanism.AddSection(new FailureMechanismSection("test section", new[] { new Point2D(0, 0), new Point2D(1, 1) })); + var mockRepository = new MockRepository(); + IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(heightStructuresFailureMechanism, mockRepository); + mockRepository.ReplayAll(); + var calculation = new TestHeightStructuresCalculation { InputParameters = @@ -754,25 +750,25 @@ Assert.IsNull(calculation.Output); Assert.IsTrue(testStructuresOvertoppingCalculator.IsCanceled); } + mockRepository.VerifyAll(); } [Test] public void Calculate_CalculationFailedWithExceptionAndLastErrorPresent_LogErrorAndThrowException() { // Setup var failureMechanism = new HeightStructuresFailureMechanism(); - - var mockRepository = new MockRepository(); - IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, - mockRepository); - mockRepository.ReplayAll(); - failureMechanism.AddSection(new FailureMechanismSection("test section", new[] { new Point2D(0, 0), new Point2D(1, 1) })); + var mockRepository = new MockRepository(); + IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, + mockRepository); + mockRepository.ReplayAll(); + var calculation = new TestHeightStructuresCalculation { InputParameters = @@ -816,26 +812,27 @@ StringAssert.StartsWith(string.Format("Berekening van '{0}' beëindigd om: ", calculation.Name), msgs[3]); }); Assert.IsTrue(exceptionThrown); + Assert.IsNull(calculation.Output); } + mockRepository.VerifyAll(); } [Test] public void Calculate_CalculationFailedWithExceptionAndNoLastErrorPresent_LogErrorAndThrowException() { // Setup var failureMechanism = new HeightStructuresFailureMechanism(); - - var mockRepository = new MockRepository(); - IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, - mockRepository); - mockRepository.ReplayAll(); - failureMechanism.AddSection(new FailureMechanismSection("test section", new[] { new Point2D(0, 0), new Point2D(1, 1) })); + var mockRepository = new MockRepository(); + IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, + mockRepository); + mockRepository.ReplayAll(); + var calculation = new TestHeightStructuresCalculation { InputParameters = @@ -878,26 +875,27 @@ StringAssert.StartsWith(string.Format("Berekening van '{0}' beëindigd om: ", calculation.Name), msgs[3]); }); Assert.IsTrue(exceptionThrown); + Assert.IsNull(calculation.Output); } + mockRepository.VerifyAll(); } [Test] public void Calculate_CalculationFailedWithoutExceptionAndWithLastErrorPresent_LogErrorAndThrowException() { // Setup var failureMechanism = new HeightStructuresFailureMechanism(); - - var mockRepository = new MockRepository(); - IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, - mockRepository); - mockRepository.ReplayAll(); - failureMechanism.AddSection(new FailureMechanismSection("test section", new[] { new Point2D(0, 0), new Point2D(1, 1) })); + var mockRepository = new MockRepository(); + IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, + mockRepository); + mockRepository.ReplayAll(); + var calculation = new TestHeightStructuresCalculation { InputParameters = @@ -946,6 +944,7 @@ Assert.IsTrue(exceptionThrown); Assert.AreEqual(calculator.LastErrorFileContent, exceptionMessage); } + mockRepository.VerifyAll(); } #region Testcases Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Service.Test/StabilityPointStructuresCalculationServiceTest.cs =================================================================== diff -u -r80e51fdd446be6524d4f3bcc4175e8d3ae9c86ff -r2ba2957ae849bb05a45cf13f81a8f6464184caef --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Service.Test/StabilityPointStructuresCalculationServiceTest.cs (.../StabilityPointStructuresCalculationServiceTest.cs) (revision 80e51fdd446be6524d4f3bcc4175e8d3ae9c86ff) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Service.Test/StabilityPointStructuresCalculationServiceTest.cs (.../StabilityPointStructuresCalculationServiceTest.cs) (revision 2ba2957ae849bb05a45cf13f81a8f6464184caef) @@ -161,18 +161,17 @@ { // Setup var failureMechanism = new StabilityPointStructuresFailureMechanism(); - - var mockRepository = new MockRepository(); - IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mockRepository); - assessmentSectionStub.HydraulicBoundaryDatabase.FilePath = validFilePath; - mockRepository.ReplayAll(); - failureMechanism.AddSection(new FailureMechanismSection("test section", new[] { new Point2D(0, 0), new Point2D(1, 1) })); + var mockRepository = new MockRepository(); + IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mockRepository); + assessmentSectionStub.HydraulicBoundaryDatabase.FilePath = validFilePath; + mockRepository.ReplayAll(); + const string name = ""; var calculation = new TestStabilityPointStructuresCalculation { @@ -213,18 +212,17 @@ { // Setup var failureMechanism = new StabilityPointStructuresFailureMechanism(); - - var mockRepository = new MockRepository(); - IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mockRepository); - assessmentSectionStub.HydraulicBoundaryDatabase.FilePath = validFilePath; - mockRepository.ReplayAll(); - failureMechanism.AddSection(new FailureMechanismSection("test section", new[] { new Point2D(0, 0), new Point2D(1, 1) })); + var mockRepository = new MockRepository(); + IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mockRepository); + assessmentSectionStub.HydraulicBoundaryDatabase.FilePath = validFilePath; + mockRepository.ReplayAll(); + const string name = ""; var calculation = new TestStabilityPointStructuresCalculation { @@ -603,18 +601,17 @@ { // Setup var failureMechanism = new StabilityPointStructuresFailureMechanism(); - - var mockRepository = new MockRepository(); - IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mockRepository); - assessmentSectionStub.HydraulicBoundaryDatabase.FilePath = validFilePath; - mockRepository.ReplayAll(); - failureMechanism.AddSection(new FailureMechanismSection("test section", new[] { new Point2D(0, 0), new Point2D(1, 1) })); + var mockRepository = new MockRepository(); + IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mockRepository); + assessmentSectionStub.HydraulicBoundaryDatabase.FilePath = validFilePath; + mockRepository.ReplayAll(); + const string name = ""; var calculation = new TestStabilityPointStructuresCalculation { @@ -643,18 +640,17 @@ { // Setup var failureMechanism = new StabilityPointStructuresFailureMechanism(); - - var mockRepository = new MockRepository(); - IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mockRepository); - assessmentSectionStub.HydraulicBoundaryDatabase.FilePath = validFilePath; - mockRepository.ReplayAll(); - failureMechanism.AddSection(new FailureMechanismSection("test section", new[] { new Point2D(0, 0), new Point2D(1, 1) })); + var mockRepository = new MockRepository(); + IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mockRepository); + assessmentSectionStub.HydraulicBoundaryDatabase.FilePath = validFilePath; + mockRepository.ReplayAll(); + const string name = ""; var calculation = new TestStabilityPointStructuresCalculation { @@ -687,18 +683,17 @@ public void Calculate_InvalidInFlowModelType_ThrowsInvalidEnumArgumentException() { // Setup - var stabilityPointStructuresFailureMechanism = new StabilityPointStructuresFailureMechanism(); - - var mockRepository = new MockRepository(); - var assessmentSectionStub = mockRepository.Stub(); - mockRepository.ReplayAll(); - - stabilityPointStructuresFailureMechanism.AddSection(new FailureMechanismSection("test section", new[] + var failureMechanism = new StabilityPointStructuresFailureMechanism(); + failureMechanism.AddSection(new FailureMechanismSection("test section", new[] { new Point2D(0, 0), new Point2D(1, 1) })); + var mockRepository = new MockRepository(); + var assessmentSectionStub = mockRepository.Stub(); + mockRepository.ReplayAll(); + var calculation = new TestStabilityPointStructuresCalculation { InputParameters = @@ -717,7 +712,7 @@ // Call TestDelegate call = () => service.Calculate(calculation, assessmentSectionStub, - stabilityPointStructuresFailureMechanism, + failureMechanism, testDataPath); StructuresStabilityPointCalculationInput[] calculationInputs = calculator.ReceivedInputs.ToArray(); @@ -738,18 +733,17 @@ public void Calculate_InvalidLoadSchematizationType_ThrowsInvalidEnumArgumentException(StabilityPointStructureInflowModelType inflowModelType) { // Setup - var stabilityPointStructuresFailureMechanism = new StabilityPointStructuresFailureMechanism(); - - var mockRepository = new MockRepository(); - var assessmentSectionStub = mockRepository.Stub(); - mockRepository.ReplayAll(); - - stabilityPointStructuresFailureMechanism.AddSection(new FailureMechanismSection("test section", new[] + var failureMechanism = new StabilityPointStructuresFailureMechanism(); + failureMechanism.AddSection(new FailureMechanismSection("test section", new[] { new Point2D(0, 0), new Point2D(1, 1) })); + var mockRepository = new MockRepository(); + var assessmentSectionStub = mockRepository.Stub(); + mockRepository.ReplayAll(); + var calculation = new TestStabilityPointStructuresCalculation { InputParameters = @@ -768,7 +762,7 @@ // Call TestDelegate call = () => service.Calculate(calculation, assessmentSectionStub, - stabilityPointStructuresFailureMechanism, + failureMechanism, testDataPath); StructuresStabilityPointCalculationInput[] calculationInputs = calculator.ReceivedInputs.ToArray(); @@ -790,18 +784,17 @@ public void Calculate_VariousLowSillLinearCalculations_InputPropertiesCorrectlySentToCalculator(bool useForeshore, bool useBreakWater) { // Setup - var stabilityPointStructuresFailureMechanism = new StabilityPointStructuresFailureMechanism(); - - var mockRepository = new MockRepository(); - IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(stabilityPointStructuresFailureMechanism, mockRepository); - mockRepository.ReplayAll(); - - stabilityPointStructuresFailureMechanism.AddSection(new FailureMechanismSection("test section", new[] + var failureMechanism = new StabilityPointStructuresFailureMechanism(); + failureMechanism.AddSection(new FailureMechanismSection("test section", new[] { new Point2D(0, 0), new Point2D(1, 1) })); + var mockRepository = new MockRepository(); + IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mockRepository); + mockRepository.ReplayAll(); + var calculation = new TestStabilityPointStructuresCalculation { InputParameters = @@ -817,7 +810,7 @@ calculation.InputParameters.ForeshoreProfile = new TestForeshoreProfile(useBreakWater); } - FailureMechanismSection failureMechanismSection = stabilityPointStructuresFailureMechanism.Sections.First(); + FailureMechanismSection failureMechanismSection = failureMechanism.Sections.First(); using (new HydraRingCalculatorFactoryConfig()) { @@ -826,7 +819,7 @@ // Call new StabilityPointStructuresCalculationService().Calculate(calculation, assessmentSectionStub, - stabilityPointStructuresFailureMechanism, + failureMechanism, validFilePath); // Assert @@ -835,7 +828,7 @@ Assert.AreEqual(testDataPath, calculator.HydraulicBoundaryDatabaseDirectory); Assert.AreEqual(assessmentSectionStub.Id, calculator.RingId); - GeneralStabilityPointStructuresInput generalInput = stabilityPointStructuresFailureMechanism.GeneralInput; + GeneralStabilityPointStructuresInput generalInput = failureMechanism.GeneralInput; StabilityPointStructuresInput input = calculation.InputParameters; var expectedInput = new StructuresStabilityPointLowSillLinearCalculationInput( 1300001, @@ -916,18 +909,17 @@ public void Calculate_VariousLowSillQuadraticCalculations_InputPropertiesCorrectlySentToCalculator(bool useForeshore, bool useBreakWater) { // Setup - var stabilityPointStructuresFailureMechanism = new StabilityPointStructuresFailureMechanism(); - - var mockRepository = new MockRepository(); - IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(stabilityPointStructuresFailureMechanism, mockRepository); - mockRepository.ReplayAll(); - - stabilityPointStructuresFailureMechanism.AddSection(new FailureMechanismSection("test section", new[] + var failureMechanism = new StabilityPointStructuresFailureMechanism(); + failureMechanism.AddSection(new FailureMechanismSection("test section", new[] { new Point2D(0, 0), new Point2D(1, 1) })); + var mockRepository = new MockRepository(); + IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mockRepository); + mockRepository.ReplayAll(); + var calculation = new TestStabilityPointStructuresCalculation { InputParameters = @@ -943,7 +935,7 @@ calculation.InputParameters.ForeshoreProfile = new TestForeshoreProfile(useBreakWater); } - FailureMechanismSection failureMechanismSection = stabilityPointStructuresFailureMechanism.Sections.First(); + FailureMechanismSection failureMechanismSection = failureMechanism.Sections.First(); using (new HydraRingCalculatorFactoryConfig()) { @@ -952,7 +944,7 @@ // Call new StabilityPointStructuresCalculationService().Calculate(calculation, assessmentSectionStub, - stabilityPointStructuresFailureMechanism, + failureMechanism, validFilePath); // Assert @@ -961,7 +953,7 @@ Assert.AreEqual(testDataPath, calculator.HydraulicBoundaryDatabaseDirectory); Assert.AreEqual(assessmentSectionStub.Id, calculator.RingId); - GeneralStabilityPointStructuresInput generalInput = stabilityPointStructuresFailureMechanism.GeneralInput; + GeneralStabilityPointStructuresInput generalInput = failureMechanism.GeneralInput; StabilityPointStructuresInput input = calculation.InputParameters; var expectedInput = new StructuresStabilityPointLowSillQuadraticCalculationInput( 1300001, @@ -1042,18 +1034,17 @@ public void Calculate_VariousFloodedCulvertLinearCalculations_InputPropertiesCorrectlySentToCalculator(bool useForeshore, bool useBreakWater) { // Setup - var stabilityPointStructuresFailureMechanism = new StabilityPointStructuresFailureMechanism(); - - var mockRepository = new MockRepository(); - IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(stabilityPointStructuresFailureMechanism, mockRepository); - mockRepository.ReplayAll(); - - stabilityPointStructuresFailureMechanism.AddSection(new FailureMechanismSection("test section", new[] + var failureMechanism = new StabilityPointStructuresFailureMechanism(); + failureMechanism.AddSection(new FailureMechanismSection("test section", new[] { new Point2D(0, 0), new Point2D(1, 1) })); + var mockRepository = new MockRepository(); + IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mockRepository); + mockRepository.ReplayAll(); + var calculation = new TestStabilityPointStructuresCalculation { InputParameters = @@ -1069,7 +1060,7 @@ calculation.InputParameters.ForeshoreProfile = new TestForeshoreProfile(useBreakWater); } - FailureMechanismSection failureMechanismSection = stabilityPointStructuresFailureMechanism.Sections.First(); + FailureMechanismSection failureMechanismSection = failureMechanism.Sections.First(); using (new HydraRingCalculatorFactoryConfig()) { @@ -1078,7 +1069,7 @@ // Call new StabilityPointStructuresCalculationService().Calculate(calculation, assessmentSectionStub, - stabilityPointStructuresFailureMechanism, + failureMechanism, validFilePath); // Assert @@ -1087,7 +1078,7 @@ Assert.AreEqual(testDataPath, calculator.HydraulicBoundaryDatabaseDirectory); Assert.AreEqual(assessmentSectionStub.Id, calculator.RingId); - GeneralStabilityPointStructuresInput generalInput = stabilityPointStructuresFailureMechanism.GeneralInput; + GeneralStabilityPointStructuresInput generalInput = failureMechanism.GeneralInput; StabilityPointStructuresInput input = calculation.InputParameters; var expectedInput = new StructuresStabilityPointFloodedCulvertLinearCalculationInput( 1300001, @@ -1168,18 +1159,17 @@ public void Calculate_VariousFloodedCulvertQuadraticCalculations_InputPropertiesCorrectlySentToCalculator(bool useForeshore, bool useBreakWater) { // Setup - var stabilityPointStructuresFailureMechanism = new StabilityPointStructuresFailureMechanism(); - - var mockRepository = new MockRepository(); - IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(stabilityPointStructuresFailureMechanism, mockRepository); - mockRepository.ReplayAll(); - - stabilityPointStructuresFailureMechanism.AddSection(new FailureMechanismSection("test section", new[] + var failureMechanism = new StabilityPointStructuresFailureMechanism(); + failureMechanism.AddSection(new FailureMechanismSection("test section", new[] { new Point2D(0, 0), new Point2D(1, 1) })); + var mockRepository = new MockRepository(); + IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mockRepository); + mockRepository.ReplayAll(); + var calculation = new TestStabilityPointStructuresCalculation { InputParameters = @@ -1195,7 +1185,7 @@ calculation.InputParameters.ForeshoreProfile = new TestForeshoreProfile(useBreakWater); } - FailureMechanismSection failureMechanismSection = stabilityPointStructuresFailureMechanism.Sections.First(); + FailureMechanismSection failureMechanismSection = failureMechanism.Sections.First(); using (new HydraRingCalculatorFactoryConfig()) { @@ -1204,7 +1194,7 @@ // Call new StabilityPointStructuresCalculationService().Calculate(calculation, assessmentSectionStub, - stabilityPointStructuresFailureMechanism, + failureMechanism, validFilePath); // Assert @@ -1213,7 +1203,7 @@ Assert.AreEqual(testDataPath, calculator.HydraulicBoundaryDatabaseDirectory); Assert.AreEqual(assessmentSectionStub.Id, calculator.RingId); - GeneralStabilityPointStructuresInput generalInput = stabilityPointStructuresFailureMechanism.GeneralInput; + GeneralStabilityPointStructuresInput generalInput = failureMechanism.GeneralInput; StabilityPointStructuresInput input = calculation.InputParameters; var expectedInput = new StructuresStabilityPointFloodedCulvertQuadraticCalculationInput( 1300001, @@ -1296,17 +1286,16 @@ { // Setup var failureMechanism = new StabilityPointStructuresFailureMechanism(); - - var mockRepository = new MockRepository(); - IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mockRepository); - mockRepository.ReplayAll(); - failureMechanism.AddSection(new FailureMechanismSection("test section", new[] { new Point2D(0, 0), new Point2D(1, 1) })); + var mockRepository = new MockRepository(); + IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mockRepository); + mockRepository.ReplayAll(); + var calculation = new TestStabilityPointStructuresCalculation { InputParameters = @@ -1363,17 +1352,16 @@ { // Setup var failureMechanism = new StabilityPointStructuresFailureMechanism(); - - var mockRepository = new MockRepository(); - IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mockRepository); - mockRepository.ReplayAll(); - failureMechanism.AddSection(new FailureMechanismSection("test section", new[] { new Point2D(0, 0), new Point2D(1, 1) })); + var mockRepository = new MockRepository(); + IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mockRepository); + mockRepository.ReplayAll(); + var calculation = new TestStabilityPointStructuresCalculation { InputParameters = @@ -1400,25 +1388,25 @@ Assert.IsNull(calculation.Output); Assert.IsTrue(calculator.IsCanceled); } + mockRepository.VerifyAll(); } [Test] public void Calculate_CalculationFailedWithExceptionAndLastErrorPresent_LogErrorAndThrowException() { // Setup var failureMechanism = new StabilityPointStructuresFailureMechanism(); - - var mockRepository = new MockRepository(); - IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, - mockRepository); - mockRepository.ReplayAll(); - failureMechanism.AddSection(new FailureMechanismSection("test section", new[] { new Point2D(0, 0), new Point2D(1, 1) })); + var mockRepository = new MockRepository(); + IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, + mockRepository); + mockRepository.ReplayAll(); + var calculation = new TestStabilityPointStructuresCalculation { InputParameters = @@ -1462,26 +1450,27 @@ StringAssert.StartsWith(string.Format("Berekening van '{0}' beëindigd om: ", calculation.Name), msgs[3]); }); Assert.IsTrue(exceptionThrown); + Assert.IsNull(calculation.Output); } + mockRepository.VerifyAll(); } [Test] public void Calculate_CalculationFailedWithExceptionAndNoLastErrorPresent_LogErrorAndThrowException() { // Setup var failureMechanism = new StabilityPointStructuresFailureMechanism(); - - var mockRepository = new MockRepository(); - IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, - mockRepository); - mockRepository.ReplayAll(); - failureMechanism.AddSection(new FailureMechanismSection("test section", new[] { new Point2D(0, 0), new Point2D(1, 1) })); + var mockRepository = new MockRepository(); + IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, + mockRepository); + mockRepository.ReplayAll(); + var calculation = new TestStabilityPointStructuresCalculation { InputParameters = @@ -1524,26 +1513,27 @@ StringAssert.StartsWith(string.Format("Berekening van '{0}' beëindigd om: ", calculation.Name), msgs[3]); }); Assert.IsTrue(exceptionThrown); + Assert.IsNull(calculation.Output); } + mockRepository.VerifyAll(); } [Test] public void Calculate_CalculationFailedWithoutExceptionAndWithLastErrorPresent_LogErrorAndThrowException() { // Setup var failureMechanism = new StabilityPointStructuresFailureMechanism(); - - var mockRepository = new MockRepository(); - IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, - mockRepository); - mockRepository.ReplayAll(); - failureMechanism.AddSection(new FailureMechanismSection("test section", new[] { new Point2D(0, 0), new Point2D(1, 1) })); + var mockRepository = new MockRepository(); + IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, + mockRepository); + mockRepository.ReplayAll(); + var calculation = new TestStabilityPointStructuresCalculation { InputParameters = @@ -1592,6 +1582,7 @@ Assert.IsTrue(exceptionThrown); Assert.AreEqual(calculator.LastErrorFileContent, exceptionMessage); } + mockRepository.VerifyAll(); } /// Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Service.Test/StabilityStoneCoverWaveConditionsCalculationServiceTest.cs =================================================================== diff -u -r80e51fdd446be6524d4f3bcc4175e8d3ae9c86ff -r2ba2957ae849bb05a45cf13f81a8f6464184caef --- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Service.Test/StabilityStoneCoverWaveConditionsCalculationServiceTest.cs (.../StabilityStoneCoverWaveConditionsCalculationServiceTest.cs) (revision 80e51fdd446be6524d4f3bcc4175e8d3ae9c86ff) +++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Service.Test/StabilityStoneCoverWaveConditionsCalculationServiceTest.cs (.../StabilityStoneCoverWaveConditionsCalculationServiceTest.cs) (revision 2ba2957ae849bb05a45cf13f81a8f6464184caef) @@ -631,8 +631,9 @@ StringAssert.StartsWith(string.Format("Berekening van '{0}' beëindigd om: ", calculation.Name), msgs[6]); }); Assert.IsTrue(exception); - mockRepository.VerifyAll(); + Assert.IsNull(calculation.Output); } + mockRepository.VerifyAll(); } [Test] @@ -694,8 +695,9 @@ StringAssert.StartsWith(string.Format("Berekening van '{0}' beëindigd om: ", calculation.Name), msgs[6]); }); Assert.IsTrue(exception); - mockRepository.VerifyAll(); + Assert.IsNull(calculation.Output); } + mockRepository.VerifyAll(); } [Test] @@ -761,8 +763,9 @@ }); Assert.IsTrue(exception); Assert.AreEqual(calculator.LastErrorFileContent, exceptionMessage); - mockRepository.VerifyAll(); + Assert.IsNull(calculation.Output); } + mockRepository.VerifyAll(); } [Test] Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Service.Test/WaveImpactAsphaltCoverWaveConditionsCalculationServiceTest.cs =================================================================== diff -u -r80e51fdd446be6524d4f3bcc4175e8d3ae9c86ff -r2ba2957ae849bb05a45cf13f81a8f6464184caef --- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Service.Test/WaveImpactAsphaltCoverWaveConditionsCalculationServiceTest.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculationServiceTest.cs) (revision 80e51fdd446be6524d4f3bcc4175e8d3ae9c86ff) +++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Service.Test/WaveImpactAsphaltCoverWaveConditionsCalculationServiceTest.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculationServiceTest.cs) (revision 2ba2957ae849bb05a45cf13f81a8f6464184caef) @@ -310,6 +310,7 @@ StringAssert.StartsWith(string.Format("Berekening van '{0}' beëindigd om: ", calculation.Name), msgs[7]); }); } + mockRepository.VerifyAll(); } [Test] @@ -371,6 +372,7 @@ StringAssert.StartsWith(string.Format("Berekening van '{0}' beëindigd om: ", calculation.Name), msgs[7]); }); } + mockRepository.VerifyAll(); } [Test] @@ -422,6 +424,7 @@ HydraRingDataEqualityHelper.AreEqual(expectedInput, actualInput); } } + mockRepository.VerifyAll(); } [Test] @@ -508,6 +511,7 @@ Assert.IsNotNull(calculation.Output); Assert.AreEqual(3, calculation.Output.Items.Count()); } + mockRepository.VerifyAll(); } [Test] @@ -568,8 +572,9 @@ StringAssert.StartsWith(string.Format("Berekening van '{0}' beëindigd om: ", calculation.Name), msgs[5]); }); Assert.IsTrue(exception); - mockRepository.VerifyAll(); + Assert.IsNull(calculation.Output); } + mockRepository.VerifyAll(); } [Test] @@ -630,8 +635,9 @@ StringAssert.StartsWith(string.Format("Berekening van '{0}' beëindigd om: ", calculation.Name), msgs[5]); }); Assert.IsTrue(exception); - mockRepository.VerifyAll(); + Assert.IsNull(calculation.Output); } + mockRepository.VerifyAll(); } [Test] @@ -696,8 +702,9 @@ }); Assert.IsTrue(exception); Assert.AreEqual(calculator.LastErrorFileContent, exceptionMessage); - mockRepository.VerifyAll(); + Assert.IsNull(calculation.Output); } + mockRepository.VerifyAll(); } [Test]