Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/GuiServices/HydraulicBoundaryLocationCalculationGuiServiceTest.cs =================================================================== diff -u -r5fca1638d8f9510eebe352a8a9a86551d7ce9e61 -r4c53b613a3442fb69a60cf60840cd87b04c0dc86 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/GuiServices/HydraulicBoundaryLocationCalculationGuiServiceTest.cs (.../HydraulicBoundaryLocationCalculationGuiServiceTest.cs) (revision 5fca1638d8f9510eebe352a8a9a86551d7ce9e61) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/GuiServices/HydraulicBoundaryLocationCalculationGuiServiceTest.cs (.../HydraulicBoundaryLocationCalculationGuiServiceTest.cs) (revision 4c53b613a3442fb69a60cf60840cd87b04c0dc86) @@ -76,13 +76,12 @@ public void CalculateDesignWaterLevels_NullCalculationServiceMessageProvider_ThrowsArgumentNullException() { // Setup - var locations = Enumerable.Empty(); using (var viewParent = new Form()) { var guiService = new HydraulicBoundaryLocationCalculationGuiService(viewParent); // Call - TestDelegate test = () => guiService.CalculateDesignWaterLevels(null, locations, "", 1, null); + TestDelegate test = () => guiService.CalculateDesignWaterLevels(null, Enumerable.Empty(), "", 1, null); // Assert string paramName = Assert.Throws(test).ParamName; @@ -118,19 +117,16 @@ public void CalculateDesignWaterLevels_HydraulicDatabaseDoesNotExist_LogsError() { // Setup - var calculationMessageProviderMock = mockRepository.StrictMock(); mockRepository.ReplayAll(); const string databasePath = "Does not exist"; - var locations = Enumerable.Empty(); - using (var viewParent = new Form()) { var guiService = new HydraulicBoundaryLocationCalculationGuiService(viewParent); // Call - Action call = () => guiService.CalculateDesignWaterLevels(databasePath, locations, "", 1, calculationMessageProviderMock); + Action call = () => guiService.CalculateDesignWaterLevels(databasePath, Enumerable.Empty(), "", 1, calculationMessageProviderMock); // Assert TestHelper.AssertLogMessages(call, messages => @@ -147,22 +143,19 @@ public void CalculateDesignWaterLevels_HydraulicDatabaseDoesNotExist_SuccessfulCalculationFalse() { // Setup - var calculationMessageProviderMock = mockRepository.StrictMock(); mockRepository.ReplayAll(); const string databasePath = "Does not exist"; - var locations = Enumerable.Empty(); - using (var viewParent = new Form()) { var guiService = new HydraulicBoundaryLocationCalculationGuiService(viewParent); // Call - bool succesfulCalculation = guiService.CalculateDesignWaterLevels(databasePath, locations, "", 1, calculationMessageProviderMock); + bool successfulCalculation = guiService.CalculateDesignWaterLevels(databasePath, Enumerable.Empty(), "", 1, calculationMessageProviderMock); // Assert - Assert.IsFalse(succesfulCalculation); + Assert.IsFalse(successfulCalculation); } mockRepository.VerifyAll(); } @@ -181,13 +174,12 @@ // Expect an activity dialog which is automatically closed }; - var locations = Enumerable.Empty(); using (var viewParent = new Form()) { var guiService = new HydraulicBoundaryLocationCalculationGuiService(viewParent); // Call - Action call = () => guiService.CalculateDesignWaterLevels(validDatabasePath, locations, "", 1, calculationMessageProviderMock); + Action call = () => guiService.CalculateDesignWaterLevels(validDatabasePath, Enumerable.Empty(), "", 1, calculationMessageProviderMock); // Assert TestHelper.AssertLogMessagesCount(call, 0); @@ -209,13 +201,12 @@ // Expect an activity dialog which is automatically closed }; - var locations = Enumerable.Empty(); using (var viewParent = new Form()) { var guiService = new HydraulicBoundaryLocationCalculationGuiService(viewParent); // Call - bool successfulCalculation = guiService.CalculateDesignWaterLevels(validDatabasePath, locations, "", 1, calculationMessageProviderMock); + bool successfulCalculation = guiService.CalculateDesignWaterLevels(validDatabasePath, Enumerable.Empty(), "", 1, calculationMessageProviderMock); // Assert Assert.IsTrue(successfulCalculation); @@ -241,16 +232,17 @@ // Expect an activity dialog which is automatically closed }; - var locations = new List - { - new HydraulicBoundaryLocation(1, hydraulicLocationName, 2, 3) - }; using (var viewParent = new Form()) { var guiService = new HydraulicBoundaryLocationCalculationGuiService(viewParent); // Call - Action call = () => guiService.CalculateDesignWaterLevels(validDatabasePath, locations, "", 1, calculationMessageProviderMock); + Action call = () => guiService.CalculateDesignWaterLevels(validDatabasePath, + new List() + { + new HydraulicBoundaryLocation(1, hydraulicLocationName, 2, 3) + }, + "", 1, calculationMessageProviderMock); // Assert TestHelper.AssertLogMessages(call, messages => @@ -285,19 +277,20 @@ // Expect an activity dialog which is automatically closed }; - var locations = new List - { - new HydraulicBoundaryLocation(1, hydraulicLocationName, 2, 3) - }; using (var viewParent = new Form()) { var guiService = new HydraulicBoundaryLocationCalculationGuiService(viewParent); // Call - bool succesfulCalculation = guiService.CalculateDesignWaterLevels(validDatabasePath, locations, "", 1, calculationMessageProviderMock); + bool successfulCalculation = guiService.CalculateDesignWaterLevels(validDatabasePath, + new List + { + new HydraulicBoundaryLocation(1, hydraulicLocationName, 2, 3) + }, + "", 1, calculationMessageProviderMock); // Assert - Assert.IsTrue(succesfulCalculation); + Assert.IsTrue(successfulCalculation); } mockRepository.VerifyAll(); } @@ -306,13 +299,12 @@ public void CalculateWaveHeights_NullCalculationServiceMessageProvider_ThrowsArgumentNullException() { // Setup - var locations = Enumerable.Empty(); using (var viewParent = new Form()) { var guiService = new HydraulicBoundaryLocationCalculationGuiService(viewParent); // Call - TestDelegate test = () => guiService.CalculateWaveHeights(null, locations, "", 1, null); + TestDelegate test = () => guiService.CalculateWaveHeights(null, Enumerable.Empty(), "", 1, null); // Assert string paramName = Assert.Throws(test).ParamName; @@ -352,15 +344,12 @@ mockRepository.ReplayAll(); const string databasePath = "Does not exist"; - - var locations = Enumerable.Empty(); - using (var viewParent = new Form()) { var guiService = new HydraulicBoundaryLocationCalculationGuiService(viewParent); // Call - Action call = () => guiService.CalculateWaveHeights(databasePath, locations, "", 1, calculationMessageProviderMock); + Action call = () => guiService.CalculateWaveHeights(databasePath, Enumerable.Empty(), "", 1, calculationMessageProviderMock); // Assert TestHelper.AssertLogMessages(call, messages => @@ -374,25 +363,22 @@ } [Test] - public void CalculateWaveHeights_HydraulicDatabaseDoesNotExist_SuccesfulCalculationFalse() + public void CalculateWaveHeights_HydraulicDatabaseDoesNotExist_SuccessfulCalculationFalse() { // Setup var calculationMessageProviderMock = mockRepository.StrictMock(); mockRepository.ReplayAll(); const string databasePath = "Does not exist"; - - var locations = Enumerable.Empty(); - using (var viewParent = new Form()) { var guiService = new HydraulicBoundaryLocationCalculationGuiService(viewParent); // Call - bool succesfulCalculation = guiService.CalculateWaveHeights(databasePath, locations, "", 1, calculationMessageProviderMock); + bool successfulCalculation = guiService.CalculateWaveHeights(databasePath, Enumerable.Empty(), "", 1, calculationMessageProviderMock); // Assert - Assert.IsFalse(succesfulCalculation); + Assert.IsFalse(successfulCalculation); } mockRepository.VerifyAll(); } @@ -411,14 +397,12 @@ // Expect an activity dialog which is automatically closed }; - var locations = Enumerable.Empty(); - using (var viewParent = new Form()) { var guiService = new HydraulicBoundaryLocationCalculationGuiService(viewParent); // Call - Action call = () => guiService.CalculateWaveHeights(validDatabasePath, locations, "", 1, calculationMessageProviderMock); + Action call = () => guiService.CalculateWaveHeights(validDatabasePath, Enumerable.Empty(), "", 1, calculationMessageProviderMock); // Assert TestHelper.AssertLogMessagesCount(call, 0); @@ -427,7 +411,7 @@ } [Test] - public void CalculateWaveHeights_ValidPathEmptyList_SuccesfulCalculationTrue() + public void CalculateWaveHeights_ValidPathEmptyList_SuccessfulCalculationTrue() { // Setup string validDatabasePath = Path.Combine(testDataPath, "HRD dutch coast south.sqlite"); @@ -440,14 +424,12 @@ // Expect an activity dialog which is automatically closed }; - var locations = Enumerable.Empty(); - using (var viewParent = new Form()) { var guiService = new HydraulicBoundaryLocationCalculationGuiService(viewParent); // Call - bool succesfulCalculation = guiService.CalculateWaveHeights(validDatabasePath, locations, "", 1, calculationMessageProviderMock); + bool succesfulCalculation = guiService.CalculateWaveHeights(validDatabasePath, Enumerable.Empty(), "", 1, calculationMessageProviderMock); // Assert Assert.IsTrue(succesfulCalculation); @@ -473,16 +455,17 @@ // Expect an activity dialog which is automatically closed }; - var locations = new List - { - new HydraulicBoundaryLocation(1, hydraulicLocationName, 2, 3) - }; using (var viewParent = new Form()) { var guiService = new HydraulicBoundaryLocationCalculationGuiService(viewParent); // Call - Action call = () => guiService.CalculateWaveHeights(validDatabasePath, locations, "", 1, calculationMessageProviderMock); + Action call = () => guiService.CalculateWaveHeights(validDatabasePath, + new List() + { + new HydraulicBoundaryLocation(1, hydraulicLocationName, 2, 3) + }, + "", 1, calculationMessageProviderMock); // Assert TestHelper.AssertLogMessages(call, messages => @@ -517,16 +500,17 @@ // Expect an activity dialog which is automatically closed }; - var locations = new List - { - new HydraulicBoundaryLocation(1, hydraulicLocationName, 2, 3) - }; using (var viewParent = new Form()) { var guiService = new HydraulicBoundaryLocationCalculationGuiService(viewParent); // Call - bool successfulCalculation = guiService.CalculateWaveHeights(validDatabasePath, locations, "", 1, calculationMessageProviderMock); + bool successfulCalculation = guiService.CalculateWaveHeights(validDatabasePath, + new List + { + new HydraulicBoundaryLocation(1, hydraulicLocationName, 2, 3) + }, + "", 1, calculationMessageProviderMock); // Assert Assert.IsTrue(successfulCalculation);