Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/DesignWaterLevelCalculationServiceTest.cs =================================================================== diff -u -r211ed9d209b72a515105428e9ad08ec6972ad95d -r55e286e8436b5061a9264ec8623b525f3015fe6e --- Ringtoets/Common/test/Ringtoets.Common.Service.Test/DesignWaterLevelCalculationServiceTest.cs (.../DesignWaterLevelCalculationServiceTest.cs) (revision 211ed9d209b72a515105428e9ad08ec6972ad95d) +++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/DesignWaterLevelCalculationServiceTest.cs (.../DesignWaterLevelCalculationServiceTest.cs) (revision 55e286e8436b5061a9264ec8623b525f3015fe6e) @@ -48,15 +48,9 @@ public void Validate_ValidHydraulicBoundaryDatabasePath_ReturnsTrue() { // Setup - const string calculationName = "calculationName"; string validFilePath = Path.Combine(testDataPath, validFile); var valid = false; - var mockRepository = new MockRepository(); - var messageProvider = mockRepository.Stub(); - messageProvider.Stub(mp => mp.GetCalculationName(calculationName)).Return(calculationName); - mockRepository.ReplayAll(); - // Call Action call = () => valid = DesignWaterLevelCalculationService.Validate(validFilePath); @@ -69,22 +63,15 @@ CalculationServiceTestHelper.AssertValidationEndMessage(msgs[1]); }); Assert.IsTrue(valid); - mockRepository.VerifyAll(); } [Test] public void Validate_InvalidHydraulicBoundaryDatabasePath_LogsErrorAndReturnsFalse() { // Setup - const string calculationName = "calculationName"; string notValidFilePath = Path.Combine(testDataPath, "notexisting.sqlite"); var valid = true; - var mockRepository = new MockRepository(); - var messageProvider = mockRepository.Stub(); - messageProvider.Stub(mp => mp.GetCalculationName(calculationName)).Return(calculationName); - mockRepository.ReplayAll(); - // Call Action call = () => valid = DesignWaterLevelCalculationService.Validate(notValidFilePath); @@ -98,22 +85,15 @@ CalculationServiceTestHelper.AssertValidationEndMessage(msgs[2]); }); Assert.IsFalse(valid); - mockRepository.VerifyAll(); } [Test] public void Validate_ValidHydraulicBoundaryDatabaseWithoutSettings_LogsErrorAndReturnsFalse() { // Setup - const string calculationName = "calculationName"; string notValidFilePath = Path.Combine(testDataPath, "HRD nosettings.sqlite"); var valid = false; - var mockRepository = new MockRepository(); - var messageProvider = mockRepository.Stub(); - messageProvider.Stub(mp => mp.GetCalculationName(calculationName)).Return(calculationName); - mockRepository.ReplayAll(); - // Call Action call = () => valid = DesignWaterLevelCalculationService.Validate(notValidFilePath); @@ -127,7 +107,6 @@ CalculationServiceTestHelper.AssertValidationEndMessage(msgs[2]); }); Assert.IsFalse(valid); - mockRepository.VerifyAll(); } [Test] @@ -162,13 +141,12 @@ var calculatorFactory = mockRepository.StrictMock(); calculatorFactory.Expect(cf => cf.CreateDesignWaterLevelCalculator(testDataPath)).Return(calculator); - var calculation = mockRepository.Stub(); + var calculation = mockRepository.Stub(); calculation.Stub(c => c.Name).Return(locationName); calculation.Expect(c => c.Id).Return(id); calculation.Expect(c => c.CalculateIllustrationPoints).Return(false); var calculationMessageProvider = mockRepository.Stub(); - calculationMessageProvider.Stub(calc => calc.GetCalculationName(locationName)).Return(string.Empty); calculationMessageProvider.Stub(calc => calc.GetCalculatedNotConvergedMessage(locationName)).Return(string.Empty); mockRepository.ReplayAll(); @@ -186,9 +164,7 @@ Assert.IsFalse(calculator.IsCanceled); Assert.IsFalse(calculator.CalculatedWithIllustrationPoints); - - HydraulicBoundaryLocationOutput output = calculation.Output; - Assert.IsFalse(output.HasIllustrationPoints); + Assert.IsFalse(calculation.Output.HasIllustrationPoints); } mockRepository.VerifyAll(); } @@ -212,13 +188,12 @@ var calculatorFactory = mockRepository.StrictMock(); calculatorFactory.Expect(cf => cf.CreateDesignWaterLevelCalculator(testDataPath)).Return(calculator); - var calculation = mockRepository.Stub(); + var calculation = mockRepository.Stub(); calculation.Stub(c => c.Name).Return(locationName); calculation.Expect(c => c.Id).Return(100); calculation.Expect(c => c.CalculateIllustrationPoints).Return(true); var calculationMessageProvider = mockRepository.Stub(); - calculationMessageProvider.Stub(calc => calc.GetCalculationName(locationName)).Return(string.Empty); calculationMessageProvider.Stub(calc => calc.GetCalculatedNotConvergedMessage(locationName)).Return(string.Empty); mockRepository.ReplayAll(); @@ -252,13 +227,12 @@ var calculatorFactory = mockRepository.StrictMock(); calculatorFactory.Expect(cf => cf.CreateDesignWaterLevelCalculator(testDataPath)).Return(calculator); - var calculation = mockRepository.Stub(); + var calculation = mockRepository.Stub(); calculation.Stub(c => c.Name).Return(locationName); calculation.Expect(c => c.Id).Return(100); calculation.Expect(c => c.CalculateIllustrationPoints).Return(true); - var calculationMessageProvider = mockRepository.StrictMock(); - calculationMessageProvider.Stub(calc => calc.GetCalculationName(locationName)).Return(string.Empty); + var calculationMessageProvider = mockRepository.Stub(); calculationMessageProvider.Stub(calc => calc.GetCalculatedNotConvergedMessage(locationName)).Return(string.Empty); calculationMessageProvider.Stub(calc => calc.GetCalculationFailedMessage( locationName, "Er konden geen illustratiepunten worden uitgelezen.")) @@ -300,13 +274,12 @@ var calculatorFactory = mockRepository.StrictMock(); calculatorFactory.Expect(cf => cf.CreateDesignWaterLevelCalculator(testDataPath)).Return(calculator); - var calculation = mockRepository.Stub(); + var calculation = mockRepository.Stub(); calculation.Stub(c => c.Name).Return(locationName); calculation.Expect(c => c.Id).Return(id); calculation.Expect(c => c.CalculateIllustrationPoints).Return(true); var calculationMessageProvider = mockRepository.Stub(); - calculationMessageProvider.Stub(calc => calc.GetCalculationName(locationName)).Return(string.Empty); calculationMessageProvider.Stub(calc => calc.GetCalculatedNotConvergedMessage(locationName)).Return(string.Empty); mockRepository.ReplayAll(); @@ -343,7 +316,7 @@ var calculatorFactory = mockRepository.StrictMock(); calculatorFactory.Expect(cf => cf.CreateDesignWaterLevelCalculator(testDataPath)).Return(calculator); - var calculation = mockRepository.Stub(); + var calculation = mockRepository.Stub(); calculation.Stub(c => c.Name).Return("name"); calculation.Expect(c => c.Id).Return(0); calculation.Expect(c => c.CalculateIllustrationPoints).Return(false); @@ -381,7 +354,6 @@ string validFilePath = Path.Combine(testDataPath, validFile); const string locationName = "punt_flw_ 1"; - const string calculationName = "calculationName"; const string calculationFailedMessage = "calculationFailedMessage"; const double norm = 1.0 / 30; @@ -395,13 +367,12 @@ var calculatorFactory = mockRepository.StrictMock(); calculatorFactory.Expect(cf => cf.CreateDesignWaterLevelCalculator(testDataPath)).Return(calculator); - var calculation = mockRepository.Stub(); + var calculation = mockRepository.Stub(); calculation.Stub(c => c.Name).Return(locationName); calculation.Expect(c => c.Id).Return(0); calculation.Expect(c => c.CalculateIllustrationPoints).Return(false); - var calculationMessageProvider = mockRepository.StrictMock(); - calculationMessageProvider.Stub(calc => calc.GetCalculationName(locationName)).Return(calculationName); + var calculationMessageProvider = mockRepository.Stub(); calculationMessageProvider.Expect(calc => calc.GetCalculationFailedMessage(locationName, endInFailure && string.IsNullOrEmpty(lastErrorFileContent) ? calculator.HydraRingCalculationException.Message