Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/DesignWaterLevelCalculationServiceTest.cs =================================================================== diff -u -r3ed8e00da47ef2780e79688a9902e12b674e4cc0 -r736f04ea6f24399148ab8efd7f3b03ae8f8f56b5 --- Ringtoets/Common/test/Ringtoets.Common.Service.Test/DesignWaterLevelCalculationServiceTest.cs (.../DesignWaterLevelCalculationServiceTest.cs) (revision 3ed8e00da47ef2780e79688a9902e12b674e4cc0) +++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/DesignWaterLevelCalculationServiceTest.cs (.../DesignWaterLevelCalculationServiceTest.cs) (revision 736f04ea6f24399148ab8efd7f3b03ae8f8f56b5) @@ -154,11 +154,11 @@ const string calculationNotConvergedMessage = "calculationNotConvergedMessage"; const double norm = 1.0 / 30; - var testDesignWaterLevelCalculator = new TestDesignWaterLevelCalculator(); + var calculator = new TestDesignWaterLevelCalculator(); var mockRepository = new MockRepository(); - var calculatorFactory = mockRepository.Stub(); - calculatorFactory.Expect(cf => cf.CreateDesignWaterLevelCalculator(testDataPath)).Return(testDesignWaterLevelCalculator); + var calculatorFactory = mockRepository.StrictMock(); + calculatorFactory.Expect(cf => cf.CreateDesignWaterLevelCalculator(testDataPath)).Return(calculator); var calculationMessageProviderStub = mockRepository.Stub(); calculationMessageProviderStub.Stub(calc => calc.GetCalculationName(locationName)).Return(calculationName); calculationMessageProviderStub.Stub(calc => calc.GetCalculatedNotConvergedMessage(locationName)).Return(calculationNotConvergedMessage); @@ -176,8 +176,8 @@ // Assert AssessmentLevelCalculationInput expectedInput = CreateInput(hydraulicBoundaryLocation, norm); - AssertInput(expectedInput, testDesignWaterLevelCalculator.ReceivedInputs.First()); - Assert.IsFalse(testDesignWaterLevelCalculator.IsCanceled); + AssertInput(expectedInput, calculator.ReceivedInputs.First()); + Assert.IsFalse(calculator.IsCanceled); } mockRepository.VerifyAll(); } @@ -188,11 +188,11 @@ // Setup string validFilePath = Path.Combine(testDataPath, validFile); - var testDesignWaterLevelCalculator = new TestDesignWaterLevelCalculator(); + var calculator = new TestDesignWaterLevelCalculator(); var mockRepository = new MockRepository(); - var calculatorFactory = mockRepository.Stub(); - calculatorFactory.Expect(cf => cf.CreateDesignWaterLevelCalculator(testDataPath)).Return(testDesignWaterLevelCalculator); + var calculatorFactory = mockRepository.StrictMock(); + calculatorFactory.Expect(cf => cf.CreateDesignWaterLevelCalculator(testDataPath)).Return(calculator); var calculationMessageProviderStub = mockRepository.Stub(); mockRepository.ReplayAll(); @@ -203,7 +203,7 @@ using (new HydraRingCalculatorFactoryConfig(calculatorFactory)) { var service = new DesignWaterLevelCalculationService(); - testDesignWaterLevelCalculator.CalculationFinishedHandler += (s, e) => service.Cancel(); + calculator.CalculationFinishedHandler += (s, e) => service.Cancel(); // Call service.Calculate(hydraulicBoundaryLocation, @@ -212,7 +212,7 @@ calculationMessageProviderStub); // Assert - Assert.IsTrue(testDesignWaterLevelCalculator.IsCanceled); + Assert.IsTrue(calculator.IsCanceled); } mockRepository.VerifyAll(); } @@ -228,15 +228,15 @@ const string calculationFailedMessage = "calculationFailedMessage"; const double norm = 1.0 / 30; - var testDesignWaterLevelCalculator = new TestDesignWaterLevelCalculator + var calculator = new TestDesignWaterLevelCalculator { LastErrorFileContent = "An error occurred", EndInFailure = true }; var mockRepository = new MockRepository(); - var calculatorFactory = mockRepository.Stub(); - calculatorFactory.Expect(cf => cf.CreateDesignWaterLevelCalculator(testDataPath)).Return(testDesignWaterLevelCalculator); + var calculatorFactory = mockRepository.StrictMock(); + calculatorFactory.Expect(cf => cf.CreateDesignWaterLevelCalculator(testDataPath)).Return(calculator); var calculationMessageProviderMock = mockRepository.StrictMock(); calculationMessageProviderMock.Stub(calc => calc.GetCalculationName(locationName)).Return(calculationName); calculationMessageProviderMock.Stub(calc => calc.GetCalculationFailedMessage(null, null)).IgnoreArguments().Return(calculationFailedMessage); @@ -291,14 +291,14 @@ const string calculationFailedMessage = "calculationFailedUnexplainedMessage"; const double norm = 1.0 / 30; - var testDesignWaterLevelCalculator = new TestDesignWaterLevelCalculator + var calculator = new TestDesignWaterLevelCalculator { EndInFailure = true }; var mockRepository = new MockRepository(); - var calculatorFactory = mockRepository.Stub(); - calculatorFactory.Expect(cf => cf.CreateDesignWaterLevelCalculator(testDataPath)).Return(testDesignWaterLevelCalculator); + var calculatorFactory = mockRepository.StrictMock(); + calculatorFactory.Expect(cf => cf.CreateDesignWaterLevelCalculator(testDataPath)).Return(calculator); var calculationMessageProviderMock = mockRepository.StrictMock(); calculationMessageProviderMock.Stub(calc => calc.GetCalculationName(locationName)).Return(calculationName); calculationMessageProviderMock.Stub(calc => calc.GetCalculationFailedUnexplainedMessage(locationName)).Return(calculationFailedMessage); @@ -353,15 +353,15 @@ const string calculationFailedMessage = "calculationFailedMessage"; const double norm = 1.0 / 30; - var testDesignWaterLevelCalculator = new TestDesignWaterLevelCalculator + var calculator = new TestDesignWaterLevelCalculator { EndInFailure = false, LastErrorFileContent = "An error occurred" }; var mockRepository = new MockRepository(); - var calculatorFactory = mockRepository.Stub(); - calculatorFactory.Expect(cf => cf.CreateDesignWaterLevelCalculator(testDataPath)).Return(testDesignWaterLevelCalculator); + var calculatorFactory = mockRepository.StrictMock(); + calculatorFactory.Expect(cf => cf.CreateDesignWaterLevelCalculator(testDataPath)).Return(calculator); var calculationMessageProviderMock = mockRepository.StrictMock(); calculationMessageProviderMock.Stub(calc => calc.GetCalculationName(locationName)).Return(calculationName); calculationMessageProviderMock.Stub(calc => calc.GetCalculationFailedMessage(null, null)).IgnoreArguments().Return(calculationFailedMessage); @@ -403,7 +403,7 @@ }); Assert.IsTrue(exceptionThrown); Assert.IsNaN(hydraulicBoundaryLocation.DesignWaterLevel); - Assert.AreEqual(testDesignWaterLevelCalculator.LastErrorFileContent, exceptionMessage); + Assert.AreEqual(calculator.LastErrorFileContent, exceptionMessage); } mockRepository.VerifyAll(); }