Index: Ringtoets/Common/src/Ringtoets.Common.Forms/GuiServices/HydraulicBoundaryLocationCalculationGuiService.cs
===================================================================
diff -u -r75ac52f6f7e203e77dd212e6c32d68e7e58c28b2 -r06b2840a2bb64c0960c8ac29322b5a0971c73c77
--- Ringtoets/Common/src/Ringtoets.Common.Forms/GuiServices/HydraulicBoundaryLocationCalculationGuiService.cs (.../HydraulicBoundaryLocationCalculationGuiService.cs) (revision 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/GuiServices/HydraulicBoundaryLocationCalculationGuiService.cs (.../HydraulicBoundaryLocationCalculationGuiService.cs) (revision 06b2840a2bb64c0960c8ac29322b5a0971c73c77)
@@ -29,6 +29,7 @@
using log4net;
using Ringtoets.Common.Forms.Properties;
using Ringtoets.Common.Service;
+using Ringtoets.Common.Service.MessageProviders;
using Ringtoets.HydraRing.Data;
using Ringtoets.HydraRing.IO;
@@ -47,6 +48,7 @@
/// Initializes a new instance of the class.
///
/// The parent of the view.
+ /// When any of the parameters is null.
public HydraulicBoundaryLocationCalculationGuiService(IWin32Window viewParent)
{
if (viewParent == null)
@@ -56,9 +58,16 @@
this.viewParent = viewParent;
}
- public void CalculateDesignWaterLevels(string hydraulicBoundaryDatabasePath, IObservable observable,
- IEnumerable locations, string ringId, double norm)
+ public void CalculateDesignWaterLevels(ICalculationMessageProvider messageProvider,
+ string hydraulicBoundaryDatabasePath,
+ IObservable observable,
+ IEnumerable locations,
+ string ringId, double norm)
{
+ if (messageProvider == null)
+ {
+ throw new ArgumentNullException("messageProvider");
+ }
if (observable == null)
{
throw new ArgumentNullException("observable");
@@ -67,16 +76,22 @@
{
throw new ArgumentNullException("locations");
}
- var activities = locations.Select(hbl => new DesignWaterLevelCalculationActivity(hbl,
+ var activities = locations.Select(hbl => new DesignWaterLevelCalculationActivity(messageProvider, hbl,
hydraulicBoundaryDatabasePath,
ringId,
norm)).ToArray();
RunActivities(hydraulicBoundaryDatabasePath, activities, observable);
}
- public void CalculateWaveHeights(string hydraulicBoundaryDatabasePath, IObservable observable,
- IEnumerable locations, string ringId, double norm)
+ public void CalculateWaveHeights(ICalculationMessageProvider messageProvider,
+ string hydraulicBoundaryDatabasePath, IObservable observable,
+ IEnumerable locations,
+ string ringId, double norm)
{
+ if (messageProvider == null)
+ {
+ throw new ArgumentNullException("messageProvider");
+ }
if (observable == null)
{
throw new ArgumentNullException("observable");
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/GuiServices/IHydraulicBoundaryLocationCalculationGuiService.cs
===================================================================
diff -u -r75ac52f6f7e203e77dd212e6c32d68e7e58c28b2 -r06b2840a2bb64c0960c8ac29322b5a0971c73c77
--- Ringtoets/Common/src/Ringtoets.Common.Forms/GuiServices/IHydraulicBoundaryLocationCalculationGuiService.cs (.../IHydraulicBoundaryLocationCalculationGuiService.cs) (revision 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/GuiServices/IHydraulicBoundaryLocationCalculationGuiService.cs (.../IHydraulicBoundaryLocationCalculationGuiService.cs) (revision 06b2840a2bb64c0960c8ac29322b5a0971c73c77)
@@ -22,42 +22,45 @@
using System;
using System.Collections.Generic;
using Core.Common.Base;
+using Ringtoets.Common.Service.MessageProviders;
using Ringtoets.HydraRing.Data;
namespace Ringtoets.Common.Forms.GuiServices
{
///
- /// Interface for and
- /// calculations.
+ /// Interface for and
+ /// calculations.
///
public interface IHydraulicBoundaryLocationCalculationGuiService
{
///
- /// Performs the calculation for all .
+ /// 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 id of the ring to perform the calculation for.
/// The norm to use during the calculation.
- /// Thrown when
+ /// Thrown when , ,
/// or is null.
- void CalculateDesignWaterLevels(string hydraulicBoundaryDatabasePath, IObservable observable,
+ void CalculateDesignWaterLevels(ICalculationMessageProvider messageProvider, string hydraulicBoundaryDatabasePath, IObservable observable,
IEnumerable locations, string ringId, double norm);
///
- /// Performs the calculation for all .
+ /// 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 id of the ring to perform the calculation for.
/// The norm to use during the calculation.
- /// Thrown when
+ /// Thrown when , ,
/// or is null.
- void CalculateWaveHeights(string hydraulicBoundaryDatabasePath, IObservable observable,
+ void CalculateWaveHeights(ICalculationMessageProvider messageProvider, string hydraulicBoundaryDatabasePath, IObservable observable,
IEnumerable locations, string ringId, double norm);
}
}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Service/DesignWaterLevelCalculationActivity.cs
===================================================================
diff -u -r75ac52f6f7e203e77dd212e6c32d68e7e58c28b2 -r06b2840a2bb64c0960c8ac29322b5a0971c73c77
--- Ringtoets/Common/src/Ringtoets.Common.Service/DesignWaterLevelCalculationActivity.cs (.../DesignWaterLevelCalculationActivity.cs) (revision 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2)
+++ Ringtoets/Common/src/Ringtoets.Common.Service/DesignWaterLevelCalculationActivity.cs (.../DesignWaterLevelCalculationActivity.cs) (revision 06b2840a2bb64c0960c8ac29322b5a0971c73c77)
@@ -24,7 +24,7 @@
using Core.Common.Base.Service;
using Core.Common.Utils;
using log4net;
-using Ringtoets.Common.Service.Properties;
+using Ringtoets.Common.Service.MessageProviders;
using Ringtoets.HydraRing.Calculation.Activities;
using Ringtoets.HydraRing.Calculation.Data.Output;
using Ringtoets.HydraRing.Data;
@@ -41,29 +41,39 @@
private readonly double norm;
private readonly string hydraulicBoundaryDatabaseFilePath;
private readonly string ringId;
+ private readonly ICalculationMessageProvider messageProvider;
///
/// 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.
/// Thrown when is null.
- public DesignWaterLevelCalculationActivity(IHydraulicBoundaryLocation hydraulicBoundaryLocation, string hydraulicBoundaryDatabaseFilePath, string ringId, double norm)
+ public DesignWaterLevelCalculationActivity(ICalculationMessageProvider messageProvider,
+ IHydraulicBoundaryLocation hydraulicBoundaryLocation,
+ string hydraulicBoundaryDatabaseFilePath,
+ string ringId, double norm)
{
if (hydraulicBoundaryLocation == null)
{
throw new ArgumentNullException("hydraulicBoundaryLocation");
}
-
this.hydraulicBoundaryLocation = hydraulicBoundaryLocation;
+
+ if (messageProvider == null)
+ {
+ throw new ArgumentNullException("messageProvider");
+ }
+ this.messageProvider = messageProvider;
+
this.hydraulicBoundaryDatabaseFilePath = hydraulicBoundaryDatabaseFilePath;
this.ringId = ringId;
this.norm = norm;
- Name = string.Format(Resources.DesignWaterLevelCalculationService_Name_Calculate_assessment_level_for_location_0_,
- hydraulicBoundaryLocation.Name);
+ Name = messageProvider.GetActivityName(hydraulicBoundaryLocation.Name);
}
protected override void OnRun()
@@ -74,10 +84,12 @@
return;
}
- PerformRun(() => DesignWaterLevelCalculationService.Validate(hydraulicBoundaryLocation, hydraulicBoundaryDatabaseFilePath),
+ PerformRun(() => DesignWaterLevelCalculationService.Validate(
+ messageProvider.GetCalculationName(hydraulicBoundaryLocation.Name), hydraulicBoundaryDatabaseFilePath),
() => hydraulicBoundaryLocation.DesignWaterLevel = (RoundedDouble) double.NaN,
- () => DesignWaterLevelCalculationService.Calculate(hydraulicBoundaryLocation, hydraulicBoundaryDatabaseFilePath,
- ringId, norm));
+ () => DesignWaterLevelCalculationService.Calculate(
+ messageProvider, hydraulicBoundaryLocation, hydraulicBoundaryDatabaseFilePath,
+ ringId, norm));
}
protected override void OnFinish()
@@ -89,7 +101,7 @@
Math.Abs(Output.CalculatedReliabilityIndex - StatisticsConverter.NormToBeta(norm)) <= 1.0e-3;
if (!designWaterLevelCalculationConvergence)
{
- log.WarnFormat(Resources.DesignWaterLevelCalculationActivity_DesignWaterLevel_calculation_for_location_0_not_converged, hydraulicBoundaryLocation.Name);
+ log.Warn(messageProvider.GetCalculatedNotConvergedMessage(hydraulicBoundaryLocation.Name));
}
hydraulicBoundaryLocation.DesignWaterLevelCalculationConvergence = designWaterLevelCalculationConvergence
? CalculationConvergence.CalculatedConverged
Index: Ringtoets/Common/src/Ringtoets.Common.Service/DesignWaterLevelCalculationService.cs
===================================================================
diff -u -r75ac52f6f7e203e77dd212e6c32d68e7e58c28b2 -r06b2840a2bb64c0960c8ac29322b5a0971c73c77
--- Ringtoets/Common/src/Ringtoets.Common.Service/DesignWaterLevelCalculationService.cs (.../DesignWaterLevelCalculationService.cs) (revision 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2)
+++ Ringtoets/Common/src/Ringtoets.Common.Service/DesignWaterLevelCalculationService.cs (.../DesignWaterLevelCalculationService.cs) (revision 06b2840a2bb64c0960c8ac29322b5a0971c73c77)
@@ -21,6 +21,7 @@
using System.IO;
using log4net;
+using Ringtoets.Common.Service.MessageProviders;
using Ringtoets.Common.Service.Properties;
using Ringtoets.HydraRing.Calculation.Data;
using Ringtoets.HydraRing.Calculation.Data.Input.Hydraulics;
@@ -40,16 +41,15 @@
private static readonly ILog log = LogManager.GetLogger(typeof(DesignWaterLevelCalculationService));
///
- /// Performs validation of the values in the given . Error information is logged during
+ /// Performs validation of the values in the given . Error information is logged during
/// the execution of the operation.
///
- /// The for which to validate the values.
+ /// The name to use in the validation logs.
/// The HLCD file that should be used for performing the calculation.
/// False if the connection to contains validation errors; True otherwise.
- internal static bool Validate(IHydraulicBoundaryLocation hydraulicBoundaryLocation, string hydraulicBoundaryDatabaseFilePath)
+ internal static bool Validate(string name, string hydraulicBoundaryDatabaseFilePath)
{
- var calculationName = string.Format(Resources.DesignWaterLevelCalculationService_Name_Assessment_level_for_location_0_, hydraulicBoundaryLocation.Name);
- CalculationServiceHelper.LogValidationBeginTime(calculationName);
+ CalculationServiceHelper.LogValidationBeginTime(name);
string validationProblem = HydraulicDatabaseHelper.ValidatePathForCalculation(hydraulicBoundaryDatabaseFilePath);
var isValid = string.IsNullOrEmpty(validationProblem);
@@ -60,7 +60,7 @@
validationProblem);
}
- CalculationServiceHelper.LogValidationEndTime(calculationName);
+ CalculationServiceHelper.LogValidationEndTime(name);
return isValid;
}
@@ -69,18 +69,21 @@
/// Performs a design water level calculation based on the supplied and returns the result
/// if the calculation was successful. Error and status information is logged during the execution of the operation.
///
+ /// The message provider for the services.
/// 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.
/// A on a successful calculation, null otherwise.
- internal static ReliabilityIndexCalculationOutput Calculate(IHydraulicBoundaryLocation hydraulicBoundaryLocation, string hydraulicBoundaryDatabaseFilePath,
+ internal static ReliabilityIndexCalculationOutput Calculate(ICalculationMessageProvider messageProvider,
+ IHydraulicBoundaryLocation hydraulicBoundaryLocation,
+ string hydraulicBoundaryDatabaseFilePath,
string ringId, double norm)
{
var hlcdDirectory = Path.GetDirectoryName(hydraulicBoundaryDatabaseFilePath);
var input = CreateInput(hydraulicBoundaryLocation, norm);
var targetProbabilityCalculationParser = new ReliabilityIndexCalculationParser();
- var calculationName = string.Format(Resources.DesignWaterLevelCalculationService_Name_Assessment_level_for_location_0_, hydraulicBoundaryLocation.Name);
+ var calculationName = messageProvider.GetCalculationName(hydraulicBoundaryLocation.Name);
CalculationServiceHelper.PerformCalculation(
calculationName,
@@ -96,17 +99,17 @@
targetProbabilityCalculationParser
});
- VerifyOutput(targetProbabilityCalculationParser.Output, hydraulicBoundaryLocation.Name);
+ VerifyOutput(targetProbabilityCalculationParser.Output, messageProvider, hydraulicBoundaryLocation.Name);
});
return targetProbabilityCalculationParser.Output;
}
- private static void VerifyOutput(ReliabilityIndexCalculationOutput output, string name)
+ private static void VerifyOutput(ReliabilityIndexCalculationOutput output, ICalculationMessageProvider messageProvider, string locationName)
{
if (output == null)
{
- log.ErrorFormat(Resources.DesignWaterLevelCalculationService_Calculate_Error_in_design_water_level_0_calculation, name);
+ log.Error(messageProvider.GetCalculationFailedMessage(locationName));
}
}
Index: Ringtoets/Common/src/Ringtoets.Common.Service/MessageProviders/ICalculationMessageProvider.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.Service/MessageProviders/ICalculationMessageProvider.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.Service/MessageProviders/ICalculationMessageProvider.cs (revision 06b2840a2bb64c0960c8ac29322b5a0971c73c77)
@@ -0,0 +1,57 @@
+// 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.
+
+namespace Ringtoets.Common.Service.MessageProviders
+{
+ ///
+ /// Interface for messages used during calculations.
+ ///
+ public interface ICalculationMessageProvider
+ {
+ ///
+ /// Gets the calculation name that can be used for messaging.
+ ///
+ /// The calculation subject used in the calculation name.
+ /// The calculation name.
+ string GetCalculationName(string calculationSubject);
+
+ ///
+ /// Gets the activity name that can be used for messaging.
+ ///
+ /// The calculation subject used in the calculation name.
+ /// The activity name.
+ string GetActivityName(string calculationSubject);
+
+ ///
+ /// Gets the message that should be used when a calculation fails.
+ ///
+ /// The calculation subject used in the calculation name.
+ /// The message.
+ string GetCalculationFailedMessage(string calculationSubject);
+
+ ///
+ /// Gets the message that should be used when a calculation cannot be converged.
+ ///
+ /// The calculation subject used in the calculation name.
+ /// The message.
+ string GetCalculatedNotConvergedMessage(string calculationSubject);
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Service/Ringtoets.Common.Service.csproj
===================================================================
diff -u -r915001caffacbbee15c0e3bf449072245bc5f509 -r06b2840a2bb64c0960c8ac29322b5a0971c73c77
--- Ringtoets/Common/src/Ringtoets.Common.Service/Ringtoets.Common.Service.csproj (.../Ringtoets.Common.Service.csproj) (revision 915001caffacbbee15c0e3bf449072245bc5f509)
+++ Ringtoets/Common/src/Ringtoets.Common.Service/Ringtoets.Common.Service.csproj (.../Ringtoets.Common.Service.csproj) (revision 06b2840a2bb64c0960c8ac29322b5a0971c73c77)
@@ -51,6 +51,7 @@
+
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/GuiServices/HydraulicBoundaryLocationCalculationGuiServiceTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/GuiServices/HydraulicBoundaryLocationCalculationGuiServiceTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/GuiServices/HydraulicBoundaryLocationCalculationGuiServiceTest.cs (revision 06b2840a2bb64c0960c8ac29322b5a0971c73c77)
@@ -0,0 +1,426 @@
+// 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 System.Collections.Generic;
+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;
+using Rhino.Mocks;
+using Ringtoets.Common.Forms.GuiServices;
+using Ringtoets.Common.Service.MessageProviders;
+using Ringtoets.HydraRing.Data;
+
+namespace Ringtoets.Common.Forms.Test.GuiServices
+{
+ [TestFixture]
+ public class HydraulicBoundaryLocationCalculationGuiServiceTest : NUnitFormTest
+ {
+ private MockRepository mockRepository;
+ private readonly string testDataPath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Integration.Service, "HydraRingCalculation");
+
+ [SetUp]
+ public void SetUp()
+ {
+ mockRepository = new MockRepository();
+ }
+
+ [Test]
+ public void Constructor_NullMainWindow_ThrowsArgumentNullException()
+ {
+ // Setup & Call
+ TestDelegate test = () => new HydraulicBoundaryLocationCalculationGuiService(null);
+
+ // Assert
+ string paramName = Assert.Throws(test).ParamName;
+ const string expectedParamName = "viewParent";
+ Assert.AreEqual(expectedParamName, paramName);
+ }
+
+ [Test]
+ public void Constructor_DefaultValues()
+ {
+ // Setup
+ using (var viewParent = new Form())
+ {
+ // Call
+ var guiService = new HydraulicBoundaryLocationCalculationGuiService(viewParent);
+
+ // Assert
+ Assert.IsInstanceOf(guiService);
+ }
+ }
+
+ [Test]
+ 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);
+
+ // Assert
+ string paramName = Assert.Throws(test).ParamName;
+ const string expectedParamName = "messageProvider";
+ Assert.AreEqual(expectedParamName, paramName);
+ }
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ public void CalculateDesignWaterLevels_NullObservable_ThrowsArgumentNullException()
+ {
+ // Setup
+ var calculationMessageProviderMock = mockRepository.StrictMock();
+ mockRepository.ReplayAll();
+ var locations = Enumerable.Empty();
+ using (var viewParent = new Form())
+ {
+ var guiService = new HydraulicBoundaryLocationCalculationGuiService(viewParent);
+
+ // Call
+ TestDelegate test = () => guiService.CalculateDesignWaterLevels(calculationMessageProviderMock, "", null, locations, "", 1);
+
+ // Assert
+ string paramName = Assert.Throws(test).ParamName;
+ const string expectedParamName = "observable";
+ Assert.AreEqual(expectedParamName, paramName);
+ }
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ public void CalculateDesignWaterLevels_NullLocations_ThrowsArgumentNullException()
+ {
+ // Setup
+ var observableMock = mockRepository.StrictMock();
+ var calculationMessageProviderMock = mockRepository.StrictMock();
+ mockRepository.ReplayAll();
+ const string databasePath = "Does not exist";
+
+ using (var viewParent = new Form())
+ {
+ var guiService = new HydraulicBoundaryLocationCalculationGuiService(viewParent);
+
+ // Call
+ TestDelegate test = () => guiService.CalculateDesignWaterLevels(calculationMessageProviderMock, databasePath, observableMock, null, "", 1);
+
+ // Assert
+ string paramName = Assert.Throws(test).ParamName;
+ const string expectedParamName = "locations";
+ Assert.AreEqual(expectedParamName, paramName);
+ }
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ public void CalculateDesignWaterLevels_HydraulicDatabaseDoesNotExist_LogsErrorAndDoesNotNotifyObservers()
+ {
+ // 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
+ Action call = () => guiService.CalculateDesignWaterLevels(calculationMessageProviderMock, databasePath, observableMock, locations, "", 1);
+
+ // Assert
+ 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_ValidPathEmptyList_NotifyObserversButNoLog()
+ {
+ // Setup
+ string validDatabasePath = Path.Combine(testDataPath, "HRD dutch coast south.sqlite");
+
+ var observableMock = mockRepository.StrictMock();
+ observableMock.NotifyObservers();
+ 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
+ Action call = () => guiService.CalculateDesignWaterLevels(calculationMessageProviderMock, validDatabasePath, observableMock, locations, "", 1);
+
+ // Assert
+ TestHelper.AssertLogMessagesCount(call, 0);
+ }
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ public void CalculateDesignWaterLevels_ValidPathOneLocationInTheList_NotifyObserversAndLogsMessages()
+ {
+ // Setup
+ const string hydraulicLocationName = "name";
+ string validDatabasePath = Path.Combine(testDataPath, "HRD dutch coast south.sqlite");
+
+ var observableMock = mockRepository.StrictMock();
+ observableMock.NotifyObservers();
+ var calculationMessageProviderMock = mockRepository.StrictMock();
+ calculationMessageProviderMock.Expect(calc => calc.GetActivityName(hydraulicLocationName)).Return("GetActivityName").Repeat.AtLeastOnce();
+ calculationMessageProviderMock.Expect(calc => calc.GetCalculationName(hydraulicLocationName)).Return("GetCalculationName").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
+ Action call = () => guiService.CalculateDesignWaterLevels(calculationMessageProviderMock, validDatabasePath, observableMock, locations, "", 1);
+
+ // Assert
+ TestHelper.AssertLogMessages(call, messages =>
+ {
+ var msgs = messages.ToArray();
+ Assert.AreEqual(6, msgs.Length);
+ string expectedName = "GetCalculationName";
+ StringAssert.StartsWith(string.Format("Validatie van '{0}' gestart om: ", expectedName), msgs.First());
+ StringAssert.StartsWith(string.Format("Validatie van '{0}' beëindigd om: ", expectedName), msgs.Skip(1).First());
+ StringAssert.StartsWith(string.Format("Berekening van '{0}' gestart om: ", expectedName), msgs.Skip(2).First());
+ StringAssert.StartsWith(string.Format("Berekening van '{0}' beëindigd om: ", expectedName), msgs.Skip(3).First());
+ StringAssert.AreNotEqualIgnoringCase(string.Format("Uitvoeren van '{0}' is mislukt.", expectedName), msgs.Last());
+ });
+ }
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ public void CalculateWaveHeights_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.CalculateWaveHeights(null, "", observableMock, locations, "", 1);
+
+ // Assert
+ string paramName = Assert.Throws(test).ParamName;
+ const string expectedParamName = "messageProvider";
+ Assert.AreEqual(expectedParamName, paramName);
+ }
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ public void CalculateWaveHeights_NullObservable_ThrowsArgumentNullException()
+ {
+ // Setup
+ var calculationMessageProviderMock = mockRepository.StrictMock();
+ mockRepository.ReplayAll();
+
+ var locations = Enumerable.Empty();
+
+ using (var viewParent = new Form())
+ {
+ var guiService = new HydraulicBoundaryLocationCalculationGuiService(viewParent);
+
+ // Call
+ TestDelegate test = () => guiService.CalculateWaveHeights(calculationMessageProviderMock, "", null, locations, "", 1);
+
+ // Assert
+ string paramName = Assert.Throws(test).ParamName;
+ const string expectedParamName = "observable";
+ 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";
+
+ using (var viewParent = new Form())
+ {
+ var guiService = new HydraulicBoundaryLocationCalculationGuiService(viewParent);
+
+ // Call
+ TestDelegate test = () => guiService.CalculateWaveHeights(calculationMessageProviderMock, databasePath, observableMock, null, "", 1);
+
+ // Assert
+ string paramName = Assert.Throws(test).ParamName;
+ const string expectedParamName = "locations";
+ Assert.AreEqual(expectedParamName, paramName);
+ }
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ public void CalculateWaveHeights_HydraulicDatabaseDoesNotExist_LogsErrorAndDoesNotNotifyObservers()
+ {
+ // 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
+ Action call = () => guiService.CalculateWaveHeights(calculationMessageProviderMock, databasePath, observableMock, locations, "", 1);
+
+ // Assert
+ 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 CalculateWaveHeights_ValidPathEmptyList_NotifyObserversButNoLog()
+ {
+ // Setup
+ string validDatabasePath = Path.Combine(testDataPath, "HRD dutch coast south.sqlite");
+
+ var observableMock = mockRepository.StrictMock();
+ observableMock.NotifyObservers();
+ 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
+ Action call = () => guiService.CalculateWaveHeights(calculationMessageProviderMock, validDatabasePath, observableMock, locations, "", 1);
+
+ // Assert
+ TestHelper.AssertLogMessagesCount(call, 0);
+ }
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ public void CalculateWaveHeights_ValidPathOneLocationInTheList_NotifyObserversAndLogsMessages()
+ {
+ // Setup
+ string validDatabasePath = Path.Combine(testDataPath, "HRD dutch coast south.sqlite");
+
+ var observableMock = mockRepository.StrictMock();
+ observableMock.NotifyObservers();
+ var calculationMessageProviderMock = mockRepository.StrictMock();
+ mockRepository.ReplayAll();
+
+ DialogBoxHandler = (name, wnd) =>
+ {
+ // Expect an activity dialog which is automatically closed
+ };
+
+ const string hydraulicLocationName = "name";
+ 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(calculationMessageProviderMock, validDatabasePath, observableMock, locations, "", 1);
+
+ // Assert
+ TestHelper.AssertLogMessages(call, messages =>
+ {
+ var msgs = messages.ToArray();
+ Assert.AreEqual(6, msgs.Length);
+ string expectedName = string.Format("Golfhoogte voor locatie {0}", hydraulicLocationName);
+ StringAssert.StartsWith(string.Format("Validatie van '{0}' gestart om: ", expectedName), msgs.First());
+ StringAssert.StartsWith(string.Format("Validatie van '{0}' beëindigd om: ", expectedName), msgs.Skip(1).First());
+ StringAssert.StartsWith(string.Format("Berekening van '{0}' gestart om: ", expectedName), msgs.Skip(2).First());
+ StringAssert.StartsWith(string.Format("Berekening van '{0}' beëindigd om: ", expectedName), msgs.Skip(3).First());
+ StringAssert.AreNotEqualIgnoringCase(string.Format("Uitvoeren van '{0}' is mislukt.", expectedName), msgs.Last());
+ });
+ }
+ mockRepository.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 06b2840a2bb64c0960c8ac29322b5a0971c73c77 refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Forms.Test/GuiServices/HydraulicBoundaryLocationGuiServiceTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj
===================================================================
diff -u -r275811c8e133cba03f636224f40a9536a733fb1f -r06b2840a2bb64c0960c8ac29322b5a0971c73c77
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 275811c8e133cba03f636224f40a9536a733fb1f)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 06b2840a2bb64c0960c8ac29322b5a0971c73c77)
@@ -63,7 +63,7 @@
Properties\GlobalAssembly.cs
-
+
@@ -139,6 +139,10 @@
{4d840673-3812-4338-a352-84854e32b8a0}
Ringtoets.Common.Forms
+
+ {d951d6da-fe83-4920-9fdb-63bf96480b54}
+ Ringtoets.Common.Service
+
{4843D6E5-066F-4795-94F5-1D53932DD03C}
Ringtoets.Common.Data.TestUtil
Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/DesignWaterLevelCalculationActivityTest.cs
===================================================================
diff -u -r915001caffacbbee15c0e3bf449072245bc5f509 -r06b2840a2bb64c0960c8ac29322b5a0971c73c77
--- Ringtoets/Common/test/Ringtoets.Common.Service.Test/DesignWaterLevelCalculationActivityTest.cs (.../DesignWaterLevelCalculationActivityTest.cs) (revision 915001caffacbbee15c0e3bf449072245bc5f509)
+++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/DesignWaterLevelCalculationActivityTest.cs (.../DesignWaterLevelCalculationActivityTest.cs) (revision 06b2840a2bb64c0960c8ac29322b5a0971c73c77)
@@ -27,61 +27,110 @@
using Core.Common.TestUtil;
using NUnit.Framework;
using Rhino.Mocks;
-using Ringtoets.Common.Data.AssessmentSection;
-using Ringtoets.Common.Data.TestUtil;
-using Ringtoets.Common.Service.Properties;
+using Ringtoets.Common.Service.MessageProviders;
using Ringtoets.HydraRing.Data;
-using Ringtoets.Integration.Plugin.FileImporters;
namespace Ringtoets.Common.Service.Test
{
[TestFixture]
public class DesignWaterLevelCalculationActivityTest
{
+ private const string validFile = "HRD dutch coast south.sqlite";
+ private MockRepository mockRepository;
private readonly string testDataPath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Integration.Service, "HydraRingCalculation");
+ [SetUp]
+ public void SetUp()
+ {
+ mockRepository = new MockRepository();
+ }
+
[Test]
public void ParameteredConstructor_ExpectedValues()
{
// Setup
- var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "test", 0, 0);
+ const string locationName = "locationName";
+ const string activityName = "GetActivityName";
+
+ var hydraulicBoundaryLocationMock = mockRepository.Stub();
+ hydraulicBoundaryLocationMock.Expect(hbl => hbl.Name).Return(locationName);
+
+ var calculationMessageProviderMock = mockRepository.StrictMock();
+ calculationMessageProviderMock.Expect(calc => calc.GetActivityName(locationName)).Return(activityName);
+ mockRepository.ReplayAll();
+
string validFilePath = Path.Combine(testDataPath, validFile);
// Call
- var activity = new DesignWaterLevelCalculationActivity(hydraulicBoundaryLocation, validFilePath, "", 1);
+ var activity = new DesignWaterLevelCalculationActivity(calculationMessageProviderMock, hydraulicBoundaryLocationMock, validFilePath, "", 1);
// Assert
Assert.IsInstanceOf(activity);
- string expectedName = string.Format(Resources.DesignWaterLevelCalculationService_Name_Calculate_assessment_level_for_location_0_,
- hydraulicBoundaryLocation.Name);
- Assert.AreEqual(expectedName, activity.Name);
+ Assert.AreSame(activityName, activity.Name);
Assert.IsNull(activity.ProgressText);
Assert.AreEqual(ActivityState.None, activity.State);
+ mockRepository.VerifyAll();
}
[Test]
+ public void ParameteredConstructor_NullCalculationServiceMessageProvider_ThrowsArgumentNullException()
+ {
+ // Setup
+ var hydraulicBoundaryLocationMock = mockRepository.StrictMock();
+ mockRepository.ReplayAll();
+
+ string validFilePath = Path.Combine(testDataPath, validFile);
+
+ // Call
+ TestDelegate call = () => new DesignWaterLevelCalculationActivity(null, hydraulicBoundaryLocationMock, validFilePath, "", 1);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("messageProvider", exception.ParamName);
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
public void ParameteredConstructor_HydraulicBoundaryLocationNull_ThrowsArgumentNullException()
{
// Setup
+ var calculationMessageProviderMock = mockRepository.StrictMock();
+ mockRepository.ReplayAll();
+
string validFilePath = Path.Combine(testDataPath, validFile);
// Call
- TestDelegate call = () => new DesignWaterLevelCalculationActivity(null, validFilePath, "", 1);
+ TestDelegate call = () => new DesignWaterLevelCalculationActivity(calculationMessageProviderMock, null, validFilePath, "", 1);
// Assert
var exception = Assert.Throws(call);
Assert.AreEqual("hydraulicBoundaryLocation", exception.ParamName);
+ mockRepository.VerifyAll();
}
[Test]
public void Run_InvalidHydraulicBoundaryDatabase_PerformValidationAndLogStartAndEndAndError()
{
// Setup
string inValidFilePath = Path.Combine(testDataPath, "notexisting.sqlite");
+ const string locationName = "testLocation";
+ const string activityName = "GetActivityName";
+ const string calculationName = "locationName";
- var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "test", 0, 0);
- var activity = new DesignWaterLevelCalculationActivity(hydraulicBoundaryLocation, inValidFilePath, "", 1);
+ var hydraulicBoundaryLocationMock = mockRepository.Stub();
+ hydraulicBoundaryLocationMock.Expect(hbl => hbl.Id).Return(1);
+ hydraulicBoundaryLocationMock.Expect(hbl => hbl.Name).Return(locationName).Repeat.AtLeastOnce();
+ hydraulicBoundaryLocationMock.DesignWaterLevel = new RoundedDouble(2, double.NaN);
+
+ var calculationMessageProviderMock = mockRepository.StrictMock();
+ calculationMessageProviderMock.Expect(calc => calc.GetActivityName(locationName)).Return(activityName);
+ calculationMessageProviderMock.Expect(calc => calc.GetCalculationName(locationName)).Return(calculationName).Repeat.AtLeastOnce();
+ mockRepository.ReplayAll();
+
+ var activity = new DesignWaterLevelCalculationActivity(calculationMessageProviderMock,
+ hydraulicBoundaryLocationMock, inValidFilePath, "", 1);
+
// Call
Action call = () => activity.Run();
@@ -90,7 +139,6 @@
{
var msgs = messages.ToArray();
Assert.AreEqual(3, msgs.Length);
- var calculationName = string.Format("Toetspeil voor locatie {0}", hydraulicBoundaryLocation.Name);
StringAssert.StartsWith(string.Format("Validatie van '{0}' gestart om: ", calculationName), msgs[0]);
StringAssert.StartsWith("Herstellen van de verbinding met de hydraulische randvoorwaardendatabase is mislukt. Fout bij het lezen van bestand", msgs[1]);
StringAssert.StartsWith(string.Format("Validatie van '{0}' beëindigd om: ", calculationName), msgs[2]);
@@ -99,18 +147,28 @@
}
[Test]
- public void Run_ValidHydraulicBoundaryDatabaseAndHydraulicBoundaryLocation_PerformValidationAndCalculationAndLogStartAndEnd()
+ public void Run_ValidHydraulicBoundaryHydraulicBoundaryLocation_PerformValidationAndCalculationAndLogStartAndEnd()
{
// Setup
- var mockRepository = new MockRepository();
- var assessmentSectionStub = mockRepository.Stub();
- ImportHydraulicBoundaryDatabase(assessmentSectionStub, validFile);
- mockRepository.ReplayAll();
+ string validFilePath = Path.Combine(testDataPath, validFile);
+ const string locationName = "punt_flw_";
+ const string activityName = "GetActivityName";
+ const string calculationName = "locationName";
- var hydraulicBoundaryLocation = assessmentSectionStub.HydraulicBoundaryDatabase.Locations.First(loc => loc.Id == 1300001);
+ var hydraulicBoundaryLocationMock = mockRepository.Stub();
+ hydraulicBoundaryLocationMock.Expect(hbl => hbl.Id).Return(1300001).Repeat.AtLeastOnce();
+ hydraulicBoundaryLocationMock.Expect(hbl => hbl.Name).Return(locationName).Repeat.AtLeastOnce();
+ hydraulicBoundaryLocationMock.DesignWaterLevel = new RoundedDouble(2, double.NaN);
- var activity = new DesignWaterLevelCalculationActivity(hydraulicBoundaryLocation, assessmentSectionStub.HydraulicBoundaryDatabase.FilePath, "", 30);
+ var calculationMessageProviderMock = mockRepository.StrictMock();
+ calculationMessageProviderMock.Expect(calc => calc.GetActivityName(locationName)).Return(activityName);
+ calculationMessageProviderMock.Expect(calc => calc.GetCalculationName(locationName)).Return(calculationName).Repeat.AtLeastOnce();
+ mockRepository.ReplayAll();
+ var activity = new DesignWaterLevelCalculationActivity(calculationMessageProviderMock,
+ hydraulicBoundaryLocationMock,
+ validFilePath, "", 30);
+
// Call
Action call = () => activity.Run();
@@ -119,7 +177,6 @@
{
var msgs = messages.ToArray();
Assert.AreEqual(5, msgs.Length);
- var calculationName = string.Format("Toetspeil voor locatie {0}", hydraulicBoundaryLocation.Name);
StringAssert.StartsWith(string.Format("Validatie van '{0}' gestart om: ", calculationName), msgs[0]);
StringAssert.StartsWith(string.Format("Validatie van '{0}' beëindigd om: ", calculationName), msgs[1]);
StringAssert.StartsWith(string.Format("Berekening van '{0}' gestart om: ", calculationName), msgs[2]);
@@ -131,18 +188,29 @@
}
[Test]
- public void Run_ValidHydraulicBoundaryDatabaseInvalidHydraulicBoundaryLocation_PerformValidationAndCalculationAndLogStartAndEndAndError()
+ public void Run_InvalidHydraulicBoundaryLocation_PerformValidationAndCalculationAndLogStartAndEndAndError()
{
// Setup
- var mockRepository = new MockRepository();
- var assessmentSectionStub = mockRepository.Stub();
- ImportHydraulicBoundaryDatabase(assessmentSectionStub, validFile);
- mockRepository.ReplayAll();
+ string validFilePath = Path.Combine(testDataPath, validFile);
+ const string locationName = "locationName";
+ const string activityName = "GetActivityName";
+ const string calculationName = "locationName";
+ const string calculationFailedMessage = "calculationFailedMessage";
- var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "test", 1, 1);
+ var hydraulicBoundaryLocationMock = mockRepository.Stub();
+ hydraulicBoundaryLocationMock.Expect(hbl => hbl.Id).Return(1).Repeat.AtLeastOnce();
+ hydraulicBoundaryLocationMock.Expect(hbl => hbl.Name).Return(locationName).Repeat.AtLeastOnce();
+ hydraulicBoundaryLocationMock.DesignWaterLevel = new RoundedDouble(2, double.NaN);
- var activity = new DesignWaterLevelCalculationActivity(hydraulicBoundaryLocation, assessmentSectionStub.HydraulicBoundaryDatabase.FilePath, "", 30);
+ var calculationMessageProviderMock = mockRepository.StrictMock();
+ calculationMessageProviderMock.Expect(calc => calc.GetActivityName(locationName)).Return(activityName);
+ calculationMessageProviderMock.Expect(calc => calc.GetCalculationName(locationName)).Return(calculationName).Repeat.AtLeastOnce();
+ calculationMessageProviderMock.Expect(calc => calc.GetCalculationFailedMessage(locationName)).Return(calculationFailedMessage).Repeat.AtLeastOnce();
+ mockRepository.ReplayAll();
+ var activity = new DesignWaterLevelCalculationActivity(calculationMessageProviderMock, hydraulicBoundaryLocationMock,
+ validFilePath, "", 30);
+
// Call
Action call = () => activity.Run();
@@ -151,35 +219,37 @@
{
var msgs = messages.ToArray();
Assert.AreEqual(6, msgs.Length);
- var calculationName = string.Format("Toetspeil voor locatie {0}", hydraulicBoundaryLocation.Name);
StringAssert.StartsWith(string.Format("Validatie van '{0}' gestart om: ", calculationName), msgs[0]);
StringAssert.StartsWith(string.Format("Validatie van '{0}' beëindigd om: ", calculationName), msgs[1]);
StringAssert.StartsWith(string.Format("Berekening van '{0}' gestart om: ", calculationName), msgs[2]);
StringAssert.StartsWith("Hydra-Ring berekeningsverslag. Klik op details voor meer informatie.", msgs[3]);
- StringAssert.StartsWith(string.Format("Er is een fout opgetreden tijdens de toetspeil berekening '{0}': inspecteer het logbestand.", hydraulicBoundaryLocation.Name), msgs[4]);
+ StringAssert.StartsWith(calculationFailedMessage, msgs[4]);
StringAssert.StartsWith(string.Format("Berekening van '{0}' beëindigd om: ", calculationName), msgs[5]);
});
Assert.AreEqual(ActivityState.Failed, activity.State);
- Assert.IsNaN(hydraulicBoundaryLocation.DesignWaterLevel);
+ Assert.IsNaN(hydraulicBoundaryLocationMock.DesignWaterLevel);
mockRepository.VerifyAll();
}
[Test]
public void Run_CalculationAlreadyRan_ValidationAndCalculationNotPerformedAndStateSkipped()
{
// Setup
- var mockRepository = new MockRepository();
- var assessmentSectionStub = mockRepository.Stub();
- ImportHydraulicBoundaryDatabase(assessmentSectionStub, validFile);
- mockRepository.ReplayAll();
+ string validFilePath = Path.Combine(testDataPath, validFile);
+ const string locationName = "locationName";
+ const string activityName = "GetActivityName";
- var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "test", 1, 1)
- {
- DesignWaterLevel = (RoundedDouble) 3.0
- };
+ var hydraulicBoundaryLocationMock = mockRepository.Stub();
+ hydraulicBoundaryLocationMock.Expect(hbl => hbl.Name).Return(locationName).Repeat.AtLeastOnce();
+ hydraulicBoundaryLocationMock.DesignWaterLevel = new RoundedDouble(2, 3.0);
- var activity = new DesignWaterLevelCalculationActivity(hydraulicBoundaryLocation, assessmentSectionStub.HydraulicBoundaryDatabase.FilePath, "", 30);
+ var calculationMessageProviderMock = mockRepository.StrictMock();
+ calculationMessageProviderMock.Expect(calc => calc.GetActivityName(locationName)).Return(activityName);
+ mockRepository.ReplayAll();
+ var activity = new DesignWaterLevelCalculationActivity(calculationMessageProviderMock,
+ hydraulicBoundaryLocationMock, validFilePath, "", 30);
+
// Call
Action call = () => activity.Run();
@@ -197,80 +267,94 @@
public void Finish_ValidCalculationAndRun_SetsDesignWaterLevelAndConvergence()
{
// Setup
- var mockRepository = new MockRepository();
- var assessmentSectionStub = mockRepository.Stub();
- ImportHydraulicBoundaryDatabase(assessmentSectionStub, validFile);
+ const string locationName = "punt_flw_ 1";
+ var hydraulicBoundaryLocationMock = mockRepository.Stub();
+ hydraulicBoundaryLocationMock.Expect(hbl => hbl.Id).Return(1300001).Repeat.AtLeastOnce();
+ hydraulicBoundaryLocationMock.Expect(hbl => hbl.Name).Return(locationName).Repeat.AtLeastOnce();
+ hydraulicBoundaryLocationMock.DesignWaterLevel = new RoundedDouble(2, double.NaN);
+ hydraulicBoundaryLocationMock.DesignWaterLevelCalculationConvergence = CalculationConvergence.CalculatedNotConverged;
+
+ var calculationMessageProviderMock = mockRepository.StrictMock();
+ calculationMessageProviderMock.Expect(calc => calc.GetActivityName(locationName)).Return("");
+ calculationMessageProviderMock.Expect(calc => calc.GetCalculationName(locationName)).Return("").Repeat.AtLeastOnce();
mockRepository.ReplayAll();
- var hydraulicBoundaryLocation = assessmentSectionStub.HydraulicBoundaryDatabase.Locations.First(loc => loc.Id == 1300001);
- hydraulicBoundaryLocation.DesignWaterLevelCalculationConvergence = CalculationConvergence.CalculatedNotConverged;
+ string validFilePath = Path.Combine(testDataPath, validFile);
+ var activity = new DesignWaterLevelCalculationActivity(calculationMessageProviderMock, hydraulicBoundaryLocationMock,
+ validFilePath, "", 30);
- var activity = new DesignWaterLevelCalculationActivity(hydraulicBoundaryLocation, assessmentSectionStub.HydraulicBoundaryDatabase.FilePath, "", 30);
-
activity.Run();
- // Precondition
- Assert.IsNaN(hydraulicBoundaryLocation.DesignWaterLevel);
- Assert.AreEqual(CalculationConvergence.CalculatedNotConverged, hydraulicBoundaryLocation.DesignWaterLevelCalculationConvergence);
-
// Call
activity.Finish();
// Assert
- Assert.IsFalse(double.IsNaN(hydraulicBoundaryLocation.DesignWaterLevel));
- Assert.AreEqual(CalculationConvergence.CalculatedConverged, hydraulicBoundaryLocation.DesignWaterLevelCalculationConvergence);
+ Assert.IsFalse(double.IsNaN(hydraulicBoundaryLocationMock.DesignWaterLevel));
+ Assert.AreEqual(CalculationConvergence.CalculatedConverged, hydraulicBoundaryLocationMock.DesignWaterLevelCalculationConvergence);
mockRepository.VerifyAll();
}
[Test]
public void Finish_InvalidCalculationAndRun_DoesNotSetDesignWaterlevelAndConvergence()
{
// Setup
- var mockRepository = new MockRepository();
- var assessmentSectionStub = mockRepository.Stub();
- ImportHydraulicBoundaryDatabase(assessmentSectionStub, validFile);
+ var calculationMessageProviderMock = mockRepository.StrictMock();
+ const string locationName = "locationName";
+ calculationMessageProviderMock.Expect(calc => calc.GetActivityName(locationName)).Return("");
+ calculationMessageProviderMock.Expect(calc => calc.GetCalculationName(locationName)).Return("").Repeat.AtLeastOnce();
+ calculationMessageProviderMock.Expect(calc => calc.GetCalculationFailedMessage(locationName)).Return("");
+
+ var hydraulicBoundaryLocationMock = mockRepository.Stub();
+ hydraulicBoundaryLocationMock.Expect(hbl => hbl.Id).Return(1).Repeat.AtLeastOnce();
+ hydraulicBoundaryLocationMock.Expect(hbl => hbl.Name).Return(locationName).Repeat.AtLeastOnce();
+ hydraulicBoundaryLocationMock.DesignWaterLevel = new RoundedDouble(2, double.NaN);
+ hydraulicBoundaryLocationMock.DesignWaterLevelCalculationConvergence = CalculationConvergence.CalculatedConverged;
mockRepository.ReplayAll();
- var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "test", 1, 1);
- hydraulicBoundaryLocation.DesignWaterLevelCalculationConvergence = CalculationConvergence.CalculatedConverged;
+ string validFilePath = Path.Combine(testDataPath, validFile);
+ var activity = new DesignWaterLevelCalculationActivity(calculationMessageProviderMock, hydraulicBoundaryLocationMock,
+ validFilePath, "", 30);
- var activity = new DesignWaterLevelCalculationActivity(hydraulicBoundaryLocation, assessmentSectionStub.HydraulicBoundaryDatabase.FilePath, "", 30);
-
activity.Run();
- // Precondition
- Assert.IsNaN(hydraulicBoundaryLocation.DesignWaterLevel);
- Assert.AreEqual(CalculationConvergence.CalculatedConverged, hydraulicBoundaryLocation.DesignWaterLevelCalculationConvergence);
-
// Call
activity.Finish();
// Assert
- Assert.IsNaN(hydraulicBoundaryLocation.DesignWaterLevel);
- Assert.AreEqual(CalculationConvergence.CalculatedConverged, hydraulicBoundaryLocation.DesignWaterLevelCalculationConvergence);
+ Assert.IsNaN(hydraulicBoundaryLocationMock.DesignWaterLevel);
+ Assert.AreEqual(CalculationConvergence.CalculatedConverged, hydraulicBoundaryLocationMock.DesignWaterLevelCalculationConvergence);
mockRepository.VerifyAll();
}
[Test]
public void Finish_ValidCalculationAndRun_LogWarningNoConvergence()
{
// Setup
- var mockRepository = new MockRepository();
- var assessmentSectionStub = mockRepository.Stub();
- ImportHydraulicBoundaryDatabase(assessmentSectionStub, "HRD ijsselmeer.sqlite");
- mockRepository.ReplayAll();
-
const string locationName = "HRbasis_ijsslm_1000";
- var hydraulicBoundaryLocation = assessmentSectionStub.HydraulicBoundaryDatabase.Locations.First(loc => loc.Name == locationName);
- hydraulicBoundaryLocation.DesignWaterLevelCalculationConvergence = CalculationConvergence.CalculatedConverged;
+ const string activityName = "getActivityName";
+ const string calculationNotConvergedMessage = "GetCalculatedNotConvergedMessage";
+ var hydraulicBoundaryLocationMock = mockRepository.Stub();
+ hydraulicBoundaryLocationMock.Expect(hbl => hbl.Id).Return(700002).Repeat.AtLeastOnce();
+ hydraulicBoundaryLocationMock.Expect(hbl => hbl.Name).Return(locationName).Repeat.AtLeastOnce();
+ hydraulicBoundaryLocationMock.DesignWaterLevel = new RoundedDouble(2, double.NaN);
+ hydraulicBoundaryLocationMock.DesignWaterLevelCalculationConvergence = CalculationConvergence.CalculatedConverged;
+
+ var calculationMessageProviderMock = mockRepository.StrictMock();
+ calculationMessageProviderMock.Expect(calc => calc.GetActivityName(locationName)).Return(activityName);
+ calculationMessageProviderMock.Expect(calc => calc.GetCalculationName(locationName)).Return("GetCalculationName").Repeat.AtLeastOnce();
+ calculationMessageProviderMock.Expect(calc => calc.GetCalculatedNotConvergedMessage(locationName)).Return(calculationNotConvergedMessage);
+ mockRepository.ReplayAll();
+
+ string validFilePath = Path.Combine(testDataPath, "HRD ijsselmeer.sqlite");
const int norm = 300;
- var activity = new DesignWaterLevelCalculationActivity(hydraulicBoundaryLocation, assessmentSectionStub.HydraulicBoundaryDatabase.FilePath, "", norm);
+ var activity = new DesignWaterLevelCalculationActivity(calculationMessageProviderMock, hydraulicBoundaryLocationMock,
+ validFilePath, "", norm);
activity.Run();
// Precondition
- Assert.AreEqual(CalculationConvergence.CalculatedConverged, hydraulicBoundaryLocation.DesignWaterLevelCalculationConvergence);
+ Assert.AreEqual(CalculationConvergence.CalculatedConverged, hydraulicBoundaryLocationMock.DesignWaterLevelCalculationConvergence);
// Call
Action call = () => activity.Finish();
@@ -280,49 +364,38 @@
{
var msgs = messages.ToArray();
Assert.AreEqual(2, msgs.Length);
- StringAssert.StartsWith(string.Format("Toetspeil berekening voor locatie {0} is niet geconvergeerd.", locationName), msgs[0]);
- StringAssert.StartsWith(string.Format("Uitvoeren van 'Toetspeil berekenen voor locatie '{0}'' is gelukt.", locationName), msgs[1]);
+ StringAssert.StartsWith(calculationNotConvergedMessage, msgs[0]);
+ StringAssert.StartsWith(string.Format("Uitvoeren van '{0}' is gelukt.", activityName), msgs[1]);
});
- Assert.AreEqual(CalculationConvergence.CalculatedNotConverged, hydraulicBoundaryLocation.DesignWaterLevelCalculationConvergence);
+ Assert.AreEqual(CalculationConvergence.CalculatedNotConverged, hydraulicBoundaryLocationMock.DesignWaterLevelCalculationConvergence);
mockRepository.VerifyAll();
}
[Test]
public void Finish_CalculationAlreadyRan_FinishNotPerformed()
{
// Setup
- var mockRepository = new MockRepository();
- var assessmentSectionStub = mockRepository.Stub();
+ RoundedDouble designWaterLevel = (RoundedDouble) 3.0;
+ const string locationName = "Name";
+ var hydraulicBoundaryLocationMock = mockRepository.StrictMock();
+ hydraulicBoundaryLocationMock.Expect(hbl => hbl.Name).Return(locationName).Repeat.AtLeastOnce();
+ hydraulicBoundaryLocationMock.Expect(hbl => hbl.DesignWaterLevel).Return(designWaterLevel).Repeat.AtLeastOnce();
+
+ var calculationMessageProviderMock = mockRepository.StrictMock();
+ calculationMessageProviderMock.Expect(calc => calc.GetActivityName(locationName)).Return("");
mockRepository.ReplayAll();
- ImportHydraulicBoundaryDatabase(assessmentSectionStub, validFile);
+ string validFilePath = Path.Combine(testDataPath, validFile);
- RoundedDouble designWaterLevel = (RoundedDouble) 3.0;
- var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "test", 1, 1)
- {
- DesignWaterLevel = designWaterLevel
- };
+ var activity = new DesignWaterLevelCalculationActivity(calculationMessageProviderMock, hydraulicBoundaryLocationMock, validFilePath, "", 30);
- var activity = new DesignWaterLevelCalculationActivity(hydraulicBoundaryLocation, assessmentSectionStub.HydraulicBoundaryDatabase.FilePath, "", 30);
-
activity.Run();
// Call
activity.Finish();
// Assert
- Assert.AreEqual(designWaterLevel, hydraulicBoundaryLocation.DesignWaterLevel, hydraulicBoundaryLocation.DesignWaterLevel.GetAccuracy());
mockRepository.VerifyAll();
}
-
- private const string validFile = "HRD dutch coast south.sqlite";
-
- private void ImportHydraulicBoundaryDatabase(IAssessmentSection assessmentSection, string fileName)
- {
- string validFilePath = Path.Combine(testDataPath, fileName);
-
- using (var importer = new HydraulicBoundaryDatabaseImporter())
- importer.Import(assessmentSection, validFilePath);
- }
}
}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/DesignWaterLevelCalculationServiceTest.cs
===================================================================
diff -u -r75ac52f6f7e203e77dd212e6c32d68e7e58c28b2 -r06b2840a2bb64c0960c8ac29322b5a0971c73c77
--- Ringtoets/Common/test/Ringtoets.Common.Service.Test/DesignWaterLevelCalculationServiceTest.cs (.../DesignWaterLevelCalculationServiceTest.cs) (revision 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2)
+++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/DesignWaterLevelCalculationServiceTest.cs (.../DesignWaterLevelCalculationServiceTest.cs) (revision 06b2840a2bb64c0960c8ac29322b5a0971c73c77)
@@ -22,13 +22,13 @@
using System;
using System.IO;
using System.Linq;
+using Core.Common.Base.Data;
using Core.Common.TestUtil;
using NUnit.Framework;
using Rhino.Mocks;
-using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Service.MessageProviders;
using Ringtoets.HydraRing.Calculation.Data.Output;
using Ringtoets.HydraRing.Data;
-using Ringtoets.Integration.Plugin.FileImporters;
namespace Ringtoets.Common.Service.Test
{
@@ -39,45 +39,43 @@
private readonly string testDataPath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Integration.Service, "HydraRingCalculation");
[Test]
- public void Validate_ValidHydraulicBoundaryDatabase_ReturnsTrue()
+ public void Validate_ValidHydraulicBoundaryDatabasePath_ReturnsTrue()
{
// Setup
+ const string calculationName = "calculationName";
string validFilePath = Path.Combine(testDataPath, validFile);
bool valid = false;
- var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "test", 1, 1);
// Call
- Action call = () => valid = DesignWaterLevelCalculationService.Validate(hydraulicBoundaryLocation, validFilePath);
+ Action call = () => valid = DesignWaterLevelCalculationService.Validate(calculationName, validFilePath);
// Assert
TestHelper.AssertLogMessages(call, messages =>
{
var msgs = messages.ToArray();
Assert.AreEqual(2, msgs.Length);
- var calculationName = string.Format("Toetspeil voor locatie {0}", hydraulicBoundaryLocation.Name);
StringAssert.StartsWith(string.Format("Validatie van '{0}' gestart om: ", calculationName), msgs[0]);
StringAssert.StartsWith(string.Format("Validatie van '{0}' beëindigd om: ", calculationName), msgs[1]);
});
Assert.IsTrue(valid);
}
[Test]
- public void Validate_InvalidHydraulicBoundaryDatabase_LogsErrorAndReturnsFalse()
+ public void Validate_InvalidHydraulicBoundaryDatabasePath_LogsErrorAndReturnsFalse()
{
// Setup
+ const string calculationName = "calculationName";
string notValidFilePath = Path.Combine(testDataPath, "notexisting.sqlite");
bool valid = false;
- var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "test", 1, 1);
// Call
- Action call = () => valid = DesignWaterLevelCalculationService.Validate(hydraulicBoundaryLocation, notValidFilePath);
+ Action call = () => valid = DesignWaterLevelCalculationService.Validate(calculationName, notValidFilePath);
// Assert
TestHelper.AssertLogMessages(call, messages =>
{
var msgs = messages.ToArray();
Assert.AreEqual(3, msgs.Length);
- var calculationName = string.Format("Toetspeil voor locatie {0}", hydraulicBoundaryLocation.Name);
StringAssert.StartsWith(string.Format("Validatie van '{0}' gestart om: ", calculationName), msgs[0]);
StringAssert.StartsWith("Herstellen van de verbinding met de hydraulische randvoorwaardendatabase is mislukt. Fout bij het lezen van bestand", msgs[1]);
StringAssert.StartsWith(string.Format("Validatie van '{0}' beëindigd om: ", calculationName), msgs[2]);
@@ -86,28 +84,36 @@
}
[Test]
- public void Calculate_ValidHydraulicBoundaryDatabaseAndLocation_LogStartAndEndAndReturnOutput()
+ public void Calculate_ValidHydraulicBoundaryLocation_LogStartAndEndAndReturnOutput()
{
// Setup
+ string validFilePath = Path.Combine(testDataPath, validFile);
+
+ const string locationName = "punt_flw_ 1";
+ const string calculationName = "locationName";
+
var mockRepository = new MockRepository();
- var assessmentSectionStub = mockRepository.Stub();
- mockRepository.ReplayAll();
- ImportHydraulicBoundaryDatabase(assessmentSectionStub);
+ var hydraulicBoundaryLocationMock = mockRepository.Stub();
+ hydraulicBoundaryLocationMock.Expect(hbl => hbl.Id).Return(1300001).Repeat.AtLeastOnce();
+ hydraulicBoundaryLocationMock.Expect(hbl => hbl.Name).Return(locationName).Repeat.AtLeastOnce();
+ hydraulicBoundaryLocationMock.DesignWaterLevel = new RoundedDouble(2, double.NaN);
- var hydraulicBoundaryLocation = assessmentSectionStub.HydraulicBoundaryDatabase.Locations.First(hl => hl.Id == 1300001);
+ var calculationMessageProviderMock = mockRepository.StrictMock();
+ calculationMessageProviderMock.Expect(calc => calc.GetCalculationName(locationName)).Return(calculationName).Repeat.AtLeastOnce();
+ mockRepository.ReplayAll();
ReliabilityIndexCalculationOutput output = null;
// Call
- Action call = () => output = DesignWaterLevelCalculationService.Calculate(
- hydraulicBoundaryLocation, assessmentSectionStub.HydraulicBoundaryDatabase.FilePath, "", 30);
+ Action call = () => output = DesignWaterLevelCalculationService.Calculate(calculationMessageProviderMock,
+ hydraulicBoundaryLocationMock,
+ validFilePath, "", 30);
// Assert
TestHelper.AssertLogMessages(call, messages =>
{
var msgs = messages.ToArray();
Assert.AreEqual(3, msgs.Length);
- var calculationName = string.Format("Toetspeil voor locatie {0}", hydraulicBoundaryLocation.Name);
StringAssert.StartsWith(string.Format("Berekening van '{0}' gestart om: ", calculationName), msgs[0]);
StringAssert.StartsWith("Hydra-Ring berekeningsverslag. Klik op details voor meer informatie.", msgs[1]);
StringAssert.StartsWith(string.Format("Berekening van '{0}' beëindigd om: ", calculationName), msgs[2]);
@@ -117,45 +123,44 @@
}
[Test]
- public void Calculate_ValidHydraulicBoundaryDatabaseInvalidHydraulicBoundaryLocation_LogStartAndEndAndErrorMessageAndReturnNull()
+ public void Calculate_InvalidHydraulicBoundaryLocation_LogStartAndEndAndErrorMessageAndReturnNull()
{
// Setup
+ string validFilePath = Path.Combine(testDataPath, validFile);
+ const string locationName = "locationName";
+ const string calculationName = "locationName";
+ const string calculationFailedMessage = "calculationFailedMessage";
+
var mockRepository = new MockRepository();
- var assessmentSectionStub = mockRepository.Stub();
+ var hydraulicBoundaryLocationMock = mockRepository.Stub();
+ hydraulicBoundaryLocationMock.Expect(hbl => hbl.Id).Return(1).Repeat.AtLeastOnce();
+ hydraulicBoundaryLocationMock.Expect(hbl => hbl.Name).Return(locationName).Repeat.AtLeastOnce();
+ hydraulicBoundaryLocationMock.DesignWaterLevel = new RoundedDouble(2, double.NaN);
+
+ var calculationMessageProviderMock = mockRepository.StrictMock();
+ calculationMessageProviderMock.Expect(calc => calc.GetCalculationName(locationName)).Return(calculationName).Repeat.AtLeastOnce();
+ calculationMessageProviderMock.Expect(calc => calc.GetCalculationFailedMessage(locationName)).Return(calculationFailedMessage).Repeat.AtLeastOnce();
mockRepository.ReplayAll();
- ImportHydraulicBoundaryDatabase(assessmentSectionStub);
- var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "test", 1, 1);
-
ReliabilityIndexCalculationOutput output = null;
// Call
- Action call = () => output = DesignWaterLevelCalculationService.Calculate(
- hydraulicBoundaryLocation, assessmentSectionStub.HydraulicBoundaryDatabase.FilePath, "", 30);
+ Action call = () => output = DesignWaterLevelCalculationService.Calculate(calculationMessageProviderMock,
+ hydraulicBoundaryLocationMock,
+ validFilePath, "", 30);
// Assert
TestHelper.AssertLogMessages(call, messages =>
{
var msgs = messages.ToArray();
Assert.AreEqual(4, msgs.Length);
- var calculationName = string.Format("Toetspeil voor locatie {0}", hydraulicBoundaryLocation.Name);
StringAssert.StartsWith(string.Format("Berekening van '{0}' gestart om: ", calculationName), msgs[0]);
StringAssert.StartsWith("Hydra-Ring berekeningsverslag. Klik op details voor meer informatie.", msgs[1]);
- StringAssert.StartsWith(string.Format("Er is een fout opgetreden tijdens de toetspeil berekening '{0}': inspecteer het logbestand.", hydraulicBoundaryLocation.Name), msgs[2]);
+ StringAssert.StartsWith(calculationFailedMessage, msgs[2]);
StringAssert.StartsWith(string.Format("Berekening van '{0}' beëindigd om: ", calculationName), msgs[3]);
});
Assert.IsNull(output);
mockRepository.VerifyAll();
}
-
- private void ImportHydraulicBoundaryDatabase(IAssessmentSection assessmentSection)
- {
- string validFilePath = Path.Combine(testDataPath, validFile);
-
- using (var importer = new HydraulicBoundaryDatabaseImporter())
- {
- importer.Import(assessmentSection, validFilePath);
- }
- }
}
}
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs
===================================================================
diff -u -r9d0514fdc39bc0b7a908f60e2b3e8e251c04dfaf -r06b2840a2bb64c0960c8ac29322b5a0971c73c77
--- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs (.../GrassCoverErosionOutwardsPlugin.cs) (revision 9d0514fdc39bc0b7a908f60e2b3e8e251c04dfaf)
+++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs (.../GrassCoverErosionOutwardsPlugin.cs) (revision 06b2840a2bb64c0960c8ac29322b5a0971c73c77)
@@ -40,6 +40,7 @@
using Ringtoets.GrassCoverErosionOutwards.Forms.Properties;
using Ringtoets.GrassCoverErosionOutwards.Forms.PropertyClasses;
using Ringtoets.GrassCoverErosionOutwards.Forms.Views;
+using Ringtoets.GrassCoverErosionOutwards.Service.MessageProviders;
using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources;
using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
using RingtoetsCommonIoResources = Ringtoets.Common.IO.Properties.Resources;
@@ -297,6 +298,7 @@
failureMechanism.GeneralInput.N;
hydraulicBoundaryLocationCalculationGuiService.CalculateDesignWaterLevels(
+ new GrassCoverErosionOutwardsDesignWaterLevelCalculationMessageProvider(),
assessmentSection.HydraulicBoundaryDatabase.FilePath,
nodeData.WrappedData,
nodeData.WrappedData,
@@ -324,7 +326,7 @@
{
var designWaterLevelItem = new StrictContextMenuItem(
RingtoetsCommonFormsResources.Calculate_all,
- nodeData.AssessmentSection.HydraulicBoundaryDatabase == null
+ nodeData.AssessmentSection.HydraulicBoundaryDatabase == null
? Resources.GrassCoverErosionOutwards_WaveHeight_No_HRD_To_Calculate
: Resources.GrassCoverErosionOutwards_WaveHeight_Calculate_All_ToolTip,
RingtoetsCommonFormsResources.CalculateAllIcon,
Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/Ringtoets.GrassCoverErosionOutwards.Plugin.csproj
===================================================================
diff -u -r3865311e0dac61da3aa9ca1b4645c16b90290f1e -r06b2840a2bb64c0960c8ac29322b5a0971c73c77
--- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/Ringtoets.GrassCoverErosionOutwards.Plugin.csproj (.../Ringtoets.GrassCoverErosionOutwards.Plugin.csproj) (revision 3865311e0dac61da3aa9ca1b4645c16b90290f1e)
+++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/Ringtoets.GrassCoverErosionOutwards.Plugin.csproj (.../Ringtoets.GrassCoverErosionOutwards.Plugin.csproj) (revision 06b2840a2bb64c0960c8ac29322b5a0971c73c77)
@@ -85,6 +85,11 @@
Ringtoets.Common.IO
False
+
+ {D951D6DA-FE83-4920-9FDB-63BF96480B54}
+ Ringtoets.Common.Service
+ False
+
{70f8cc9c-5bc8-4fb2-b201-eae7fa8088c2}
Ringtoets.HydraRing.Data
@@ -100,6 +105,11 @@
Ringtoets.GrassCoverErosionOutwards.Forms
False
+
+ {18e9f7c8-3170-4e9d-8d9f-1378225eed90}
+ Ringtoets.GrassCoverErosionOutwards.Service
+ False
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ Er is een fout opgetreden tijdens de Waterstand bij doorsnede-eis berekening '{0}': inspecteer het logbestand.
+
+
+ Waterstand bij doorsnede-eis berekening voor locatie {0} is niet geconvergeerd.
+
+
+ Waterstand bij doorsnede-eis berekenen voor locatie '{0}'
+
+
+ Waterstand bij doorsnede-eis voor locatie {0}
+
+
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Service/Ringtoets.GrassCoverErosionOutwards.Service.csproj
===================================================================
diff -u -r8fecdfa8821b91dc919ce64a82ee6056822aab94 -r06b2840a2bb64c0960c8ac29322b5a0971c73c77
--- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Service/Ringtoets.GrassCoverErosionOutwards.Service.csproj (.../Ringtoets.GrassCoverErosionOutwards.Service.csproj) (revision 8fecdfa8821b91dc919ce64a82ee6056822aab94)
+++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Service/Ringtoets.GrassCoverErosionOutwards.Service.csproj (.../Ringtoets.GrassCoverErosionOutwards.Service.csproj) (revision 06b2840a2bb64c0960c8ac29322b5a0971c73c77)
@@ -39,13 +39,37 @@
Properties\GlobalAssembly.cs
+
+
+ True
+ True
+ Resources.resx
+
Copying.licenseheader
+
+
+ {D951D6DA-FE83-4920-9FDB-63BF96480B54}
+ Ringtoets.Common.Service
+ False
+
+
+ {E7225477-577F-4A17-B7EC-6721158E1543}
+ Ringtoets.GrassCoverErosionOutwards.Data
+ False
+
+
+
+
+ PublicResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
+
+
\ No newline at end of file
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj
===================================================================
diff -u -r915001caffacbbee15c0e3bf449072245bc5f509 -r06b2840a2bb64c0960c8ac29322b5a0971c73c77
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision 915001caffacbbee15c0e3bf449072245bc5f509)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision 06b2840a2bb64c0960c8ac29322b5a0971c73c77)
@@ -218,6 +218,11 @@
Ringtoets.Common.IO
False
+
+ {d951d6da-fe83-4920-9fdb-63bf96480b54}
+ Ringtoets.Common.Service
+ False
+
{90de728e-48ef-4665-ab38-3d88e41d9f4d}
Ringtoets.GrassCoverErosionInwards.Data
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/DesignWaterLevelLocationsView.cs
===================================================================
diff -u -r75ac52f6f7e203e77dd212e6c32d68e7e58c28b2 -r06b2840a2bb64c0960c8ac29322b5a0971c73c77
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/DesignWaterLevelLocationsView.cs (.../DesignWaterLevelLocationsView.cs) (revision 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/DesignWaterLevelLocationsView.cs (.../DesignWaterLevelLocationsView.cs) (revision 06b2840a2bb64c0960c8ac29322b5a0971c73c77)
@@ -25,6 +25,7 @@
using Ringtoets.HydraRing.Data;
using Ringtoets.Integration.Forms.PresentationObjects;
using Ringtoets.Integration.Forms.Properties;
+using Ringtoets.Integration.Service.MessageProviders;
namespace Ringtoets.Integration.Forms.Views
{
@@ -57,6 +58,7 @@
return;
}
CalculationGuiService.CalculateDesignWaterLevels(
+ new DesignWaterLevelCalculationMessageProvider(),
AssessmentSection.HydraulicBoundaryDatabase.FilePath,
AssessmentSection.HydraulicBoundaryDatabase,
locations,
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WaveHeightLocationsView.cs
===================================================================
diff -u -r75ac52f6f7e203e77dd212e6c32d68e7e58c28b2 -r06b2840a2bb64c0960c8ac29322b5a0971c73c77
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WaveHeightLocationsView.cs (.../WaveHeightLocationsView.cs) (revision 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WaveHeightLocationsView.cs (.../WaveHeightLocationsView.cs) (revision 06b2840a2bb64c0960c8ac29322b5a0971c73c77)
@@ -25,6 +25,7 @@
using Ringtoets.HydraRing.Data;
using Ringtoets.Integration.Forms.PresentationObjects;
using Ringtoets.Integration.Forms.Properties;
+using Ringtoets.Integration.Service.MessageProviders;
namespace Ringtoets.Integration.Forms.Views
{
@@ -57,6 +58,7 @@
return;
}
CalculationGuiService.CalculateWaveHeights(
+ new WaveHeightCalculationMessageProvider(),
AssessmentSection.HydraulicBoundaryDatabase.FilePath,
AssessmentSection.HydraulicBoundaryDatabase,
locations,
Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs
===================================================================
diff -u -r832fae2b215f8d6165628111b344a0dc03b1f669 -r06b2840a2bb64c0960c8ac29322b5a0971c73c77
--- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 832fae2b215f8d6165628111b344a0dc03b1f669)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 06b2840a2bb64c0960c8ac29322b5a0971c73c77)
@@ -69,6 +69,7 @@
using Ringtoets.Integration.Plugin.FileImporters;
using Ringtoets.Integration.Plugin.Properties;
using Ringtoets.Integration.Service;
+using Ringtoets.Integration.Service.MessageProviders;
using Ringtoets.Piping.Data;
using Ringtoets.Piping.Forms.PresentationObjects;
using Ringtoets.StabilityStoneCover.Data;
@@ -1104,6 +1105,7 @@
IAssessmentSection assessmentSection = nodeData.WrappedData;
hydraulicBoundaryLocationCalculationGuiService.CalculateDesignWaterLevels(
+ new DesignWaterLevelCalculationMessageProvider(),
assessmentSection.HydraulicBoundaryDatabase.FilePath,
assessmentSection.HydraulicBoundaryDatabase,
assessmentSection.HydraulicBoundaryDatabase.Locations,
@@ -1140,6 +1142,7 @@
}
IAssessmentSection assessmentSection = nodeData.WrappedData;
hydraulicBoundaryLocationCalculationGuiService.CalculateWaveHeights(
+ new WaveHeightCalculationMessageProvider(),
assessmentSection.HydraulicBoundaryDatabase.FilePath,
assessmentSection.HydraulicBoundaryDatabase,
assessmentSection.HydraulicBoundaryDatabase.Locations,
Index: Ringtoets/Integration/src/Ringtoets.Integration.Service/MessageProviders/DesignWaterLevelCalculationMessageProvider.cs
===================================================================
diff -u
--- Ringtoets/Integration/src/Ringtoets.Integration.Service/MessageProviders/DesignWaterLevelCalculationMessageProvider.cs (revision 0)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Service/MessageProviders/DesignWaterLevelCalculationMessageProvider.cs (revision 06b2840a2bb64c0960c8ac29322b5a0971c73c77)
@@ -0,0 +1,52 @@
+// 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 Ringtoets.Common.Service.MessageProviders;
+using Ringtoets.Common.Service.Properties;
+
+namespace Ringtoets.Integration.Service.MessageProviders
+{
+ ///
+ /// This class provides messages used during the design water level calculation.
+ ///
+ public class DesignWaterLevelCalculationMessageProvider : ICalculationMessageProvider
+ {
+ public string GetCalculationName(string locationName)
+ {
+ return string.Format(Resources.DesignWaterLevelCalculationService_Name_Assessment_level_for_location_0_, locationName);
+ }
+
+ public string GetActivityName(string locationName)
+ {
+ return string.Format(Resources.DesignWaterLevelCalculationService_Name_Calculate_assessment_level_for_location_0_, locationName);
+ }
+
+ public string GetCalculationFailedMessage(string locationName)
+ {
+ return string.Format(Resources.DesignWaterLevelCalculationService_Calculate_Error_in_design_water_level_0_calculation, locationName);
+ }
+
+ public string GetCalculatedNotConvergedMessage(string locationName)
+ {
+ return string.Format(Resources.DesignWaterLevelCalculationActivity_DesignWaterLevel_calculation_for_location_0_not_converged, locationName);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/src/Ringtoets.Integration.Service/MessageProviders/WaveHeightCalculationMessageProvider.cs
===================================================================
diff -u
--- Ringtoets/Integration/src/Ringtoets.Integration.Service/MessageProviders/WaveHeightCalculationMessageProvider.cs (revision 0)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Service/MessageProviders/WaveHeightCalculationMessageProvider.cs (revision 06b2840a2bb64c0960c8ac29322b5a0971c73c77)
@@ -0,0 +1,52 @@
+// 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 Ringtoets.Common.Service.MessageProviders;
+using Ringtoets.Common.Service.Properties;
+
+namespace Ringtoets.Integration.Service.MessageProviders
+{
+ ///
+ /// This class provides messages used during the wave height calculation.
+ ///
+ public class WaveHeightCalculationMessageProvider : ICalculationMessageProvider
+ {
+ public string GetCalculationName(string locationName)
+ {
+ return string.Format(Resources.WaveHeightCalculationService_Name_Calculate_wave_height_for_location_0_, locationName);
+ }
+
+ public string GetActivityName(string locationName)
+ {
+ return string.Format(Resources.WaveHeightCalculationService_Name_Calculate_wave_height_for_location_0_, locationName);
+ }
+
+ public string GetCalculationFailedMessage(string locationName)
+ {
+ return string.Format(Resources.WaveHeightCalculationService_Calculate_Error_in_wave_height_0_calculation, locationName);
+ }
+
+ public string GetCalculatedNotConvergedMessage(string locationName)
+ {
+ return string.Format(Resources.WaveHeightCalculationActivity_WaveHeight_calculation_for_location_0_not_converged, locationName);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/src/Ringtoets.Integration.Service/Ringtoets.Integration.Service.csproj
===================================================================
diff -u -r915001caffacbbee15c0e3bf449072245bc5f509 -r06b2840a2bb64c0960c8ac29322b5a0971c73c77
--- Ringtoets/Integration/src/Ringtoets.Integration.Service/Ringtoets.Integration.Service.csproj (.../Ringtoets.Integration.Service.csproj) (revision 915001caffacbbee15c0e3bf449072245bc5f509)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Service/Ringtoets.Integration.Service.csproj (.../Ringtoets.Integration.Service.csproj) (revision 06b2840a2bb64c0960c8ac29322b5a0971c73c77)
@@ -39,6 +39,8 @@
Properties\GlobalAssembly.cs
+
+
@@ -53,6 +55,11 @@
Ringtoets.Common.Data
False
+
+ {D951D6DA-FE83-4920-9FDB-63BF96480B54}
+ Ringtoets.Common.Service
+ False
+
{90DE728E-48EF-4665-AB38-3D88E41D9F4D}
Ringtoets.GrassCoverErosionInwards.Data
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj
===================================================================
diff -u -r3865311e0dac61da3aa9ca1b4645c16b90290f1e -r06b2840a2bb64c0960c8ac29322b5a0971c73c77
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 3865311e0dac61da3aa9ca1b4645c16b90290f1e)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 06b2840a2bb64c0960c8ac29322b5a0971c73c77)
@@ -214,6 +214,10 @@
{52ba7627-cbab-4209-be77-3b5f31378277}
Ringtoets.Common.IO
+
+ {d951d6da-fe83-4920-9fdb-63bf96480b54}
+ Ringtoets.Common.Service
+
{4843D6E5-066F-4795-94F5-1D53932DD03C}
Ringtoets.Common.Data.TestUtil
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/DesignWaterLevelLocationsViewTest.cs
===================================================================
diff -u -r75ac52f6f7e203e77dd212e6c32d68e7e58c28b2 -r06b2840a2bb64c0960c8ac29322b5a0971c73c77
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/DesignWaterLevelLocationsViewTest.cs (.../DesignWaterLevelLocationsViewTest.cs) (revision 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/DesignWaterLevelLocationsViewTest.cs (.../DesignWaterLevelLocationsViewTest.cs) (revision 06b2840a2bb64c0960c8ac29322b5a0971c73c77)
@@ -216,8 +216,8 @@
var guiServiceMock = mockRepository.StrictMock();
IEnumerable locations = null;
- guiServiceMock.Expect(ch => ch.CalculateDesignWaterLevels(null, null, null, null, 1)).IgnoreArguments().WhenCalled(
- invocation => { locations = (IEnumerable) invocation.Arguments[2]; });
+ guiServiceMock.Expect(ch => ch.CalculateDesignWaterLevels(null, null, null, null, null, 1)).IgnoreArguments().WhenCalled(
+ invocation => { locations = (IEnumerable) invocation.Arguments[3]; });
mockRepository.ReplayAll();
view.CalculationGuiService = guiServiceMock;
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/WaveHeightLocationsViewTest.cs
===================================================================
diff -u -r75ac52f6f7e203e77dd212e6c32d68e7e58c28b2 -r06b2840a2bb64c0960c8ac29322b5a0971c73c77
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/WaveHeightLocationsViewTest.cs (.../WaveHeightLocationsViewTest.cs) (revision 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/WaveHeightLocationsViewTest.cs (.../WaveHeightLocationsViewTest.cs) (revision 06b2840a2bb64c0960c8ac29322b5a0971c73c77)
@@ -212,8 +212,8 @@
var guiServiceMock = mockRepository.StrictMock();
IEnumerable locations = null;
- guiServiceMock.Expect(ch => ch.CalculateWaveHeights(null, null, null, null, 1)).IgnoreArguments().WhenCalled(
- invocation => { locations = (IEnumerable) invocation.Arguments[2]; });
+ guiServiceMock.Expect(ch => ch.CalculateWaveHeights(null, null, null, null, null, 1)).IgnoreArguments().WhenCalled(
+ invocation => { locations = (IEnumerable) invocation.Arguments[3]; });
mockRepository.ReplayAll();
view.CalculationGuiService = guiServiceMock;
Index: Ringtoets/Integration/test/Ringtoets.Integration.Service.Test/MessageProviders/DesignWaterLevelCalculationMessageProviderTest.cs
===================================================================
diff -u
--- Ringtoets/Integration/test/Ringtoets.Integration.Service.Test/MessageProviders/DesignWaterLevelCalculationMessageProviderTest.cs (revision 0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Service.Test/MessageProviders/DesignWaterLevelCalculationMessageProviderTest.cs (revision 06b2840a2bb64c0960c8ac29322b5a0971c73c77)
@@ -0,0 +1,110 @@
+// 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 NUnit.Framework;
+using Ringtoets.Common.Service.MessageProviders;
+using Ringtoets.Common.Service.Properties;
+using Ringtoets.Integration.Service.MessageProviders;
+
+namespace Ringtoets.Integration.Service.Test.MessageProviders
+{
+ [TestFixture]
+ public class DesignWaterLevelCalculationMessageProviderTest
+ {
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Setup & Call
+ var provider = new DesignWaterLevelCalculationMessageProvider();
+
+ // Assert
+ Assert.IsInstanceOf(provider);
+ }
+
+ [Test]
+ [TestCase(null)]
+ [TestCase("")]
+ [TestCase("value")]
+ public void GetCalculationName_VariousParameters_ReturnsExpectedValue(string name)
+ {
+ // Setup
+ var provider = new DesignWaterLevelCalculationMessageProvider();
+
+ // Call
+ var calculationName = provider.GetCalculationName(name);
+
+ // Assert
+ var expectedName = string.Format(Resources.DesignWaterLevelCalculationService_Name_Assessment_level_for_location_0_, name);
+ Assert.AreEqual(expectedName, calculationName);
+ }
+
+ [Test]
+ [TestCase(null)]
+ [TestCase("")]
+ [TestCase("value")]
+ public void GetActivityName_VariousParameters_ReturnsExpectedValue(string name)
+ {
+ // Setup
+ var provider = new DesignWaterLevelCalculationMessageProvider();
+
+ // Call
+ var activityName = provider.GetActivityName(name);
+
+ // Assert
+ var expectedName = string.Format(Resources.DesignWaterLevelCalculationService_Name_Calculate_assessment_level_for_location_0_, name);
+ Assert.AreEqual(expectedName, activityName);
+ }
+
+ [Test]
+ [TestCase(null)]
+ [TestCase("")]
+ [TestCase("value")]
+ public void GetCalculationFailedMessage_VariousParameters_ReturnsExpectedValue(string name)
+ {
+ // Setup
+ var provider = new DesignWaterLevelCalculationMessageProvider();
+
+ // Call
+ var message = provider.GetCalculationFailedMessage(name);
+
+ // Assert
+ var expectedMessage = string.Format(Resources.DesignWaterLevelCalculationService_Calculate_Error_in_design_water_level_0_calculation, name);
+ Assert.AreEqual(expectedMessage, message);
+ }
+
+ [Test]
+ [TestCase(null)]
+ [TestCase("")]
+ [TestCase("value")]
+ public void GetCalculatedNotConvergedMessage_VariousParameters_ReturnsExpectedValue(string name)
+ {
+ // Setup
+ var provider = new DesignWaterLevelCalculationMessageProvider();
+
+ // Call
+ var message = provider.GetCalculatedNotConvergedMessage(name);
+
+ // Assert
+ var expectedMessage = string.Format(Resources.DesignWaterLevelCalculationActivity_DesignWaterLevel_calculation_for_location_0_not_converged, name);
+ Assert.AreEqual(expectedMessage, message);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.Service.Test/MessageProviders/WaveHeightCalculationMessageProviderTest.cs
===================================================================
diff -u
--- Ringtoets/Integration/test/Ringtoets.Integration.Service.Test/MessageProviders/WaveHeightCalculationMessageProviderTest.cs (revision 0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Service.Test/MessageProviders/WaveHeightCalculationMessageProviderTest.cs (revision 06b2840a2bb64c0960c8ac29322b5a0971c73c77)
@@ -0,0 +1,110 @@
+// 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 NUnit.Framework;
+using Ringtoets.Common.Service.MessageProviders;
+using Ringtoets.Common.Service.Properties;
+using Ringtoets.Integration.Service.MessageProviders;
+
+namespace Ringtoets.Integration.Service.Test.MessageProviders
+{
+ [TestFixture]
+ public class WaveHeightCalculationMessageProviderTest
+ {
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Setup & Call
+ var provider = new WaveHeightCalculationMessageProvider();
+
+ // Assert
+ Assert.IsInstanceOf(provider);
+ }
+
+ [Test]
+ [TestCase(null)]
+ [TestCase("")]
+ [TestCase("value")]
+ public void GetCalculationName_VariousParameters_ReturnsExpectedValue(string name)
+ {
+ // Setup
+ var provider = new WaveHeightCalculationMessageProvider();
+
+ // Call
+ var calculationName = provider.GetCalculationName(name);
+
+ // Assert
+ var expectedName = string.Format(Resources.WaveHeightCalculationService_Name_Calculate_wave_height_for_location_0_, name);
+ Assert.AreEqual(expectedName, calculationName);
+ }
+
+ [Test]
+ [TestCase(null)]
+ [TestCase("")]
+ [TestCase("value")]
+ public void GetActivityName_VariousParameters_ReturnsExpectedValue(string name)
+ {
+ // Setup
+ var provider = new WaveHeightCalculationMessageProvider();
+
+ // Call
+ var activityName = provider.GetActivityName(name);
+
+ // Assert
+ var expectedName = string.Format(Resources.WaveHeightCalculationService_Name_Calculate_wave_height_for_location_0_, name);
+ Assert.AreEqual(expectedName, activityName);
+ }
+
+ [Test]
+ [TestCase(null)]
+ [TestCase("")]
+ [TestCase("value")]
+ public void GetCalculationFailedMessage_VariousParameters_ReturnsExpectedValue(string name)
+ {
+ // Setup
+ var provider = new WaveHeightCalculationMessageProvider();
+
+ // Call
+ var message = provider.GetCalculationFailedMessage(name);
+
+ // Assert
+ var expectedMessage = string.Format(Resources.WaveHeightCalculationService_Calculate_Error_in_wave_height_0_calculation, name);
+ Assert.AreEqual(expectedMessage, message);
+ }
+
+ [Test]
+ [TestCase(null)]
+ [TestCase("")]
+ [TestCase("value")]
+ public void GetCalculatedNotConvergedMessage_VariousParameters_ReturnsExpectedValue(string name)
+ {
+ // Setup
+ var provider = new WaveHeightCalculationMessageProvider();
+
+ // Call
+ var message = provider.GetCalculatedNotConvergedMessage(name);
+
+ // Assert
+ var expectedMessage = string.Format(Resources.WaveHeightCalculationActivity_WaveHeight_calculation_for_location_0_not_converged, name);
+ Assert.AreEqual(expectedMessage, message);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.Service.Test/Ringtoets.Integration.Service.Test.csproj
===================================================================
diff -u -r915001caffacbbee15c0e3bf449072245bc5f509 -r06b2840a2bb64c0960c8ac29322b5a0971c73c77
--- Ringtoets/Integration/test/Ringtoets.Integration.Service.Test/Ringtoets.Integration.Service.Test.csproj (.../Ringtoets.Integration.Service.Test.csproj) (revision 915001caffacbbee15c0e3bf449072245bc5f509)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Service.Test/Ringtoets.Integration.Service.Test.csproj (.../Ringtoets.Integration.Service.Test.csproj) (revision 06b2840a2bb64c0960c8ac29322b5a0971c73c77)
@@ -54,6 +54,8 @@
Properties\GlobalAssembly.cs
+
+
@@ -72,6 +74,10 @@
{D4200F43-3F72-4F42-AF0A-8CED416A38EC}
Ringtoets.Common.Data
+
+ {d951d6da-fe83-4920-9fdb-63bf96480b54}
+ Ringtoets.Common.Service
+
{90DE728E-48EF-4665-AB38-3D88E41D9F4D}
Ringtoets.GrassCoverErosionInwards.Data