Index: Ringtoets/Common/src/Ringtoets.Common.Forms/GuiServices/HydraulicBoundaryLocationCalculationGuiService.cs
===================================================================
diff -u -r8aea6e032ff8aeb4a4f1b85210fd0e2fbbce3a4a -r1042a38d3663daeda5a8e1083edbc63a4b6aae94
--- Ringtoets/Common/src/Ringtoets.Common.Forms/GuiServices/HydraulicBoundaryLocationCalculationGuiService.cs (.../HydraulicBoundaryLocationCalculationGuiService.cs) (revision 8aea6e032ff8aeb4a4f1b85210fd0e2fbbce3a4a)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/GuiServices/HydraulicBoundaryLocationCalculationGuiService.cs (.../HydraulicBoundaryLocationCalculationGuiService.cs) (revision 1042a38d3663daeda5a8e1083edbc63a4b6aae94)
@@ -48,7 +48,7 @@
/// Initializes a new instance of the class.
///
/// The parent of the view.
- /// When any of the parameters is null.
+ /// When the input parameter is null.
public HydraulicBoundaryLocationCalculationGuiService(IWin32Window viewParent)
{
if (viewParent == null)
@@ -58,70 +58,60 @@
this.viewParent = viewParent;
}
- public void CalculateDesignWaterLevels(ICalculationMessageProvider messageProvider,
- string hydraulicBoundaryDatabasePath,
- IObservable observable,
- IEnumerable locations,
- string ringId, double norm)
+ public bool CalculateDesignWaterLevels(string hydraulicBoundaryDatabasePath,
+ IEnumerable locations,
+ string ringId, double norm,
+ ICalculationMessageProvider messageProvider)
{
if (messageProvider == null)
{
throw new ArgumentNullException("messageProvider");
}
- if (observable == null)
- {
- throw new ArgumentNullException("observable");
- }
+
if (locations == null)
{
throw new ArgumentNullException("locations");
}
- var activities = locations.Select(hbl => new DesignWaterLevelCalculationActivity(messageProvider, hbl,
+ var activities = locations.Select(location => new DesignWaterLevelCalculationActivity(location,
hydraulicBoundaryDatabasePath,
ringId,
- norm)).ToArray();
- RunActivities(hydraulicBoundaryDatabasePath, activities, observable);
+ norm, messageProvider)).ToArray();
+ return RunActivities(hydraulicBoundaryDatabasePath, activities);
}
- public void CalculateWaveHeights(ICalculationMessageProvider messageProvider,
- string hydraulicBoundaryDatabasePath, IObservable observable,
- IEnumerable locations,
- string ringId, double norm)
+ public bool CalculateWaveHeights(string hydraulicBoundaryDatabasePath,
+ IEnumerable locations,
+ string ringId, double norm,
+ ICalculationMessageProvider messageProvider)
{
if (messageProvider == null)
{
throw new ArgumentNullException("messageProvider");
}
- if (observable == null)
- {
- throw new ArgumentNullException("observable");
- }
+
if (locations == null)
{
throw new ArgumentNullException("locations");
}
- var activities = locations.Select(hbl => new WaveHeightCalculationActivity(messageProvider, hbl,
+ var activities = locations.Select(location => new WaveHeightCalculationActivity(messageProvider, location,
hydraulicBoundaryDatabasePath,
ringId,
norm)).ToArray();
- RunActivities(hydraulicBoundaryDatabasePath, activities, observable);
+ return RunActivities(hydraulicBoundaryDatabasePath, activities);
}
- private void RunActivities(string hydraulicBoundaryDatabasePath,
- IList activities, IObservable observable) where TActivity : Activity
+ private bool RunActivities(string hydraulicBoundaryDatabasePath, IList activities) where TActivity : Activity
{
var validationProblem = HydraulicDatabaseHelper.ValidatePathForCalculation(hydraulicBoundaryDatabasePath);
if (string.IsNullOrEmpty(validationProblem))
{
ActivityProgressDialogRunner.Run(viewParent, activities);
- observable.NotifyObservers();
+ return true;
}
- else
- {
- log.ErrorFormat(Resources.CalculateHydraulicBoundaryLocation_ContextMenuStrip_Start_calculation_failed_0_,
- validationProblem);
- }
+ log.ErrorFormat(Resources.CalculateHydraulicBoundaryLocation_ContextMenuStrip_Start_calculation_failed_0_,
+ validationProblem);
+ return false;
}
}
}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/GuiServices/IHydraulicBoundaryLocationCalculationGuiService.cs
===================================================================
diff -u -r06b2840a2bb64c0960c8ac29322b5a0971c73c77 -r1042a38d3663daeda5a8e1083edbc63a4b6aae94
--- Ringtoets/Common/src/Ringtoets.Common.Forms/GuiServices/IHydraulicBoundaryLocationCalculationGuiService.cs (.../IHydraulicBoundaryLocationCalculationGuiService.cs) (revision 06b2840a2bb64c0960c8ac29322b5a0971c73c77)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/GuiServices/IHydraulicBoundaryLocationCalculationGuiService.cs (.../IHydraulicBoundaryLocationCalculationGuiService.cs) (revision 1042a38d3663daeda5a8e1083edbc63a4b6aae94)
@@ -21,7 +21,6 @@
using System;
using System.Collections.Generic;
-using Core.Common.Base;
using Ringtoets.Common.Service.MessageProviders;
using Ringtoets.HydraRing.Data;
@@ -36,31 +35,29 @@
///
/// Performs the calculation for all .
///
- /// The message provider for the services.
/// The path to the hydraulic boundaries database.
- /// The object to be notified when the calculation was successful.
/// The objects to calculate
- /// the for.
+ /// the for.
/// The id of the ring to perform the calculation for.
/// The norm to use during the calculation.
- /// Thrown when , ,
+ /// The message provider for the services.
+ /// True if the observers should be notified; false if otherwise
+ /// Thrown when
/// or is null.
- void CalculateDesignWaterLevels(ICalculationMessageProvider messageProvider, string hydraulicBoundaryDatabasePath, IObservable observable,
- IEnumerable locations, string ringId, double norm);
+ bool CalculateDesignWaterLevels(string hydraulicBoundaryDatabasePath, IEnumerable locations, string ringId, double norm, ICalculationMessageProvider messageProvider);
///
/// Performs the calculation for all .
///
- /// The message provider for the services.
/// The path to the hydraulic boundaries database.
- /// The object to be notified when the calculation was successful.
/// The objects to calculate
- /// the for.
+ /// the for.
/// The id of the ring to perform the calculation for.
/// The norm to use during the calculation.
- /// Thrown when , ,
+ /// The message provider for the services.
+ /// True if the observers should be notified; false if otherwise
+ /// Thrown when
/// or is null.
- void CalculateWaveHeights(ICalculationMessageProvider messageProvider, string hydraulicBoundaryDatabasePath, IObservable observable,
- IEnumerable locations, string ringId, double norm);
+ bool CalculateWaveHeights(string hydraulicBoundaryDatabasePath, IEnumerable locations, string ringId, double norm, ICalculationMessageProvider messageProvider);
}
}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Service/DesignWaterLevelCalculationActivity.cs
===================================================================
diff -u -r248229db928c9e5556be704ed274226f80b4ef19 -r1042a38d3663daeda5a8e1083edbc63a4b6aae94
--- Ringtoets/Common/src/Ringtoets.Common.Service/DesignWaterLevelCalculationActivity.cs (.../DesignWaterLevelCalculationActivity.cs) (revision 248229db928c9e5556be704ed274226f80b4ef19)
+++ Ringtoets/Common/src/Ringtoets.Common.Service/DesignWaterLevelCalculationActivity.cs (.../DesignWaterLevelCalculationActivity.cs) (revision 1042a38d3663daeda5a8e1083edbc63a4b6aae94)
@@ -46,29 +46,27 @@
///
/// Creates a new instance of .
///
- /// The provider of the messages to use during the calculation.
/// The to perform the calculation for.
/// The HLCD file that should be used for performing the calculation.
/// The id of the ring to perform the calculation for.
/// The norm to use during the calculation.
+ /// The provider of the messages to use during the calculation.
/// Thrown when is null.
- public DesignWaterLevelCalculationActivity(ICalculationMessageProvider messageProvider,
- IHydraulicBoundaryLocation hydraulicBoundaryLocation,
- string hydraulicBoundaryDatabaseFilePath,
- string ringId, double norm)
+ public DesignWaterLevelCalculationActivity(IHydraulicBoundaryLocation hydraulicBoundaryLocation, string hydraulicBoundaryDatabaseFilePath, string ringId, double norm, ICalculationMessageProvider messageProvider)
{
- if (messageProvider == null)
+ if (hydraulicBoundaryLocation == null)
{
- throw new ArgumentNullException("messageProvider");
+ throw new ArgumentNullException("hydraulicBoundaryLocation");
}
- this.messageProvider = messageProvider;
- if (hydraulicBoundaryLocation == null)
+ if (messageProvider == null)
{
- throw new ArgumentNullException("hydraulicBoundaryLocation");
+ throw new ArgumentNullException("messageProvider");
}
+
this.hydraulicBoundaryLocation = hydraulicBoundaryLocation;
-
+ this.messageProvider = messageProvider;
+
this.hydraulicBoundaryDatabaseFilePath = hydraulicBoundaryDatabaseFilePath;
this.ringId = ringId;
this.norm = norm;
@@ -86,7 +84,7 @@
PerformRun(() => DesignWaterLevelCalculationService.Instance.Validate(
messageProvider.GetCalculationName(hydraulicBoundaryLocation.Name), hydraulicBoundaryDatabaseFilePath),
- () => hydraulicBoundaryLocation.DesignWaterLevel = (RoundedDouble) double.NaN,
+ () => RingtoetsCommonDataSynchronizationService.ClearDesignWaterLevel(hydraulicBoundaryLocation),
() => DesignWaterLevelCalculationService.Instance.Calculate(hydraulicBoundaryLocation,
hydraulicBoundaryDatabaseFilePath,
ringId,
Index: Ringtoets/Common/src/Ringtoets.Common.Service/MessageProviders/ICalculationMessageProvider.cs
===================================================================
diff -u -r06b2840a2bb64c0960c8ac29322b5a0971c73c77 -r1042a38d3663daeda5a8e1083edbc63a4b6aae94
--- Ringtoets/Common/src/Ringtoets.Common.Service/MessageProviders/ICalculationMessageProvider.cs (.../ICalculationMessageProvider.cs) (revision 06b2840a2bb64c0960c8ac29322b5a0971c73c77)
+++ Ringtoets/Common/src/Ringtoets.Common.Service/MessageProviders/ICalculationMessageProvider.cs (.../ICalculationMessageProvider.cs) (revision 1042a38d3663daeda5a8e1083edbc63a4b6aae94)
@@ -22,7 +22,7 @@
namespace Ringtoets.Common.Service.MessageProviders
{
///
- /// Interface for messages used during calculations.
+ /// Interface for providing messages during calculations.
///
public interface ICalculationMessageProvider
{
Index: Ringtoets/Common/src/Ringtoets.Common.Service/Ringtoets.Common.Service.csproj
===================================================================
diff -u -r248229db928c9e5556be704ed274226f80b4ef19 -r1042a38d3663daeda5a8e1083edbc63a4b6aae94
--- Ringtoets/Common/src/Ringtoets.Common.Service/Ringtoets.Common.Service.csproj (.../Ringtoets.Common.Service.csproj) (revision 248229db928c9e5556be704ed274226f80b4ef19)
+++ Ringtoets/Common/src/Ringtoets.Common.Service/Ringtoets.Common.Service.csproj (.../Ringtoets.Common.Service.csproj) (revision 1042a38d3663daeda5a8e1083edbc63a4b6aae94)
@@ -61,6 +61,7 @@
True
Resources.resx
+
Index: Ringtoets/Common/src/Ringtoets.Common.Service/RingtoetsCommonDataSynchronizationService.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.Service/RingtoetsCommonDataSynchronizationService.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.Service/RingtoetsCommonDataSynchronizationService.cs (revision 1042a38d3663daeda5a8e1083edbc63a4b6aae94)
@@ -0,0 +1,69 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using Core.Common.Base.Data;
+using Ringtoets.HydraRing.Data;
+
+namespace Ringtoets.Common.Service
+{
+ ///
+ /// Service for synchronizing common data
+ ///
+ public static class RingtoetsCommonDataSynchronizationService
+ {
+ ///
+ /// Clears the output design water level
+ /// of the
+ ///
+ /// The
+ /// to clear the output for
+ /// Thrown when
+ /// is null
+ public static void ClearDesignWaterLevel(IHydraulicBoundaryLocation location)
+ {
+ if (location == null)
+ {
+ throw new ArgumentNullException("location");
+ }
+
+ location.DesignWaterLevel = (RoundedDouble) double.NaN;
+ }
+
+ ///
+ /// Clears the output WaveHeight
+ /// of the
+ ///
+ /// The
+ /// to clear the output for
+ /// Thrown when
+ /// is null
+ public static void ClearWaveHeight(IHydraulicBoundaryLocation location)
+ {
+ if (location == null)
+ {
+ throw new ArgumentNullException("location");
+ }
+
+ location.WaveHeight = (RoundedDouble) double.NaN;
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Service/WaveHeightCalculationActivity.cs
===================================================================
diff -u -ra97c4ffe5254af061462539883d25722be13e539 -r1042a38d3663daeda5a8e1083edbc63a4b6aae94
--- Ringtoets/Common/src/Ringtoets.Common.Service/WaveHeightCalculationActivity.cs (.../WaveHeightCalculationActivity.cs) (revision a97c4ffe5254af061462539883d25722be13e539)
+++ Ringtoets/Common/src/Ringtoets.Common.Service/WaveHeightCalculationActivity.cs (.../WaveHeightCalculationActivity.cs) (revision 1042a38d3663daeda5a8e1083edbc63a4b6aae94)
@@ -55,17 +55,18 @@
public WaveHeightCalculationActivity(ICalculationMessageProvider messageProvider,
IHydraulicBoundaryLocation hydraulicBoundaryLocation, string hydraulicBoundaryDatabaseFilePath, string ringId, double norm)
{
- if (messageProvider == null)
+ if (hydraulicBoundaryLocation == null)
{
- throw new ArgumentNullException("messageProvider");
+ throw new ArgumentNullException("hydraulicBoundaryLocation");
}
- this.messageProvider = messageProvider;
- if (hydraulicBoundaryLocation == null)
+ if (messageProvider == null)
{
- throw new ArgumentNullException("hydraulicBoundaryLocation");
+ throw new ArgumentNullException("messageProvider");
}
+
this.hydraulicBoundaryLocation = hydraulicBoundaryLocation;
+ this.messageProvider = messageProvider;
this.hydraulicBoundaryDatabaseFilePath = hydraulicBoundaryDatabaseFilePath;
this.ringId = ringId;
@@ -85,7 +86,7 @@
PerformRun(() => WaveHeightCalculationService.Instance.Validate(
messageProvider.GetCalculationName(hydraulicBoundaryLocation.Name),
hydraulicBoundaryDatabaseFilePath),
- () => hydraulicBoundaryLocation.WaveHeight = (RoundedDouble) double.NaN,
+ () => RingtoetsCommonDataSynchronizationService.ClearWaveHeight(hydraulicBoundaryLocation),
() => WaveHeightCalculationService.Instance.Calculate(hydraulicBoundaryLocation,
hydraulicBoundaryDatabaseFilePath,
ringId, norm, messageProvider));
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/GuiServices/HydraulicBoundaryLocationCalculationGuiServiceTest.cs
===================================================================
diff -u -r0cd4944265ef5fba4bf385dd9f4eb48380ae8232 -r1042a38d3663daeda5a8e1083edbc63a4b6aae94
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/GuiServices/HydraulicBoundaryLocationCalculationGuiServiceTest.cs (.../HydraulicBoundaryLocationCalculationGuiServiceTest.cs) (revision 0cd4944265ef5fba4bf385dd9f4eb48380ae8232)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/GuiServices/HydraulicBoundaryLocationCalculationGuiServiceTest.cs (.../HydraulicBoundaryLocationCalculationGuiServiceTest.cs) (revision 1042a38d3663daeda5a8e1083edbc63a4b6aae94)
@@ -24,7 +24,6 @@
using System.IO;
using System.Linq;
using System.Windows.Forms;
-using Core.Common.Base;
using Core.Common.TestUtil;
using NUnit.Extensions.Forms;
using NUnit.Framework;
@@ -77,76 +76,78 @@
public void CalculateDesignWaterLevels_NullCalculationServiceMessageProvider_ThrowsArgumentNullException()
{
// Setup
- var observableMock = mockRepository.StrictMock();
- mockRepository.ReplayAll();
-
var locations = Enumerable.Empty();
using (var viewParent = new Form())
{
var guiService = new HydraulicBoundaryLocationCalculationGuiService(viewParent);
// Call
- TestDelegate test = () => guiService.CalculateDesignWaterLevels(null, "", observableMock, locations, "", 1);
+ TestDelegate test = () => guiService.CalculateDesignWaterLevels(null, locations, "", 1, null);
// Assert
string paramName = Assert.Throws(test).ParamName;
const string expectedParamName = "messageProvider";
Assert.AreEqual(expectedParamName, paramName);
}
- mockRepository.VerifyAll();
}
[Test]
- public void CalculateDesignWaterLevels_NullObservable_ThrowsArgumentNullException()
+ public void CalculateDesignWaterLevels_NullLocations_ThrowsArgumentNullException()
{
// Setup
var calculationMessageProviderMock = mockRepository.StrictMock();
mockRepository.ReplayAll();
- var locations = Enumerable.Empty();
+ const string databasePath = "Does not exist";
+
using (var viewParent = new Form())
{
var guiService = new HydraulicBoundaryLocationCalculationGuiService(viewParent);
// Call
- TestDelegate test = () => guiService.CalculateDesignWaterLevels(calculationMessageProviderMock, "", null, locations, "", 1);
+ TestDelegate test = () => guiService.CalculateDesignWaterLevels(databasePath, null, "", 1, calculationMessageProviderMock);
// Assert
string paramName = Assert.Throws(test).ParamName;
- const string expectedParamName = "observable";
+ const string expectedParamName = "locations";
Assert.AreEqual(expectedParamName, paramName);
}
mockRepository.VerifyAll();
}
[Test]
- public void CalculateDesignWaterLevels_NullLocations_ThrowsArgumentNullException()
+ public void CalculateDesignWaterLevels_HydraulicDatabaseDoesNotExist_LogsError()
{
// Setup
- var observableMock = mockRepository.StrictMock();
+
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
- TestDelegate test = () => guiService.CalculateDesignWaterLevels(calculationMessageProviderMock, databasePath, observableMock, null, "", 1);
+ Action call = () => guiService.CalculateDesignWaterLevels(databasePath, locations, "", 1, calculationMessageProviderMock);
// Assert
- string paramName = Assert.Throws(test).ParamName;
- const string expectedParamName = "locations";
- Assert.AreEqual(expectedParamName, paramName);
+ TestHelper.AssertLogMessages(call, messages =>
+ {
+ var msgs = messages.ToArray();
+ Assert.AreEqual(1, msgs.Length);
+ StringAssert.StartsWith("Berekeningen konden niet worden gestart. ", msgs.First());
+ });
}
mockRepository.VerifyAll();
}
[Test]
- public void CalculateDesignWaterLevels_HydraulicDatabaseDoesNotExist_LogsErrorAndDoesNotNotifyObservers()
+ public void CalculateDesignWaterLevels_HydraulicDatabaseDoesNotExist_SuccessfulCalculationFalse()
{
// Setup
- var observableMock = mockRepository.StrictMock();
+
var calculationMessageProviderMock = mockRepository.StrictMock();
mockRepository.ReplayAll();
@@ -158,27 +159,20 @@
var guiService = new HydraulicBoundaryLocationCalculationGuiService(viewParent);
// Call
- Action call = () => guiService.CalculateDesignWaterLevels(calculationMessageProviderMock, databasePath, observableMock, locations, "", 1);
+ bool succesfulCalculation = guiService.CalculateDesignWaterLevels(databasePath, locations, "", 1, calculationMessageProviderMock);
// Assert
- TestHelper.AssertLogMessages(call, messages =>
- {
- var msgs = messages.ToArray();
- Assert.AreEqual(1, msgs.Length);
- StringAssert.StartsWith("Berekeningen konden niet worden gestart. ", msgs.First());
- });
+ Assert.IsFalse(succesfulCalculation);
}
mockRepository.VerifyAll();
}
[Test]
- public void CalculateDesignWaterLevels_ValidPathEmptyList_NotifyObserversButNoLog()
+ public void CalculateDesignWaterLevels_ValidPathEmptyList_NoLog()
{
// Setup
string validDatabasePath = Path.Combine(testDataPath, "HRD dutch coast south.sqlite");
- var observableMock = mockRepository.StrictMock();
- observableMock.NotifyObservers();
var calculationMessageProviderMock = mockRepository.StrictMock();
mockRepository.ReplayAll();
@@ -193,7 +187,7 @@
var guiService = new HydraulicBoundaryLocationCalculationGuiService(viewParent);
// Call
- Action call = () => guiService.CalculateDesignWaterLevels(calculationMessageProviderMock, validDatabasePath, observableMock, locations, "", 1);
+ Action call = () => guiService.CalculateDesignWaterLevels(validDatabasePath, locations, "", 1, calculationMessageProviderMock);
// Assert
TestHelper.AssertLogMessagesCount(call, 0);
@@ -202,15 +196,41 @@
}
[Test]
- public void CalculateDesignWaterLevels_ValidPathOneLocationInTheList_NotifyObserversAndLogsMessages()
+ public void CalculateDesignWaterLevels_ValidPathEmptyList_SuccessfulCalculationTrue()
{
// Setup
+ string validDatabasePath = Path.Combine(testDataPath, "HRD dutch coast south.sqlite");
+
+ var calculationMessageProviderMock = mockRepository.StrictMock();
+ mockRepository.ReplayAll();
+
+ DialogBoxHandler = (name, wnd) =>
+ {
+ // 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);
+
+ // Assert
+ Assert.IsTrue(successfulCalculation);
+ }
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ public void CalculateDesignWaterLevels_ValidPathOneLocationInTheList_LogsMessages()
+ {
+ // Setup
const string hydraulicLocationName = "name";
const string calculationName = "calculationName";
string validDatabasePath = Path.Combine(testDataPath, "HRD dutch coast south.sqlite");
- var observableMock = mockRepository.StrictMock();
- observableMock.Expect(o=>o.NotifyObservers());
var calculationMessageProviderMock = mockRepository.StrictMock();
calculationMessageProviderMock.Expect(calc => calc.GetActivityName(hydraulicLocationName)).Return("GetActivityName");
calculationMessageProviderMock.Expect(calc => calc.GetCalculationName(hydraulicLocationName)).Return(calculationName).Repeat.AtLeastOnce();
@@ -230,7 +250,7 @@
var guiService = new HydraulicBoundaryLocationCalculationGuiService(viewParent);
// Call
- Action call = () => guiService.CalculateDesignWaterLevels(calculationMessageProviderMock, validDatabasePath, observableMock, locations, "", 1);
+ Action call = () => guiService.CalculateDesignWaterLevels(validDatabasePath, locations, "", 1, calculationMessageProviderMock);
// Assert
TestHelper.AssertLogMessages(call, messages =>
@@ -248,57 +268,63 @@
}
[Test]
- public void CalculateWaveHeights_NullCalculationServiceMessageProvider_ThrowsArgumentNullException()
+ public void CalculateDesignWaterLevels_ValidPathOneLocationInTheList_SuccessfulCalculationTrue()
{
// Setup
- var observableMock = mockRepository.StrictMock();
+ const string hydraulicLocationName = "name";
+ const string calculationName = "calculationName";
+ string validDatabasePath = Path.Combine(testDataPath, "HRD dutch coast south.sqlite");
+
+ var calculationMessageProviderMock = mockRepository.StrictMock();
+ calculationMessageProviderMock.Expect(calc => calc.GetActivityName(hydraulicLocationName)).Return("GetActivityName");
+ calculationMessageProviderMock.Expect(calc => calc.GetCalculationName(hydraulicLocationName)).Return(calculationName).Repeat.AtLeastOnce();
mockRepository.ReplayAll();
- var locations = Enumerable.Empty();
+ DialogBoxHandler = (name, wnd) =>
+ {
+ // 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
- TestDelegate test = () => guiService.CalculateWaveHeights(null, "", observableMock, locations, "", 1);
+ bool succesfulCalculation = guiService.CalculateDesignWaterLevels(validDatabasePath, locations, "", 1, calculationMessageProviderMock);
// Assert
- string paramName = Assert.Throws(test).ParamName;
- const string expectedParamName = "messageProvider";
- Assert.AreEqual(expectedParamName, paramName);
+ Assert.IsTrue(succesfulCalculation);
}
mockRepository.VerifyAll();
}
[Test]
- public void CalculateWaveHeights_NullObservable_ThrowsArgumentNullException()
+ public void CalculateWaveHeights_NullCalculationServiceMessageProvider_ThrowsArgumentNullException()
{
// Setup
- var calculationMessageProviderMock = mockRepository.StrictMock();
- mockRepository.ReplayAll();
-
- var locations = Enumerable.Empty();
-
+ var locations = Enumerable.Empty();
using (var viewParent = new Form())
{
var guiService = new HydraulicBoundaryLocationCalculationGuiService(viewParent);
// Call
- TestDelegate test = () => guiService.CalculateWaveHeights(calculationMessageProviderMock, "", null, locations, "", 1);
+ TestDelegate test = () => guiService.CalculateWaveHeights(null, locations, "", 1, null);
// Assert
string paramName = Assert.Throws(test).ParamName;
- const string expectedParamName = "observable";
+ const string expectedParamName = "messageProvider";
Assert.AreEqual(expectedParamName, paramName);
}
- mockRepository.VerifyAll();
}
[Test]
public void CalculateWaveHeights_NullLocations_ThrowsArgumentNullException()
{
// Setup
- var observableMock = mockRepository.StrictMock();
var calculationMessageProviderMock = mockRepository.StrictMock();
mockRepository.ReplayAll();
const string databasePath = "Does not exist";
@@ -308,7 +334,7 @@
var guiService = new HydraulicBoundaryLocationCalculationGuiService(viewParent);
// Call
- TestDelegate test = () => guiService.CalculateWaveHeights(calculationMessageProviderMock, databasePath, observableMock, null, "", 1);
+ TestDelegate test = () => guiService.CalculateWaveHeights(databasePath, null, "", 1, calculationMessageProviderMock);
// Assert
string paramName = Assert.Throws(test).ParamName;
@@ -319,10 +345,9 @@
}
[Test]
- public void CalculateWaveHeights_HydraulicDatabaseDoesNotExist_LogsErrorAndDoesNotNotifyObservers()
+ public void CalculateWaveHeights_HydraulicDatabaseDoesNotExist_LogsError()
{
// Setup
- var observableMock = mockRepository.StrictMock();
var calculationMessageProviderMock = mockRepository.StrictMock();
mockRepository.ReplayAll();
@@ -335,7 +360,7 @@
var guiService = new HydraulicBoundaryLocationCalculationGuiService(viewParent);
// Call
- Action call = () => guiService.CalculateWaveHeights(calculationMessageProviderMock, databasePath, observableMock, locations, "", 1);
+ Action call = () => guiService.CalculateWaveHeights(databasePath, locations, "", 1, calculationMessageProviderMock);
// Assert
TestHelper.AssertLogMessages(call, messages =>
@@ -349,13 +374,35 @@
}
[Test]
- public void CalculateWaveHeights_ValidPathEmptyList_NotifyObserversButNoLog()
+ public void CalculateWaveHeights_HydraulicDatabaseDoesNotExist_SuccesfulCalculationFalse()
{
// 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);
+
+ // Assert
+ Assert.IsFalse(succesfulCalculation);
+ }
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ public void CalculateWaveHeights_ValidPathEmptyList_NoLog()
+ {
+ // Setup
string validDatabasePath = Path.Combine(testDataPath, "HRD dutch coast south.sqlite");
- var observableMock = mockRepository.StrictMock();
- observableMock.Expect(o => o.NotifyObservers());
var calculationMessageProviderMock = mockRepository.StrictMock();
mockRepository.ReplayAll();
@@ -371,7 +418,7 @@
var guiService = new HydraulicBoundaryLocationCalculationGuiService(viewParent);
// Call
- Action call = () => guiService.CalculateWaveHeights(calculationMessageProviderMock, validDatabasePath, observableMock, locations, "", 1);
+ Action call = () => guiService.CalculateWaveHeights(validDatabasePath, locations, "", 1, calculationMessageProviderMock);
// Assert
TestHelper.AssertLogMessagesCount(call, 0);
@@ -380,15 +427,42 @@
}
[Test]
- public void CalculateWaveHeights_ValidPathOneLocationInTheList_NotifyObserversAndLogsMessages()
+ public void CalculateWaveHeights_ValidPathEmptyList_SuccesfulCalculationTrue()
{
// Setup
+ string validDatabasePath = Path.Combine(testDataPath, "HRD dutch coast south.sqlite");
+
+ var calculationMessageProviderMock = mockRepository.StrictMock();
+ mockRepository.ReplayAll();
+
+ DialogBoxHandler = (name, wnd) =>
+ {
+ // 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);
+
+ // Assert
+ Assert.IsTrue(succesfulCalculation);
+ }
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ public void CalculateWaveHeights_ValidPathOneLocationInTheList_LogsMessages()
+ {
+ // Setup
const string hydraulicLocationName = "name";
const string calculationName = "calculationName";
string validDatabasePath = Path.Combine(testDataPath, "HRD dutch coast south.sqlite");
- var observableMock = mockRepository.StrictMock();
- observableMock.Expect(o => o.NotifyObservers());
var calculationMessageProviderMock = mockRepository.StrictMock();
calculationMessageProviderMock.Expect(calc => calc.GetActivityName(hydraulicLocationName)).Return("GetActivityName");
calculationMessageProviderMock.Expect(calc => calc.GetCalculationName(hydraulicLocationName)).Return(calculationName).Repeat.AtLeastOnce();
@@ -408,7 +482,7 @@
var guiService = new HydraulicBoundaryLocationCalculationGuiService(viewParent);
// Call
- Action call = () => guiService.CalculateWaveHeights(calculationMessageProviderMock, validDatabasePath, observableMock, locations, "", 1);
+ Action call = () => guiService.CalculateWaveHeights(validDatabasePath, locations, "", 1, calculationMessageProviderMock);
// Assert
TestHelper.AssertLogMessages(call, messages =>
@@ -424,5 +498,40 @@
}
mockRepository.VerifyAll();
}
+
+ [Test]
+ public void CalculateWaveHeights_ValidPathOneLocationInTheList_SuccessfulCalculationTrue()
+ {
+ // Setup
+ const string hydraulicLocationName = "name";
+ const string calculationName = "calculationName";
+ string validDatabasePath = Path.Combine(testDataPath, "HRD dutch coast south.sqlite");
+
+ var calculationMessageProviderMock = mockRepository.StrictMock();
+ calculationMessageProviderMock.Expect(calc => calc.GetActivityName(hydraulicLocationName)).Return("GetActivityName");
+ calculationMessageProviderMock.Expect(calc => calc.GetCalculationName(hydraulicLocationName)).Return(calculationName).Repeat.AtLeastOnce();
+ mockRepository.ReplayAll();
+
+ DialogBoxHandler = (name, wnd) =>
+ {
+ // 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);
+
+ // Assert
+ Assert.IsTrue(successfulCalculation);
+ }
+ mockRepository.VerifyAll();
+ }
}
}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/DesignWaterLevelCalculationActivityTest.cs
===================================================================
diff -u -r248229db928c9e5556be704ed274226f80b4ef19 -r1042a38d3663daeda5a8e1083edbc63a4b6aae94
--- Ringtoets/Common/test/Ringtoets.Common.Service.Test/DesignWaterLevelCalculationActivityTest.cs (.../DesignWaterLevelCalculationActivityTest.cs) (revision 248229db928c9e5556be704ed274226f80b4ef19)
+++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/DesignWaterLevelCalculationActivityTest.cs (.../DesignWaterLevelCalculationActivityTest.cs) (revision 1042a38d3663daeda5a8e1083edbc63a4b6aae94)
@@ -63,7 +63,9 @@
string validFilePath = Path.Combine(testDataPath, validFile);
// Call
- var activity = new DesignWaterLevelCalculationActivity(calculationMessageProviderMock, hydraulicBoundaryLocationMock, validFilePath, "", 1);
+ var activity = new DesignWaterLevelCalculationActivity(hydraulicBoundaryLocationMock,
+ validFilePath, "", 1,
+ calculationMessageProviderMock);
// Assert
Assert.IsInstanceOf(activity);
@@ -83,7 +85,9 @@
string validFilePath = Path.Combine(testDataPath, validFile);
// Call
- TestDelegate call = () => new DesignWaterLevelCalculationActivity(null, hydraulicBoundaryLocationMock, validFilePath, "", 1);
+ TestDelegate call = () => new DesignWaterLevelCalculationActivity(hydraulicBoundaryLocationMock,
+ validFilePath, "", 1,
+ null);
// Assert
var exception = Assert.Throws(call);
@@ -101,7 +105,8 @@
string validFilePath = Path.Combine(testDataPath, validFile);
// Call
- TestDelegate call = () => new DesignWaterLevelCalculationActivity(calculationMessageProviderMock, null, validFilePath, "", 1);
+ TestDelegate call = () => new DesignWaterLevelCalculationActivity(null,
+ validFilePath, "", 1, calculationMessageProviderMock);
// Assert
var exception = Assert.Throws(call);
@@ -129,8 +134,8 @@
calculationMessageProviderMock.Expect(calc => calc.GetCalculationName(locationName)).Return(calculationName).Repeat.AtLeastOnce();
mockRepository.ReplayAll();
- var activity = new DesignWaterLevelCalculationActivity(calculationMessageProviderMock,
- hydraulicBoundaryLocationMock, inValidFilePath, "", 1);
+ var activity = new DesignWaterLevelCalculationActivity(hydraulicBoundaryLocationMock,
+ inValidFilePath, "", 1, calculationMessageProviderMock);
// Call
Action call = () => activity.Run();
@@ -167,9 +172,8 @@
calculationMessageProviderMock.Expect(calc => calc.GetCalculationName(locationName)).Return(calculationName).Repeat.AtLeastOnce();
mockRepository.ReplayAll();
- var activity = new DesignWaterLevelCalculationActivity(calculationMessageProviderMock,
- hydraulicBoundaryLocationMock,
- validFilePath, ringId, norm);
+ var activity = new DesignWaterLevelCalculationActivity(hydraulicBoundaryLocationMock,
+ validFilePath, ringId, norm, calculationMessageProviderMock);
using (new DesignWaterLevelCalculationServiceConfig())
{
@@ -205,8 +209,9 @@
calculationMessageProviderMock.Expect(calc => calc.GetActivityName(locationName)).Return(activityName);
mockRepository.ReplayAll();
- var activity = new DesignWaterLevelCalculationActivity(calculationMessageProviderMock,
- hydraulicBoundaryLocationMock, validFilePath, "", 30);
+ var activity = new DesignWaterLevelCalculationActivity(hydraulicBoundaryLocationMock,
+ validFilePath, "", 30,
+ calculationMessageProviderMock);
// Call
Action call = () => activity.Run();
@@ -237,8 +242,8 @@
mockRepository.ReplayAll();
string validFilePath = Path.Combine(testDataPath, validFile);
- var activity = new DesignWaterLevelCalculationActivity(calculationMessageProviderMock, hydraulicBoundaryLocationMock,
- validFilePath, "", 30);
+ var activity = new DesignWaterLevelCalculationActivity(hydraulicBoundaryLocationMock,
+ validFilePath, "", 30, calculationMessageProviderMock);
using (new DesignWaterLevelCalculationServiceConfig())
{
@@ -270,8 +275,8 @@
mockRepository.ReplayAll();
string validFilePath = Path.Combine(testDataPath, validFile);
- var activity = new DesignWaterLevelCalculationActivity(calculationMessageProviderMock, hydraulicBoundaryLocationMock,
- validFilePath, "", 30);
+ var activity = new DesignWaterLevelCalculationActivity(hydraulicBoundaryLocationMock,
+ validFilePath, "", 30, calculationMessageProviderMock);
using (new DesignWaterLevelCalculationServiceConfig())
{
@@ -311,8 +316,8 @@
string validFilePath = Path.Combine(testDataPath, validFile);
const int norm = 300;
- var activity = new DesignWaterLevelCalculationActivity(calculationMessageProviderMock, hydraulicBoundaryLocationMock,
- validFilePath, "", norm);
+ var activity = new DesignWaterLevelCalculationActivity(hydraulicBoundaryLocationMock,
+ validFilePath, "", norm, calculationMessageProviderMock);
using (new DesignWaterLevelCalculationServiceConfig())
{
@@ -356,7 +361,9 @@
string validFilePath = Path.Combine(testDataPath, validFile);
- var activity = new DesignWaterLevelCalculationActivity(calculationMessageProviderMock, hydraulicBoundaryLocationMock, validFilePath, "", 30);
+ var activity = new DesignWaterLevelCalculationActivity(hydraulicBoundaryLocationMock,
+ validFilePath, "", 30,
+ calculationMessageProviderMock);
using (new DesignWaterLevelCalculationServiceConfig())
{
Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/Ringtoets.Common.Service.Test.csproj
===================================================================
diff -u -rb13d0991492d2a0a463ad76af5557e10787709d2 -r1042a38d3663daeda5a8e1083edbc63a4b6aae94
--- Ringtoets/Common/test/Ringtoets.Common.Service.Test/Ringtoets.Common.Service.Test.csproj (.../Ringtoets.Common.Service.Test.csproj) (revision b13d0991492d2a0a463ad76af5557e10787709d2)
+++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/Ringtoets.Common.Service.Test.csproj (.../Ringtoets.Common.Service.Test.csproj) (revision 1042a38d3663daeda5a8e1083edbc63a4b6aae94)
@@ -64,6 +64,7 @@
+
Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/RingtoetsCommonDataSynchronizationServices.Test.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.Service.Test/RingtoetsCommonDataSynchronizationServices.Test.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/RingtoetsCommonDataSynchronizationServices.Test.cs (revision 1042a38d3663daeda5a8e1083edbc63a4b6aae94)
@@ -0,0 +1,93 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using Core.Common.Base.Data;
+using NUnit.Framework;
+using Ringtoets.HydraRing.Data;
+
+namespace Ringtoets.Common.Service.Test
+{
+ [TestFixture]
+ public class RingtoetsCommonDataSynchronizationServiceTest
+ {
+ [Test]
+ public void ClearDesignWaterLevel_HydraulicBoundaryLocationNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate test = () => RingtoetsCommonDataSynchronizationService.ClearDesignWaterLevel(null);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("location", exception.ParamName);
+ }
+
+ [Test]
+ public void ClearDesignWaterLevel_WithHydraulicBoundaryLocation_OutputNan()
+ {
+ // Setup
+ var calculation = new HydraulicBoundaryLocation(0, "Location 1", 0.5, 0.5)
+ {
+ DesignWaterLevel = (RoundedDouble) 5.0
+ };
+
+ // Precondition
+ Assert.IsNotNull(calculation.DesignWaterLevel);
+
+ // Call
+ RingtoetsCommonDataSynchronizationService.ClearDesignWaterLevel(calculation);
+
+ // Assert
+ Assert.IsNaN(calculation.DesignWaterLevel);
+ }
+
+ [Test]
+ public void ClearWaveHeight_HydraulicBoundaryLocationNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate test = () => RingtoetsCommonDataSynchronizationService.ClearWaveHeight(null);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("location", exception.ParamName);
+ }
+
+ [Test]
+ public void ClearWaveHeight_WithHydraulicBoundaryLocation_OutputNan()
+ {
+ // Setup
+ var calculation = new HydraulicBoundaryLocation(0, "Location 1", 0.5, 0.5)
+ {
+ WaveHeight = (RoundedDouble)5.0
+ };
+
+
+ // Precondition
+ Assert.IsNotNull(calculation.WaveHeight);
+
+ // Call
+ RingtoetsCommonDataSynchronizationService.ClearWaveHeight(calculation);
+
+ // Assert
+ Assert.IsNaN(calculation.WaveHeight);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs
===================================================================
diff -u -rbb32237c29a9f16a3d7e65c1baf833f5fb0c1988 -r1042a38d3663daeda5a8e1083edbc63a4b6aae94
--- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs (.../GrassCoverErosionOutwardsPlugin.cs) (revision bb32237c29a9f16a3d7e65c1baf833f5fb0c1988)
+++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs (.../GrassCoverErosionOutwardsPlugin.cs) (revision 1042a38d3663daeda5a8e1083edbc63a4b6aae94)
@@ -297,13 +297,14 @@
(failureMechanism.Contribution/100)*
failureMechanism.GeneralInput.N;
- hydraulicBoundaryLocationCalculationGuiService.CalculateDesignWaterLevels(
- new GrassCoverErosionOutwardsDesignWaterLevelCalculationMessageProvider(),
- assessmentSection.HydraulicBoundaryDatabase.FilePath,
- nodeData.WrappedData,
- nodeData.WrappedData,
- assessmentSection.Id,
- correctedNormFactor);
+ bool successfulCalculation = hydraulicBoundaryLocationCalculationGuiService.CalculateDesignWaterLevels(assessmentSection.HydraulicBoundaryDatabase.FilePath,
+ nodeData.WrappedData,
+ assessmentSection.Id,
+ correctedNormFactor, new GrassCoverErosionOutwardsDesignWaterLevelCalculationMessageProvider());
+ if (successfulCalculation)
+ {
+ nodeData.WrappedData.NotifyObservers();
+ }
});
if (nodeData.AssessmentSection.HydraulicBoundaryDatabase == null)
@@ -348,13 +349,15 @@
(failureMechanism.Contribution/100)*
failureMechanism.GeneralInput.N;
- hydraulicBoundaryLocationCalculationGuiService.CalculateWaveHeights(
- new GrassCoverErosionOutwardsWaveHeightCalculationMessageProvider(),
- assessmentSection.HydraulicBoundaryDatabase.FilePath,
- nodeData.WrappedData,
- nodeData.WrappedData,
- assessmentSection.Id,
- correctedNormFactor);
+ bool successfulCalculation = hydraulicBoundaryLocationCalculationGuiService.CalculateWaveHeights(assessmentSection.HydraulicBoundaryDatabase.FilePath,
+ nodeData.WrappedData,
+ assessmentSection.Id,
+ correctedNormFactor, new GrassCoverErosionOutwardsWaveHeightCalculationMessageProvider());
+
+ if (successfulCalculation)
+ {
+ nodeData.WrappedData.NotifyObservers();
+ }
});
if (nodeData.AssessmentSection.HydraulicBoundaryDatabase == null)
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/DesignWaterLevelLocationsView.cs
===================================================================
diff -u -r06b2840a2bb64c0960c8ac29322b5a0971c73c77 -r1042a38d3663daeda5a8e1083edbc63a4b6aae94
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/DesignWaterLevelLocationsView.cs (.../DesignWaterLevelLocationsView.cs) (revision 06b2840a2bb64c0960c8ac29322b5a0971c73c77)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/DesignWaterLevelLocationsView.cs (.../DesignWaterLevelLocationsView.cs) (revision 1042a38d3663daeda5a8e1083edbc63a4b6aae94)
@@ -57,13 +57,10 @@
{
return;
}
- CalculationGuiService.CalculateDesignWaterLevels(
- new DesignWaterLevelCalculationMessageProvider(),
- AssessmentSection.HydraulicBoundaryDatabase.FilePath,
- AssessmentSection.HydraulicBoundaryDatabase,
+ CalculationGuiService.CalculateDesignWaterLevels(AssessmentSection.HydraulicBoundaryDatabase.FilePath,
locations,
AssessmentSection.Id,
- AssessmentSection.FailureMechanismContribution.Norm);
+ AssessmentSection.FailureMechanismContribution.Norm, new DesignWaterLevelCalculationMessageProvider());
}
protected override void InitializeDataGridView()
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WaveHeightLocationsView.cs
===================================================================
diff -u -r06b2840a2bb64c0960c8ac29322b5a0971c73c77 -r1042a38d3663daeda5a8e1083edbc63a4b6aae94
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WaveHeightLocationsView.cs (.../WaveHeightLocationsView.cs) (revision 06b2840a2bb64c0960c8ac29322b5a0971c73c77)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WaveHeightLocationsView.cs (.../WaveHeightLocationsView.cs) (revision 1042a38d3663daeda5a8e1083edbc63a4b6aae94)
@@ -57,13 +57,10 @@
{
return;
}
- CalculationGuiService.CalculateWaveHeights(
- new WaveHeightCalculationMessageProvider(),
- AssessmentSection.HydraulicBoundaryDatabase.FilePath,
- AssessmentSection.HydraulicBoundaryDatabase,
+ CalculationGuiService.CalculateWaveHeights(AssessmentSection.HydraulicBoundaryDatabase.FilePath,
locations,
AssessmentSection.Id,
- AssessmentSection.FailureMechanismContribution.Norm);
+ AssessmentSection.FailureMechanismContribution.Norm, new WaveHeightCalculationMessageProvider());
}
protected override void InitializeDataGridView()
Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs
===================================================================
diff -u -re4313e642aa3af2d1f1ced4c397c421579cfb36d -r1042a38d3663daeda5a8e1083edbc63a4b6aae94
--- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision e4313e642aa3af2d1f1ced4c397c421579cfb36d)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 1042a38d3663daeda5a8e1083edbc63a4b6aae94)
@@ -1125,13 +1125,10 @@
}
IAssessmentSection assessmentSection = nodeData.WrappedData;
- hydraulicBoundaryLocationCalculationGuiService.CalculateDesignWaterLevels(
- new DesignWaterLevelCalculationMessageProvider(),
- assessmentSection.HydraulicBoundaryDatabase.FilePath,
- assessmentSection.HydraulicBoundaryDatabase,
+ hydraulicBoundaryLocationCalculationGuiService.CalculateDesignWaterLevels(assessmentSection.HydraulicBoundaryDatabase.FilePath,
assessmentSection.HydraulicBoundaryDatabase.Locations,
assessmentSection.Id,
- assessmentSection.FailureMechanismContribution.Norm);
+ assessmentSection.FailureMechanismContribution.Norm, new DesignWaterLevelCalculationMessageProvider());
});
if (nodeData.WrappedData.HydraulicBoundaryDatabase == null)
@@ -1162,13 +1159,10 @@
return;
}
IAssessmentSection assessmentSection = nodeData.WrappedData;
- hydraulicBoundaryLocationCalculationGuiService.CalculateWaveHeights(
- new WaveHeightCalculationMessageProvider(),
- assessmentSection.HydraulicBoundaryDatabase.FilePath,
- assessmentSection.HydraulicBoundaryDatabase,
+ hydraulicBoundaryLocationCalculationGuiService.CalculateWaveHeights(assessmentSection.HydraulicBoundaryDatabase.FilePath,
assessmentSection.HydraulicBoundaryDatabase.Locations,
assessmentSection.Id,
- assessmentSection.FailureMechanismContribution.Norm);
+ assessmentSection.FailureMechanismContribution.Norm, new WaveHeightCalculationMessageProvider());
});
if (nodeData.WrappedData.HydraulicBoundaryDatabase == null)
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/DesignWaterLevelLocationsViewTest.cs
===================================================================
diff -u -rfe0ccc4dc7ed40356bd77aae1531d073af8d8f85 -r1042a38d3663daeda5a8e1083edbc63a4b6aae94
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/DesignWaterLevelLocationsViewTest.cs (.../DesignWaterLevelLocationsViewTest.cs) (revision fe0ccc4dc7ed40356bd77aae1531d073af8d8f85)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/DesignWaterLevelLocationsViewTest.cs (.../DesignWaterLevelLocationsViewTest.cs) (revision 1042a38d3663daeda5a8e1083edbc63a4b6aae94)
@@ -219,12 +219,12 @@
ICalculationMessageProvider messageProvider = null;
IEnumerable locations = null;
- guiServiceMock.Expect(ch => ch.CalculateDesignWaterLevels(null, null, null, null, null, 1)).IgnoreArguments().WhenCalled(
+ guiServiceMock.Expect(ch => ch.CalculateDesignWaterLevels(null, null, null, 1, null)).IgnoreArguments().WhenCalled(
invocation =>
{
- messageProvider = (ICalculationMessageProvider) invocation.Arguments[0];
- locations = (IEnumerable) invocation.Arguments[3];
- });
+ locations = (IEnumerable)invocation.Arguments[1];
+ messageProvider = (ICalculationMessageProvider) invocation.Arguments[4];
+ }).Return(false);
mockRepository.ReplayAll();
view.CalculationGuiService = guiServiceMock;
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/WaveHeightLocationsViewTest.cs
===================================================================
diff -u -r06b2840a2bb64c0960c8ac29322b5a0971c73c77 -r1042a38d3663daeda5a8e1083edbc63a4b6aae94
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/WaveHeightLocationsViewTest.cs (.../WaveHeightLocationsViewTest.cs) (revision 06b2840a2bb64c0960c8ac29322b5a0971c73c77)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/WaveHeightLocationsViewTest.cs (.../WaveHeightLocationsViewTest.cs) (revision 1042a38d3663daeda5a8e1083edbc63a4b6aae94)
@@ -212,8 +212,11 @@
var guiServiceMock = mockRepository.StrictMock();
IEnumerable locations = null;
- guiServiceMock.Expect(ch => ch.CalculateWaveHeights(null, null, null, null, null, 1)).IgnoreArguments().WhenCalled(
- invocation => { locations = (IEnumerable) invocation.Arguments[3]; });
+ guiServiceMock.Expect(ch => ch.CalculateWaveHeights(null, null, null, 1, null)).IgnoreArguments().WhenCalled(
+ invocation =>
+ {
+ locations = (IEnumerable) invocation.Arguments[1];
+ }).Return(false);
mockRepository.ReplayAll();
view.CalculationGuiService = guiServiceMock;