Index: Ringtoets/Common/src/Ringtoets.Common.Forms/GuiServices/HydraulicBoundaryLocationCalculationGuiService.cs =================================================================== diff -u -r915001caffacbbee15c0e3bf449072245bc5f509 -r75ac52f6f7e203e77dd212e6c32d68e7e58c28b2 --- Ringtoets/Common/src/Ringtoets.Common.Forms/GuiServices/HydraulicBoundaryLocationCalculationGuiService.cs (.../HydraulicBoundaryLocationCalculationGuiService.cs) (revision 915001caffacbbee15c0e3bf449072245bc5f509) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/GuiServices/HydraulicBoundaryLocationCalculationGuiService.cs (.../HydraulicBoundaryLocationCalculationGuiService.cs) (revision 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2) @@ -23,13 +23,14 @@ using System.Collections.Generic; using System.Linq; using System.Windows.Forms; +using Core.Common.Base; using Core.Common.Base.Service; using Core.Common.Gui.Forms.ProgressDialog; using log4net; +using Ringtoets.Common.Forms.Properties; using Ringtoets.Common.Service; using Ringtoets.HydraRing.Data; using Ringtoets.HydraRing.IO; -using Ringtoets.Common.Forms.Properties; namespace Ringtoets.Common.Forms.GuiServices { @@ -55,52 +56,51 @@ this.viewParent = viewParent; } - public void CalculateDesignWaterLevels(HydraulicBoundaryDatabase hydraulicBoundaryDatabase, - IEnumerable locations, string ringId, int norm) + public void CalculateDesignWaterLevels(string hydraulicBoundaryDatabasePath, IObservable observable, + IEnumerable locations, string ringId, double norm) { - if (hydraulicBoundaryDatabase == null) + if (observable == null) { - throw new ArgumentNullException("hydraulicBoundaryDatabase"); + throw new ArgumentNullException("observable"); } if (locations == null) { throw new ArgumentNullException("locations"); } var activities = locations.Select(hbl => new DesignWaterLevelCalculationActivity(hbl, - hydraulicBoundaryDatabase.FilePath, + hydraulicBoundaryDatabasePath, ringId, norm)).ToArray(); - RunActivities(hydraulicBoundaryDatabase, activities); + RunActivities(hydraulicBoundaryDatabasePath, activities, observable); } - public void CalculateWaveHeights(HydraulicBoundaryDatabase hydraulicBoundaryDatabase, - IEnumerable locations, string ringId, int norm) + public void CalculateWaveHeights(string hydraulicBoundaryDatabasePath, IObservable observable, + IEnumerable locations, string ringId, double norm) { - if (hydraulicBoundaryDatabase == null) + if (observable == null) { - throw new ArgumentNullException("hydraulicBoundaryDatabase"); + throw new ArgumentNullException("observable"); } if (locations == null) { throw new ArgumentNullException("locations"); } var activities = locations.Select(hbl => new WaveHeightCalculationActivity(hbl, - hydraulicBoundaryDatabase.FilePath, + hydraulicBoundaryDatabasePath, ringId, norm)).ToArray(); - RunActivities(hydraulicBoundaryDatabase, activities); + RunActivities(hydraulicBoundaryDatabasePath, activities, observable); } - private void RunActivities(HydraulicBoundaryDatabase hydraulicBoundaryDatabase, - IList activities) where TActivity : Activity + private void RunActivities(string hydraulicBoundaryDatabasePath, + IList activities, IObservable observable) where TActivity : Activity { - var hrdFile = hydraulicBoundaryDatabase.FilePath; - var validationProblem = HydraulicDatabaseHelper.ValidatePathForCalculation(hrdFile); + var validationProblem = HydraulicDatabaseHelper.ValidatePathForCalculation(hydraulicBoundaryDatabasePath); if (string.IsNullOrEmpty(validationProblem)) { ActivityProgressDialogRunner.Run(viewParent, activities); - hydraulicBoundaryDatabase.NotifyObservers(); + observable.NotifyObservers(); } else { Index: Ringtoets/Common/src/Ringtoets.Common.Forms/GuiServices/IHydraulicBoundaryLocationCalculationGuiService.cs =================================================================== diff -u -r915001caffacbbee15c0e3bf449072245bc5f509 -r75ac52f6f7e203e77dd212e6c32d68e7e58c28b2 --- Ringtoets/Common/src/Ringtoets.Common.Forms/GuiServices/IHydraulicBoundaryLocationCalculationGuiService.cs (.../IHydraulicBoundaryLocationCalculationGuiService.cs) (revision 915001caffacbbee15c0e3bf449072245bc5f509) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/GuiServices/IHydraulicBoundaryLocationCalculationGuiService.cs (.../IHydraulicBoundaryLocationCalculationGuiService.cs) (revision 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2) @@ -21,6 +21,7 @@ using System; using System.Collections.Generic; +using Core.Common.Base; using Ringtoets.HydraRing.Data; namespace Ringtoets.Common.Forms.GuiServices @@ -34,27 +35,29 @@ /// /// Performs the calculation for all . /// - /// The hydraulic boundaries database. - /// The objects to calculate + /// 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(HydraulicBoundaryDatabase hydraulicBoundaryDatabase, - IEnumerable locations, string ringId, int norm); + void CalculateDesignWaterLevels(string hydraulicBoundaryDatabasePath, IObservable observable, + IEnumerable locations, string ringId, double norm); /// /// Performs the calculation for all . /// - /// The hydraulic boundaries database. - /// The objects to calculate + /// 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(HydraulicBoundaryDatabase hydraulicBoundaryDatabase, - IEnumerable locations, string ringId, int norm); + void CalculateWaveHeights(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 -r915001caffacbbee15c0e3bf449072245bc5f509 -r75ac52f6f7e203e77dd212e6c32d68e7e58c28b2 --- Ringtoets/Common/src/Ringtoets.Common.Service/DesignWaterLevelCalculationActivity.cs (.../DesignWaterLevelCalculationActivity.cs) (revision 915001caffacbbee15c0e3bf449072245bc5f509) +++ Ringtoets/Common/src/Ringtoets.Common.Service/DesignWaterLevelCalculationActivity.cs (.../DesignWaterLevelCalculationActivity.cs) (revision 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2) @@ -37,20 +37,20 @@ public class DesignWaterLevelCalculationActivity : HydraRingActivity { private static readonly ILog log = LogManager.GetLogger(typeof(DesignWaterLevelCalculationActivity)); - private readonly HydraulicBoundaryLocation hydraulicBoundaryLocation; - private readonly int norm; + private readonly IHydraulicBoundaryLocation hydraulicBoundaryLocation; + private readonly double norm; private readonly string hydraulicBoundaryDatabaseFilePath; private readonly string ringId; /// /// Creates a new instance of . /// - /// The to perform the calculation for. + /// 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(HydraulicBoundaryLocation hydraulicBoundaryLocation, string hydraulicBoundaryDatabaseFilePath, string ringId, int norm) + public DesignWaterLevelCalculationActivity(IHydraulicBoundaryLocation hydraulicBoundaryLocation, string hydraulicBoundaryDatabaseFilePath, string ringId, double norm) { if (hydraulicBoundaryLocation == null) { Index: Ringtoets/Common/src/Ringtoets.Common.Service/DesignWaterLevelCalculationService.cs =================================================================== diff -u -r5cdaf6a62202805aa0abe5636e372a66b1bec723 -r75ac52f6f7e203e77dd212e6c32d68e7e58c28b2 --- Ringtoets/Common/src/Ringtoets.Common.Service/DesignWaterLevelCalculationService.cs (.../DesignWaterLevelCalculationService.cs) (revision 5cdaf6a62202805aa0abe5636e372a66b1bec723) +++ Ringtoets/Common/src/Ringtoets.Common.Service/DesignWaterLevelCalculationService.cs (.../DesignWaterLevelCalculationService.cs) (revision 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2) @@ -43,10 +43,10 @@ /// 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 for which to validate the values. /// 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(HydraulicBoundaryLocation hydraulicBoundaryLocation, string hydraulicBoundaryDatabaseFilePath) + internal static bool Validate(IHydraulicBoundaryLocation hydraulicBoundaryLocation, string hydraulicBoundaryDatabaseFilePath) { var calculationName = string.Format(Resources.DesignWaterLevelCalculationService_Name_Assessment_level_for_location_0_, hydraulicBoundaryLocation.Name); CalculationServiceHelper.LogValidationBeginTime(calculationName); @@ -66,16 +66,16 @@ } /// - /// Performs a design water level calculation based on the supplied and returns the result + /// 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 to perform the calculation for. + /// 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(HydraulicBoundaryLocation hydraulicBoundaryLocation, string hydraulicBoundaryDatabaseFilePath, - string ringId, int norm) + internal static ReliabilityIndexCalculationOutput Calculate(IHydraulicBoundaryLocation hydraulicBoundaryLocation, string hydraulicBoundaryDatabaseFilePath, + string ringId, double norm) { var hlcdDirectory = Path.GetDirectoryName(hydraulicBoundaryDatabaseFilePath); var input = CreateInput(hydraulicBoundaryLocation, norm); @@ -110,7 +110,7 @@ } } - private static AssessmentLevelCalculationInput CreateInput(HydraulicBoundaryLocation hydraulicBoundaryLocation, int norm) + private static AssessmentLevelCalculationInput CreateInput(IHydraulicBoundaryLocation hydraulicBoundaryLocation, double norm) { return new AssessmentLevelCalculationInput(1, hydraulicBoundaryLocation.Id, norm); } Index: Ringtoets/Common/src/Ringtoets.Common.Service/WaveHeightCalculationActivity.cs =================================================================== diff -u -r915001caffacbbee15c0e3bf449072245bc5f509 -r75ac52f6f7e203e77dd212e6c32d68e7e58c28b2 --- Ringtoets/Common/src/Ringtoets.Common.Service/WaveHeightCalculationActivity.cs (.../WaveHeightCalculationActivity.cs) (revision 915001caffacbbee15c0e3bf449072245bc5f509) +++ Ringtoets/Common/src/Ringtoets.Common.Service/WaveHeightCalculationActivity.cs (.../WaveHeightCalculationActivity.cs) (revision 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2) @@ -37,20 +37,20 @@ public class WaveHeightCalculationActivity : HydraRingActivity { private static readonly ILog log = LogManager.GetLogger(typeof(WaveHeightCalculationActivity)); - private readonly HydraulicBoundaryLocation hydraulicBoundaryLocation; - private readonly int norm; + private readonly IHydraulicBoundaryLocation hydraulicBoundaryLocation; + private readonly double norm; private readonly string hydraulicBoundaryDatabaseFilePath; private readonly string ringId; /// /// Creates a new instance of . /// - /// The to perform the calculation for. + /// 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 WaveHeightCalculationActivity(HydraulicBoundaryLocation hydraulicBoundaryLocation, string hydraulicBoundaryDatabaseFilePath, string ringId, int norm) + public WaveHeightCalculationActivity(IHydraulicBoundaryLocation hydraulicBoundaryLocation, string hydraulicBoundaryDatabaseFilePath, string ringId, double norm) { if (hydraulicBoundaryLocation == null) { Index: Ringtoets/Common/src/Ringtoets.Common.Service/WaveHeightCalculationService.cs =================================================================== diff -u -r5cdaf6a62202805aa0abe5636e372a66b1bec723 -r75ac52f6f7e203e77dd212e6c32d68e7e58c28b2 --- Ringtoets/Common/src/Ringtoets.Common.Service/WaveHeightCalculationService.cs (.../WaveHeightCalculationService.cs) (revision 5cdaf6a62202805aa0abe5636e372a66b1bec723) +++ Ringtoets/Common/src/Ringtoets.Common.Service/WaveHeightCalculationService.cs (.../WaveHeightCalculationService.cs) (revision 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2) @@ -43,10 +43,10 @@ /// 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 for which to validate the values. /// 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(HydraulicBoundaryLocation hydraulicBoundaryLocation, string hydraulicBoundaryDatabaseFilePath) + internal static bool Validate(IHydraulicBoundaryLocation hydraulicBoundaryLocation, string hydraulicBoundaryDatabaseFilePath) { var calculationName = string.Format(Resources.WaveHeightCalculationService_Name_Wave_height_for_location_0_, hydraulicBoundaryLocation.Name); CalculationServiceHelper.LogValidationBeginTime(calculationName); @@ -66,16 +66,16 @@ } /// - /// Performs a wave height calculation based on the supplied and returns the result + /// Performs a wave height 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 to perform the calculation for. + /// 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(HydraulicBoundaryLocation hydraulicBoundaryLocation, string hydraulicBoundaryDatabaseFilePath, - string ringId, int norm) + internal static ReliabilityIndexCalculationOutput Calculate(IHydraulicBoundaryLocation hydraulicBoundaryLocation, string hydraulicBoundaryDatabaseFilePath, + string ringId, double norm) { var hlcdDirectory = Path.GetDirectoryName(hydraulicBoundaryDatabaseFilePath); var input = CreateInput(hydraulicBoundaryLocation, norm); @@ -110,7 +110,7 @@ } } - private static WaveHeightCalculationInput CreateInput(HydraulicBoundaryLocation hydraulicBoundaryLocation, int norm) + private static WaveHeightCalculationInput CreateInput(IHydraulicBoundaryLocation hydraulicBoundaryLocation, double norm) { return new WaveHeightCalculationInput(1, hydraulicBoundaryLocation.Id, norm); } Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/GuiServices/HydraulicBoundaryLocationGuiServiceTest.cs =================================================================== diff -u -r915001caffacbbee15c0e3bf449072245bc5f509 -r75ac52f6f7e203e77dd212e6c32d68e7e58c28b2 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/GuiServices/HydraulicBoundaryLocationGuiServiceTest.cs (.../HydraulicBoundaryLocationGuiServiceTest.cs) (revision 915001caffacbbee15c0e3bf449072245bc5f509) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/GuiServices/HydraulicBoundaryLocationGuiServiceTest.cs (.../HydraulicBoundaryLocationGuiServiceTest.cs) (revision 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2) @@ -73,7 +73,7 @@ } [Test] - public void CalculateDesignWaterLevels_NullHydraulicBoundaryDatabase_ThrowsArgumentNullException() + public void CalculateDesignWaterLevels_NullObservable_ThrowsArgumentNullException() { // Setup var locations = Enumerable.Empty(); @@ -82,11 +82,11 @@ var guiService = new HydraulicBoundaryLocationCalculationGuiService(viewParent); // Call - TestDelegate test = () => guiService.CalculateDesignWaterLevels(null, locations, "", 1); + TestDelegate test = () => guiService.CalculateDesignWaterLevels("", null, locations, "", 1); // Assert string paramName = Assert.Throws(test).ParamName; - const string expectedParamName = "hydraulicBoundaryDatabase"; + const string expectedParamName = "observable"; Assert.AreEqual(expectedParamName, paramName); } } @@ -95,44 +95,40 @@ public void CalculateDesignWaterLevels_NullLocations_ThrowsArgumentNullException() { // Setup - var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + var observableMock = 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(hydraulicBoundaryDatabase, null, "", 1); + TestDelegate test = () => guiService.CalculateDesignWaterLevels(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 hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase - { - FilePath = "Does not exist" - }; - - var observerMock = mockRepository.StrictMock(); + var observableMock = mockRepository.StrictMock(); mockRepository.ReplayAll(); - - hydraulicBoundaryDatabase.Attach(observerMock); - + 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(hydraulicBoundaryDatabase, locations, "", 1); + Action call = () => guiService.CalculateDesignWaterLevels(databasePath, observableMock, locations, "", 1); // Assert TestHelper.AssertLogMessages(call, messages => @@ -149,18 +145,12 @@ public void CalculateDesignWaterLevels_ValidPathEmptyList_NotifyObserversButNoLog() { // Setup - string validFilePath = Path.Combine(testDataPath, "HRD dutch coast south.sqlite"); - var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase - { - FilePath = validFilePath - }; + string validDatabasePath = Path.Combine(testDataPath, "HRD dutch coast south.sqlite"); - var observerMock = mockRepository.StrictMock(); - observerMock.Expect(o => o.UpdateObserver()); + var observableMock = mockRepository.StrictMock(); + observableMock.NotifyObservers(); mockRepository.ReplayAll(); - hydraulicBoundaryDatabase.Attach(observerMock); - DialogBoxHandler = (name, wnd) => { // Expect an activity dialog which is automatically closed @@ -172,7 +162,7 @@ var guiService = new HydraulicBoundaryLocationCalculationGuiService(viewParent); // Call - Action call = () => guiService.CalculateDesignWaterLevels(hydraulicBoundaryDatabase, locations, "", 1); + Action call = () => guiService.CalculateDesignWaterLevels(validDatabasePath, observableMock, locations, "", 1); // Assert TestHelper.AssertLogMessagesCount(call, 0); @@ -184,18 +174,12 @@ public void CalculateDesignWaterLevels_ValidPathOneLocationInTheList_NotifyObserversAndLogsMessages() { // Setup - string validFilePath = Path.Combine(testDataPath, "HRD dutch coast south.sqlite"); - var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase - { - FilePath = validFilePath - }; + string validDatabasePath = Path.Combine(testDataPath, "HRD dutch coast south.sqlite"); - var observerMock = mockRepository.StrictMock(); - observerMock.Expect(o => o.UpdateObserver()); + var observableMock = mockRepository.StrictMock(); + observableMock.NotifyObservers(); mockRepository.ReplayAll(); - hydraulicBoundaryDatabase.Attach(observerMock); - DialogBoxHandler = (name, wnd) => { // Expect an activity dialog which is automatically closed @@ -211,7 +195,7 @@ var guiService = new HydraulicBoundaryLocationCalculationGuiService(viewParent); // Call - Action call = () => guiService.CalculateDesignWaterLevels(hydraulicBoundaryDatabase, locations, "", 1); + Action call = () => guiService.CalculateDesignWaterLevels(validDatabasePath, observableMock, locations, "", 1); // Assert TestHelper.AssertLogMessages(call, messages => @@ -230,7 +214,7 @@ } [Test] - public void CalculateWaveHeights_NullHydraulicBoundaryDatabase_ThrowsArgumentNullException() + public void CalculateWaveHeights_NullObservable_ThrowsArgumentNullException() { // Setup var locations = Enumerable.Empty(); @@ -240,11 +224,11 @@ var guiService = new HydraulicBoundaryLocationCalculationGuiService(viewParent); // Call - TestDelegate test = () => guiService.CalculateWaveHeights(null, locations, "", 1); + TestDelegate test = () => guiService.CalculateWaveHeights("", null, locations, "", 1); // Assert string paramName = Assert.Throws(test).ParamName; - const string expectedParamName = "hydraulicBoundaryDatabase"; + const string expectedParamName = "observable"; Assert.AreEqual(expectedParamName, paramName); } } @@ -253,14 +237,16 @@ public void CalculateWaveHeights_NullLocations_ThrowsArgumentNullException() { // Setup - var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + var observableMock = 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(hydraulicBoundaryDatabase, null, "", 1); + TestDelegate test = () => guiService.CalculateWaveHeights(databasePath, observableMock, null, "", 1); // Assert string paramName = Assert.Throws(test).ParamName; @@ -273,14 +259,9 @@ public void CalculateWaveHeights_HydraulicDatabaseDoesNotExist_LogsErrorAndDoesNotNotifyObservers() { // Setup - var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase - { - FilePath = "Does not exist" - }; - - var observerMock = mockRepository.StrictMock(); + var observableMock = mockRepository.StrictMock(); mockRepository.ReplayAll(); - hydraulicBoundaryDatabase.Attach(observerMock); + const string databasePath = "Does not exist"; var locations = Enumerable.Empty(); @@ -289,7 +270,7 @@ var guiService = new HydraulicBoundaryLocationCalculationGuiService(viewParent); // Call - Action call = () => guiService.CalculateWaveHeights(hydraulicBoundaryDatabase, locations, "", 1); + Action call = () => guiService.CalculateWaveHeights(databasePath, observableMock, locations, "", 1); // Assert TestHelper.AssertLogMessages(call, messages => @@ -306,18 +287,12 @@ public void CalculateWaveHeights_ValidPathEmptyList_NotifyObserversButNoLog() { // Setup - string validFilePath = Path.Combine(testDataPath, "HRD dutch coast south.sqlite"); - var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase - { - FilePath = validFilePath - }; + string validDatabasePath = Path.Combine(testDataPath, "HRD dutch coast south.sqlite"); - var observerMock = mockRepository.StrictMock(); - observerMock.Expect(o => o.UpdateObserver()); + var observableMock = mockRepository.StrictMock(); + observableMock.NotifyObservers(); mockRepository.ReplayAll(); - hydraulicBoundaryDatabase.Attach(observerMock); - DialogBoxHandler = (name, wnd) => { // Expect an activity dialog which is automatically closed @@ -330,7 +305,7 @@ var guiService = new HydraulicBoundaryLocationCalculationGuiService(viewParent); // Call - Action call = () => guiService.CalculateWaveHeights(hydraulicBoundaryDatabase, locations, "", 1); + Action call = () => guiService.CalculateWaveHeights(validDatabasePath, observableMock, locations, "", 1); // Assert TestHelper.AssertLogMessagesCount(call, 0); @@ -342,18 +317,12 @@ public void CalculateWaveHeights_ValidPathOneLocationInTheList_NotifyObserversAndLogsMessages() { // Setup - string validFilePath = Path.Combine(testDataPath, "HRD dutch coast south.sqlite"); - var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase - { - FilePath = validFilePath - }; + string validDatabasePath = Path.Combine(testDataPath, "HRD dutch coast south.sqlite"); - var observerMock = mockRepository.StrictMock(); - observerMock.Expect(o => o.UpdateObserver()); + var observableMock = mockRepository.StrictMock(); + observableMock.NotifyObservers(); mockRepository.ReplayAll(); - hydraulicBoundaryDatabase.Attach(observerMock); - DialogBoxHandler = (name, wnd) => { // Expect an activity dialog which is automatically closed @@ -369,7 +338,7 @@ var guiService = new HydraulicBoundaryLocationCalculationGuiService(viewParent); // Call - Action call = () => guiService.CalculateWaveHeights(hydraulicBoundaryDatabase, locations, "", 1); + Action call = () => guiService.CalculateWaveHeights(validDatabasePath, observableMock, locations, "", 1); // Assert TestHelper.AssertLogMessages(call, messages => Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/DesignWaterLevelCalculationServiceTest.cs =================================================================== diff -u -r915001caffacbbee15c0e3bf449072245bc5f509 -r75ac52f6f7e203e77dd212e6c32d68e7e58c28b2 --- Ringtoets/Common/test/Ringtoets.Common.Service.Test/DesignWaterLevelCalculationServiceTest.cs (.../DesignWaterLevelCalculationServiceTest.cs) (revision 915001caffacbbee15c0e3bf449072245bc5f509) +++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/DesignWaterLevelCalculationServiceTest.cs (.../DesignWaterLevelCalculationServiceTest.cs) (revision 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2) @@ -35,10 +35,9 @@ [TestFixture] public class DesignWaterLevelCalculationServiceTest { + private const string validFile = "HRD dutch coast south.sqlite"; private readonly string testDataPath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Integration.Service, "HydraRingCalculation"); - private readonly string validFile = "HRD dutch coast south.sqlite"; - [Test] public void Validate_ValidHydraulicBoundaryDatabase_ReturnsTrue() { Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/WaveHeightCalculationServiceTest.cs =================================================================== diff -u -r915001caffacbbee15c0e3bf449072245bc5f509 -r75ac52f6f7e203e77dd212e6c32d68e7e58c28b2 --- Ringtoets/Common/test/Ringtoets.Common.Service.Test/WaveHeightCalculationServiceTest.cs (.../WaveHeightCalculationServiceTest.cs) (revision 915001caffacbbee15c0e3bf449072245bc5f509) +++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/WaveHeightCalculationServiceTest.cs (.../WaveHeightCalculationServiceTest.cs) (revision 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2) @@ -35,6 +35,7 @@ [TestFixture] public class WaveHeightCalculationServiceTest { + private const string validFile = "HRD dutch coast south.sqlite"; private readonly string testDataPath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Integration.Service, "HydraRingCalculation"); [Test] @@ -153,8 +154,6 @@ mockRepository.VerifyAll(); } - private const string validFile = "HRD dutch coast south.sqlite"; - private void ImportHydraulicBoundaryDatabase(IAssessmentSection assessmentSection) { string validFilePath = Path.Combine(testDataPath, validFile); Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PresentationObjects/GrassCoverErosionOutwardsDesignWaterLevelLocationContext.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PresentationObjects/GrassCoverErosionOutwardsDesignWaterLevelLocationContext.cs (revision 0) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PresentationObjects/GrassCoverErosionOutwardsDesignWaterLevelLocationContext.cs (revision 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2) @@ -0,0 +1,46 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Core.Common.Base; +using Ringtoets.GrassCoverErosionOutwards.Data; + +namespace Ringtoets.GrassCoverErosionOutwards.Forms.PresentationObjects +{ + /// + /// Presentation object for all data required to configure an instance of + /// with . + /// + public class GrassCoverErosionOutwardsDesignWaterLevelLocationContext : GrassCoverErosionOutwardsHydraulicBoundaryLocationContext + { + /// + /// Creates a new instance of . + /// + /// The which the + /// belongs to. + /// The + /// which the belongs to. + /// Thrown when any input parameter is null. + public GrassCoverErosionOutwardsDesignWaterLevelLocationContext(ObservableList wrappedList, + GrassCoverErosionOutwardsHydraulicBoundaryLocation grassCoverErosionOutwardsHydraulicBoundaryLocation) + : base(wrappedList, grassCoverErosionOutwardsHydraulicBoundaryLocation) {} + } +} \ No newline at end of file Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PresentationObjects/GrassCoverErosionOutwardsDesignWaterLevelLocationsContext.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PresentationObjects/GrassCoverErosionOutwardsDesignWaterLevelLocationsContext.cs (revision 0) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PresentationObjects/GrassCoverErosionOutwardsDesignWaterLevelLocationsContext.cs (revision 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2) @@ -0,0 +1,59 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Core.Common.Base; +using Core.Common.Controls.PresentationObjects; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.GrassCoverErosionOutwards.Data; + +namespace Ringtoets.GrassCoverErosionOutwards.Forms.PresentationObjects +{ + /// + /// Presentation object for all data required to configure an enumeration of + /// for water level at intersection probability calculations. + /// + public class GrassCoverErosionOutwardsDesignWaterLevelLocationsContext : ObservableWrappedObjectContextBase + { + /// + /// Creates a new instance of . + /// + /// The which the + /// belongs to. + /// The grass cover erosion outwards hydraulic boundary locations for this context. + /// Thrown when any input parameter is null. + public GrassCoverErosionOutwardsDesignWaterLevelLocationsContext(IAssessmentSection wrappedAssessmentSection, + ObservableList grassCoverErosionOutwardsHydraulicBoundaryLocations) + : base(wrappedAssessmentSection) + { + if (grassCoverErosionOutwardsHydraulicBoundaryLocations == null) + { + throw new ArgumentNullException("grassCoverErosionOutwardsHydraulicBoundaryLocations"); + } + Locations = grassCoverErosionOutwardsHydraulicBoundaryLocations; + } + + /// + /// Gets the grass cover erosion outwards hydraulic boundary locations. + /// + public ObservableList Locations { get; private set; } + } +} \ No newline at end of file Fisheye: Tag 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2 refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PresentationObjects/GrassCoverErosionOutwardsWaterLevelLocationContext.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2 refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PresentationObjects/GrassCoverErosionOutwardsWaterLevelLocationsContext.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PropertyClasses/GrassCoverErosionOutwardsDesignWaterLevelLocationsContextProperties.cs =================================================================== diff -u -r4f5e140bd0d2891988a862ff4c5749a7991a12b0 -r75ac52f6f7e203e77dd212e6c32d68e7e58c28b2 --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PropertyClasses/GrassCoverErosionOutwardsDesignWaterLevelLocationsContextProperties.cs (.../GrassCoverErosionOutwardsDesignWaterLevelLocationsContextProperties.cs) (revision 4f5e140bd0d2891988a862ff4c5749a7991a12b0) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PropertyClasses/GrassCoverErosionOutwardsDesignWaterLevelLocationsContextProperties.cs (.../GrassCoverErosionOutwardsDesignWaterLevelLocationsContextProperties.cs) (revision 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2) @@ -47,7 +47,7 @@ { return data.Select(loc => new GrassCoverErosionOutwardsDesignWaterLevelLocationContextProperties { - Data = new GrassCoverErosionOutwardsWaterLevelLocationContext(data, loc) + Data = new GrassCoverErosionOutwardsDesignWaterLevelLocationContext(data, loc) }).ToArray(); } } Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Ringtoets.GrassCoverErosionOutwards.Forms.csproj =================================================================== diff -u -r4f5e140bd0d2891988a862ff4c5749a7991a12b0 -r75ac52f6f7e203e77dd212e6c32d68e7e58c28b2 --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Ringtoets.GrassCoverErosionOutwards.Forms.csproj (.../Ringtoets.GrassCoverErosionOutwards.Forms.csproj) (revision 4f5e140bd0d2891988a862ff4c5749a7991a12b0) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Ringtoets.GrassCoverErosionOutwards.Forms.csproj (.../Ringtoets.GrassCoverErosionOutwards.Forms.csproj) (revision 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2) @@ -44,11 +44,11 @@ - + - + True True Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs =================================================================== diff -u -r4f5e140bd0d2891988a862ff4c5749a7991a12b0 -r75ac52f6f7e203e77dd212e6c32d68e7e58c28b2 --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs (.../GrassCoverErosionOutwardsPlugin.cs) (revision 4f5e140bd0d2891988a862ff4c5749a7991a12b0) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs (.../GrassCoverErosionOutwardsPlugin.cs) (revision 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2) @@ -19,6 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; using System.Collections; using System.Collections.Generic; using System.Drawing; @@ -30,6 +31,7 @@ using Core.Common.Gui.Plugin; using Ringtoets.Common.Data; using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Forms.GuiServices; using Ringtoets.Common.Forms.PresentationObjects; using Ringtoets.Common.Forms.TreeNodeInfos; using Ringtoets.GrassCoverErosionOutwards.Data; @@ -47,13 +49,15 @@ /// public class GrassCoverErosionOutwardsPlugin : PluginBase { + private IHydraulicBoundaryLocationCalculationGuiService hydraulicBoundaryLocationCalculationGuiService; + public override IEnumerable GetPropertyInfos() { yield return new PropertyInfo { GetObjectPropertiesData = context => context.WrappedData }; - yield return new PropertyInfo + yield return new PropertyInfo { GetObjectPropertiesData = context => context.Locations }; @@ -108,7 +112,7 @@ .Build() }; - yield return new TreeNodeInfo + yield return new TreeNodeInfo { Text = context => Resources.GrassCoverErosionOutwardsWaterLevelLocationsContext_DisplayName, Image = context => RingtoetsCommonFormsResources.GenericInputOutputIcon, @@ -129,6 +133,17 @@ }; } + public override void Activate() + { + base.Activate(); + + if (Gui == null) + { + throw new InvalidOperationException("Gui cannot be null"); + } + hydraulicBoundaryLocationCalculationGuiService = new HydraulicBoundaryLocationCalculationGuiService(Gui.MainWindow); + } + #region ViewInfos #region GrassCoverErosionOutwardsFailureMechanismResultView ViewInfo @@ -232,7 +247,7 @@ ObservableList locations = hydraulicBoundariesGroupContext.WrappedData.GrassCoverErosionOutwardsHydraulicBoundaryLocations; return new object[] { - new GrassCoverErosionOutwardsWaterLevelLocationsContext(assessmentSection, locations), + new GrassCoverErosionOutwardsDesignWaterLevelLocationsContext(assessmentSection, locations), new GrassCoverErosionOutwardsWaveHeightLocationsContext(assessmentSection, locations) }; } @@ -241,17 +256,36 @@ #region GrassCoverErosionOutwardsWaterLevelLocationsContext TreeNodeInfo - private ContextMenuStrip GrassCoverErosionOutwardsWaterLevelLocationsContextMenuStrip(GrassCoverErosionOutwardsWaterLevelLocationsContext nodeData, object parentData, TreeViewControl treeViewControl) + private ContextMenuStrip GrassCoverErosionOutwardsWaterLevelLocationsContextMenuStrip(GrassCoverErosionOutwardsDesignWaterLevelLocationsContext nodeData, object parentData, TreeViewControl treeViewControl) { var designWaterLevelItem = new StrictContextMenuItem( Resources.GrassCoverErosionOutwardsWaterLevelLocation_Calculate_All, Resources.GrassCoverErosionOutwardsWaterLevelLocation_Calculate_All_ToolTip, RingtoetsCommonFormsResources.CalculateAllIcon, - null); + (sender, args) => + { + if (hydraulicBoundaryLocationCalculationGuiService == null) + { + return; + } - designWaterLevelItem.Enabled = false; + IAssessmentSection assessmentSection = nodeData.WrappedData; + GrassCoverErosionOutwardsFailureMechanism failureMechanism = assessmentSection.GetFailureMechanisms().OfType().First(); + var correctedNormFactor = assessmentSection.FailureMechanismContribution.Norm* + (failureMechanism.Contribution/100)/ + failureMechanism.GeneralInput.N; + + hydraulicBoundaryLocationCalculationGuiService.CalculateDesignWaterLevels( + assessmentSection.HydraulicBoundaryDatabase.FilePath, + failureMechanism.GrassCoverErosionOutwardsHydraulicBoundaryLocations, + failureMechanism.GrassCoverErosionOutwardsHydraulicBoundaryLocations, + assessmentSection.Id, + correctedNormFactor); + }); + if (nodeData.WrappedData.HydraulicBoundaryDatabase == null) { + designWaterLevelItem.Enabled = false; designWaterLevelItem.ToolTipText = Resources.GrassCoverErosionOutwardsWaterLevelLocation_No_HRD_To_Calculate; } Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Data.Test/GrassCoverErosionOutwardsHydraulicBoundaryLocationTest.cs =================================================================== diff -u -r4f5e140bd0d2891988a862ff4c5749a7991a12b0 -r75ac52f6f7e203e77dd212e6c32d68e7e58c28b2 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Data.Test/GrassCoverErosionOutwardsHydraulicBoundaryLocationTest.cs (.../GrassCoverErosionOutwardsHydraulicBoundaryLocationTest.cs) (revision 4f5e140bd0d2891988a862ff4c5749a7991a12b0) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Data.Test/GrassCoverErosionOutwardsHydraulicBoundaryLocationTest.cs (.../GrassCoverErosionOutwardsHydraulicBoundaryLocationTest.cs) (revision 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2) @@ -20,10 +20,7 @@ // All rights reserved. using System; -using Core.Common.Base.Data; using NUnit.Framework; -using Rhino.Mocks; -using Ringtoets.Common.Data.TestUtil; using Ringtoets.HydraRing.Data; namespace Ringtoets.GrassCoverErosionOutwards.Data.Test @@ -64,39 +61,5 @@ Assert.AreEqual(2, grassCoverErosionOutwardsHydraulicBoundaryLocation.WaveHeight.NumberOfDecimalPlaces); Assert.AreEqual(CalculationConvergence.NotCalculated, grassCoverErosionOutwardsHydraulicBoundaryLocation.WaveHeightCalculationConvergence); } - - [Test] - public void WaterLevel_ValidParameters_ReturnsExpectedValues() - { - // Setup - var mockRepository = new MockRepository(); - var hydraulicBoundaryLocationMock = mockRepository.StrictMock(); - mockRepository.ReplayAll(); - var grassCoverErosionOutwardsHydraulicBoundaryLocation = new GrassCoverErosionOutwardsHydraulicBoundaryLocation(hydraulicBoundaryLocationMock); - var waterLevel = (RoundedDouble) 1.23456; - - // Call - grassCoverErosionOutwardsHydraulicBoundaryLocation.DesignWaterLevel = waterLevel; - - // Assert - Assert.AreEqual(waterLevel, grassCoverErosionOutwardsHydraulicBoundaryLocation.DesignWaterLevel, - grassCoverErosionOutwardsHydraulicBoundaryLocation.DesignWaterLevel.GetAccuracy()); - mockRepository.VerifyAll(); - } - - [Test] - public void WaveHeight_UnroundedValue_ReturnsRoundedValue() - { - // Setup - var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "name", 0.0, 0.0); - var grassCoverErosionOutwardsHydraulicBoundaryLocation = new GrassCoverErosionOutwardsHydraulicBoundaryLocation(hydraulicBoundaryLocation); - var waveHeight = (RoundedDouble) 5.12445889125; - - // Call - grassCoverErosionOutwardsHydraulicBoundaryLocation.WaveHeight = waveHeight; - - // Assert - Assert.AreEqual(5.12, grassCoverErosionOutwardsHydraulicBoundaryLocation.WaveHeight, 1e-8); - } } } \ No newline at end of file Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PresentationObjects/GrassCoverErosionOutwardsDesignWaterLevelLocationContextTest.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PresentationObjects/GrassCoverErosionOutwardsDesignWaterLevelLocationContextTest.cs (revision 0) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PresentationObjects/GrassCoverErosionOutwardsDesignWaterLevelLocationContextTest.cs (revision 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2) @@ -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 Core.Common.Base; +using NUnit.Framework; +using Ringtoets.GrassCoverErosionOutwards.Data; +using Ringtoets.GrassCoverErosionOutwards.Forms.PresentationObjects; +using Ringtoets.HydraRing.Data; + +namespace Ringtoets.GrassCoverErosionOutwards.Forms.Test.PresentationObjects +{ + [TestFixture] + public class GrassCoverErosionOutwardsDesignWaterLevelLocationContextTest + { + [Test] + public void DefaultConstructor_ExpectedValues() + { + // Setup + var grassCoverErosionOutwardsHydraulicBoundaryLocation = new GrassCoverErosionOutwardsHydraulicBoundaryLocation( + new HydraulicBoundaryLocation(1, "name", 2.0, 3.0)); + var locations = new ObservableList + { + grassCoverErosionOutwardsHydraulicBoundaryLocation + }; + + // Call + var presentationObject = new GrassCoverErosionOutwardsDesignWaterLevelLocationContext(locations, grassCoverErosionOutwardsHydraulicBoundaryLocation); + + // Assert + Assert.IsInstanceOf(presentationObject); + Assert.AreSame(locations, presentationObject.WrappedData); + } + } +} \ No newline at end of file Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PresentationObjects/GrassCoverErosionOutwardsDesignWaterLevelLocationsContextTest.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PresentationObjects/GrassCoverErosionOutwardsDesignWaterLevelLocationsContextTest.cs (revision 0) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PresentationObjects/GrassCoverErosionOutwardsDesignWaterLevelLocationsContextTest.cs (revision 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2) @@ -0,0 +1,71 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Core.Common.Base; +using Core.Common.Controls.PresentationObjects; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.GrassCoverErosionOutwards.Data; +using Ringtoets.GrassCoverErosionOutwards.Forms.PresentationObjects; + +namespace Ringtoets.GrassCoverErosionOutwards.Forms.Test.PresentationObjects +{ + [TestFixture] + public class GrassCoverErosionOutwardsDesignWaterLevelLocationsContextTest + { + [Test] + public void DefaultConstructor_ExpectedValues() + { + // Setup + var mockRepository = new MockRepository(); + var assessmentSectionMock = mockRepository.StrictMock(); + mockRepository.ReplayAll(); + var locations = new ObservableList(); + + // Call + var presentationObject = new GrassCoverErosionOutwardsDesignWaterLevelLocationsContext(assessmentSectionMock, locations); + + // Assert + Assert.IsInstanceOf>(presentationObject); + Assert.AreSame(assessmentSectionMock, presentationObject.WrappedData); + Assert.AreSame(locations, presentationObject.Locations); + mockRepository.VerifyAll(); + } + + [Test] + public void Constructor_GrassCoverErosionOutwardsHydraulicBoundaryLocationsIsNull_ThrowsArgumentNullException() + { + // Setup + var mocks = new MockRepository(); + var assessmentSectionMock = mocks.StrictMock(); + mocks.ReplayAll(); + + // Call + TestDelegate call = () => new GrassCoverErosionOutwardsDesignWaterLevelLocationsContext(assessmentSectionMock, null); + + // Assert + var paramName = Assert.Throws(call).ParamName; + Assert.AreEqual("grassCoverErosionOutwardsHydraulicBoundaryLocations", paramName); + } + } +} \ No newline at end of file Fisheye: Tag 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2 refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PresentationObjects/GrassCoverErosionOutwardsWaterLevelLocationContextTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2 refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PresentationObjects/GrassCoverErosionOutwardsWaterLevelLocationsContextTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PropertyClasses/GrassCoverErosionOutwardsDesignWaterLevelLocationContextPropertiesTest.cs =================================================================== diff -u -r4f5e140bd0d2891988a862ff4c5749a7991a12b0 -r75ac52f6f7e203e77dd212e6c32d68e7e58c28b2 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PropertyClasses/GrassCoverErosionOutwardsDesignWaterLevelLocationContextPropertiesTest.cs (.../GrassCoverErosionOutwardsDesignWaterLevelLocationContextPropertiesTest.cs) (revision 4f5e140bd0d2891988a862ff4c5749a7991a12b0) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PropertyClasses/GrassCoverErosionOutwardsDesignWaterLevelLocationContextPropertiesTest.cs (.../GrassCoverErosionOutwardsDesignWaterLevelLocationContextPropertiesTest.cs) (revision 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2) @@ -69,7 +69,7 @@ { grassCoverErosionOutwardsHydraulicBoundaryLocation }; - var context = new GrassCoverErosionOutwardsWaterLevelLocationContext(locations, grassCoverErosionOutwardsHydraulicBoundaryLocation); + var context = new GrassCoverErosionOutwardsDesignWaterLevelLocationContext(locations, grassCoverErosionOutwardsHydraulicBoundaryLocation); // Call var properties = new GrassCoverErosionOutwardsDesignWaterLevelLocationContextProperties @@ -100,7 +100,7 @@ { grassCoverErosionOutwardsHydraulicBoundaryLocation }; - var context = new GrassCoverErosionOutwardsWaterLevelLocationContext(locations, grassCoverErosionOutwardsHydraulicBoundaryLocation); + var context = new GrassCoverErosionOutwardsDesignWaterLevelLocationContext(locations, grassCoverErosionOutwardsHydraulicBoundaryLocation); var properties = new GrassCoverErosionOutwardsDesignWaterLevelLocationContextProperties { Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PropertyClasses/GrassCoverErosionOutwardsHydraulicBoundaryLocationPropertiesTest.cs =================================================================== diff -u -r7546a65303cc9421d2ebe115c5dac56164371e07 -r75ac52f6f7e203e77dd212e6c32d68e7e58c28b2 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PropertyClasses/GrassCoverErosionOutwardsHydraulicBoundaryLocationPropertiesTest.cs (.../GrassCoverErosionOutwardsHydraulicBoundaryLocationPropertiesTest.cs) (revision 7546a65303cc9421d2ebe115c5dac56164371e07) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PropertyClasses/GrassCoverErosionOutwardsHydraulicBoundaryLocationPropertiesTest.cs (.../GrassCoverErosionOutwardsHydraulicBoundaryLocationPropertiesTest.cs) (revision 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2) @@ -56,7 +56,7 @@ grassCoverErosionOutwardsHydraulicBoundaryLocation }; - var context = new GrassCoverErosionOutwardsWaterLevelLocationContext(locations, grassCoverErosionOutwardsHydraulicBoundaryLocation); + var context = new GrassCoverErosionOutwardsDesignWaterLevelLocationContext(locations, grassCoverErosionOutwardsHydraulicBoundaryLocation); // Call TestDelegate test = () => new TestGrassCoverErosionOutwardsLocationProperties @@ -82,7 +82,7 @@ { grassCoverErosionOutwardsHydraulicBoundaryLocation }; - var context = new GrassCoverErosionOutwardsWaterLevelLocationContext(locations, grassCoverErosionOutwardsHydraulicBoundaryLocation); + var context = new GrassCoverErosionOutwardsDesignWaterLevelLocationContext(locations, grassCoverErosionOutwardsHydraulicBoundaryLocation); // Call TestGrassCoverErosionOutwardsLocationProperties locationProperties = new TestGrassCoverErosionOutwardsLocationProperties @@ -111,7 +111,7 @@ { grassCoverErosionOutwardsHydraulicBoundaryLocation }; - var context = new GrassCoverErosionOutwardsWaterLevelLocationContext(locations, grassCoverErosionOutwardsHydraulicBoundaryLocation); + var context = new GrassCoverErosionOutwardsDesignWaterLevelLocationContext(locations, grassCoverErosionOutwardsHydraulicBoundaryLocation); // Call TestGrassCoverErosionOutwardsLocationProperties locationProperties = new TestGrassCoverErosionOutwardsLocationProperties @@ -138,7 +138,7 @@ { grassCoverErosionOutwardsHydraulicBoundaryLocation }; - var context = new GrassCoverErosionOutwardsWaterLevelLocationContext(locations, grassCoverErosionOutwardsHydraulicBoundaryLocation); + var context = new GrassCoverErosionOutwardsDesignWaterLevelLocationContext(locations, grassCoverErosionOutwardsHydraulicBoundaryLocation); var locationProperties = new TestGrassCoverErosionOutwardsLocationProperties { Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Ringtoets.GrassCoverErosionOutwards.Forms.Test.csproj =================================================================== diff -u -r4f5e140bd0d2891988a862ff4c5749a7991a12b0 -r75ac52f6f7e203e77dd212e6c32d68e7e58c28b2 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Ringtoets.GrassCoverErosionOutwards.Forms.Test.csproj (.../Ringtoets.GrassCoverErosionOutwards.Forms.Test.csproj) (revision 4f5e140bd0d2891988a862ff4c5749a7991a12b0) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Ringtoets.GrassCoverErosionOutwards.Forms.Test.csproj (.../Ringtoets.GrassCoverErosionOutwards.Forms.Test.csproj) (revision 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2) @@ -63,8 +63,8 @@ - - + + @@ -76,7 +76,7 @@ - + Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/TreeNodeInfos/GrassCoverErosionOutwardsDesignWaterLevelLocationsContextTreeNodeInfoTest.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/TreeNodeInfos/GrassCoverErosionOutwardsDesignWaterLevelLocationsContextTreeNodeInfoTest.cs (revision 0) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/TreeNodeInfos/GrassCoverErosionOutwardsDesignWaterLevelLocationsContextTreeNodeInfoTest.cs (revision 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2) @@ -0,0 +1,296 @@ +// 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.Drawing; +using System.Linq; +using System.Windows.Forms; +using Core.Common.Base; +using Core.Common.Controls.TreeView; +using Core.Common.Gui; +using Core.Common.Gui.Commands; +using Core.Common.Gui.ContextMenu; +using Core.Common.TestUtil; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.GrassCoverErosionOutwards.Data; +using Ringtoets.GrassCoverErosionOutwards.Forms.PresentationObjects; +using Ringtoets.GrassCoverErosionOutwards.Forms.Properties; +using Ringtoets.GrassCoverErosionOutwards.Plugin; +using Ringtoets.HydraRing.Data; +using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; +using CoreCommonGuiResources = Core.Common.Gui.Properties.Resources; + +namespace Ringtoets.GrassCoverErosionOutwards.Forms.Test.TreeNodeInfos +{ + [TestFixture] + public class GrassCoverErosionOutwardsDesignWaterLevelLocationsContextTreeNodeInfoTest + { + private MockRepository mockRepository; + private GrassCoverErosionOutwardsPlugin plugin; + private TreeNodeInfo info; + + [SetUp] + public void SetUp() + { + mockRepository = new MockRepository(); + plugin = new GrassCoverErosionOutwardsPlugin(); + info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(GrassCoverErosionOutwardsDesignWaterLevelLocationsContext)); + } + + [TearDown] + public void TearDown() + { + plugin.Dispose(); + mockRepository.VerifyAll(); + } + + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Setup + mockRepository.ReplayAll(); + + // Assert + Assert.AreEqual(typeof(GrassCoverErosionOutwardsDesignWaterLevelLocationsContext), info.TagType); + + Assert.IsNull(info.EnsureVisibleOnCreate); + Assert.IsNull(info.CanRename); + Assert.IsNull(info.OnNodeRenamed); + Assert.IsNull(info.CanRemove); + Assert.IsNull(info.OnNodeRemoved); + Assert.IsNull(info.CanCheck); + Assert.IsNull(info.IsChecked); + Assert.IsNull(info.OnNodeChecked); + Assert.IsNull(info.CanDrag); + Assert.IsNull(info.CanDrop); + Assert.IsNull(info.CanInsert); + Assert.IsNull(info.OnDrop); + } + + [Test] + public void Text_Always_ReturnName() + { + // Setup + var assessmentSectionMock = mockRepository.StrictMock(); + mockRepository.ReplayAll(); + var context = new GrassCoverErosionOutwardsDesignWaterLevelLocationsContext( + assessmentSectionMock, + new ObservableList()); + + // Call + string nodeText = info.Text(context); + + // Assert + Assert.AreEqual("Waterstand bij doorsnede-eis", nodeText); + } + + [Test] + public void Image_Always_ReturnGenericInputOutputIcon() + { + // Setup + var assessmentSectionMock = mockRepository.StrictMock(); + mockRepository.ReplayAll(); + var context = new GrassCoverErosionOutwardsDesignWaterLevelLocationsContext( + assessmentSectionMock, + new ObservableList()); + + // Call + Image icon = info.Image(context); + + // Assert + TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.GenericInputOutputIcon, icon); + } + + [Test] + public void ContextMenuStrip_Always_CallsContextMenuBuilderMethods() + { + // Setup + var assessmentSectionMock = mockRepository.Stub(); + + using (var treeViewControl = new TreeViewControl()) + { + var context = new GrassCoverErosionOutwardsDesignWaterLevelLocationsContext( + assessmentSectionMock, + new ObservableList()); + + var menuBuilder = mockRepository.StrictMock(); + menuBuilder.Expect(mb => mb.AddCustomItem(null)).IgnoreArguments().Return(menuBuilder); + menuBuilder.Expect(mb => mb.AddSeparator()).Return(menuBuilder); + menuBuilder.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilder); + menuBuilder.Expect(mb => mb.Build()).Return(null); + + var gui = mockRepository.StrictMock(); + gui.Expect(cmp => cmp.Get(context, treeViewControl)).Return(menuBuilder); + + mockRepository.ReplayAll(); + + plugin.Gui = gui; + + // Call + info.ContextMenuStrip(context, null, treeViewControl); + } + + // Assert + // Part of TearDown + } + + [Test] + public void ContextMenuStrip_WithoutHydraulicDatabase_ReturnsContextMenuWithCommonItems() + { + // Setup + var assessmentSectionMock = mockRepository.Stub(); + + var applicationFeatureCommandHandler = mockRepository.Stub(); + var importCommandHandler = mockRepository.Stub(); + var exportCommandHandler = mockRepository.Stub(); + var viewCommandsHandler = mockRepository.Stub(); + + using (var treeViewControl = new TreeViewControl()) + { + var context = new GrassCoverErosionOutwardsDesignWaterLevelLocationsContext( + assessmentSectionMock, + new ObservableList()); + + var menuBuilder = new ContextMenuBuilder(applicationFeatureCommandHandler, + importCommandHandler, + exportCommandHandler, + viewCommandsHandler, + context, + treeViewControl); + + var gui = mockRepository.StrictMock(); + gui.Expect(cmp => cmp.Get(context, treeViewControl)).Return(menuBuilder); + + mockRepository.ReplayAll(); + + plugin.Gui = gui; + + // Call + ContextMenuStrip menu = info.ContextMenuStrip(context, null, treeViewControl); + + // Assert + Assert.AreEqual(3, menu.Items.Count); + + TestHelper.AssertContextMenuStripContainsItem(menu, 0, Resources.GrassCoverErosionOutwardsWaterLevelLocation_Calculate_All, + Resources.GrassCoverErosionOutwardsWaterLevelLocation_No_HRD_To_Calculate, RingtoetsCommonFormsResources.CalculateAllIcon, false); + TestHelper.AssertContextMenuStripContainsItem(menu, 2, CoreCommonGuiResources.Properties, + CoreCommonGuiResources.Properties_ToolTip, CoreCommonGuiResources.PropertiesHS, false); + + CollectionAssert.AllItemsAreInstancesOfType(new[] + { + menu.Items[1], + }, typeof(ToolStripSeparator)); + } + } + + [Test] + public void ContextMenuStrip_WithHydraulicDatabase_EnabledCalculateAllAndTooltip() + { + // Setup + var assessmentSectionMock = mockRepository.Stub(); + assessmentSectionMock.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + + var applicationFeatureCommandHandler = mockRepository.Stub(); + var importCommandHandler = mockRepository.Stub(); + var exportCommandHandler = mockRepository.Stub(); + var viewCommandsHandler = mockRepository.Stub(); + + using (var treeViewControl = new TreeViewControl()) + { + var context = new GrassCoverErosionOutwardsDesignWaterLevelLocationsContext( + assessmentSectionMock, + new ObservableList()); + + var menuBuilder = new ContextMenuBuilder(applicationFeatureCommandHandler, + importCommandHandler, + exportCommandHandler, + viewCommandsHandler, + context, + treeViewControl); + + var gui = mockRepository.StrictMock(); + gui.Expect(cmp => cmp.Get(context, treeViewControl)).Return(menuBuilder); + + mockRepository.ReplayAll(); + + plugin.Gui = gui; + + // Call + ContextMenuStrip menu = info.ContextMenuStrip(context, null, treeViewControl); + + // Assert + Assert.AreEqual(3, menu.Items.Count); + + TestHelper.AssertContextMenuStripContainsItem(menu, 0, Resources.GrassCoverErosionOutwardsWaterLevelLocation_Calculate_All, + Resources.GrassCoverErosionOutwardsWaterLevelLocation_Calculate_All_ToolTip, RingtoetsCommonFormsResources.CalculateAllIcon); + + CollectionAssert.AllItemsAreInstancesOfType(new[] + { + menu.Items[1], + }, typeof(ToolStripSeparator)); + } + } + + [Test] + public void ForeColor_ContextHasLocationsData_ReturnControlText() + { + // Setup + var assessmentSectionMock = mockRepository.Stub(); + var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "", 0, 0); + HydraulicBoundaryDatabase database = new HydraulicBoundaryDatabase + { + Locations = + { + hydraulicBoundaryLocation + } + }; + assessmentSectionMock.HydraulicBoundaryDatabase = database; + mockRepository.ReplayAll(); + var locations = new ObservableList + { + new GrassCoverErosionOutwardsHydraulicBoundaryLocation(hydraulicBoundaryLocation) + }; + var context = new GrassCoverErosionOutwardsDesignWaterLevelLocationsContext(assessmentSectionMock, locations); + + // Call + Color color = info.ForeColor(context); + + // Assert + Assert.AreEqual(Color.FromKnownColor(KnownColor.ControlText), color); + } + + [Test] + public void ForeColor_ContextHasNoLocationsData_ReturnGrayText() + { + // Setup + var assessmentSectionMock = mockRepository.Stub(); + mockRepository.ReplayAll(); + var context = new GrassCoverErosionOutwardsDesignWaterLevelLocationsContext(assessmentSectionMock, new ObservableList()); + + // Call + Color color = info.ForeColor(context); + + // Assert + Assert.AreEqual(Color.FromKnownColor(KnownColor.GrayText), color); + } + } +} \ No newline at end of file Fisheye: Tag 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2 refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/TreeNodeInfos/GrassCoverErosionOutwardsWaterLevelLocationsContextTreeNodeInfoTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/TreeNodeInfos/HydraulicBoundariesGroupContextTreeNodeInfoTest.cs =================================================================== diff -u -r42b9c50db09fcb1351a7d475648abf0be72db967 -r75ac52f6f7e203e77dd212e6c32d68e7e58c28b2 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/TreeNodeInfos/HydraulicBoundariesGroupContextTreeNodeInfoTest.cs (.../HydraulicBoundariesGroupContextTreeNodeInfoTest.cs) (revision 42b9c50db09fcb1351a7d475648abf0be72db967) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/TreeNodeInfos/HydraulicBoundariesGroupContextTreeNodeInfoTest.cs (.../HydraulicBoundariesGroupContextTreeNodeInfoTest.cs) (revision 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2) @@ -158,7 +158,7 @@ // Assert Assert.AreEqual(2, children.Length); - var waterLevelHydraulicBoundaryLocationsContext = (GrassCoverErosionOutwardsWaterLevelLocationsContext) children[0]; + var waterLevelHydraulicBoundaryLocationsContext = (GrassCoverErosionOutwardsDesignWaterLevelLocationsContext) children[0]; Assert.AreSame(assessmentSectionMock, waterLevelHydraulicBoundaryLocationsContext.WrappedData); Assert.AreSame(failureMechanism.GrassCoverErosionOutwardsHydraulicBoundaryLocations, waterLevelHydraulicBoundaryLocationsContext.Locations); Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/GrassCoverErosionOutwardsPluginTest.cs =================================================================== diff -u -r4f5e140bd0d2891988a862ff4c5749a7991a12b0 -r75ac52f6f7e203e77dd212e6c32d68e7e58c28b2 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/GrassCoverErosionOutwardsPluginTest.cs (.../GrassCoverErosionOutwardsPluginTest.cs) (revision 4f5e140bd0d2891988a862ff4c5749a7991a12b0) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/GrassCoverErosionOutwardsPluginTest.cs (.../GrassCoverErosionOutwardsPluginTest.cs) (revision 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2) @@ -82,7 +82,7 @@ Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(GrassCoverErosionOutwardsFailureMechanismContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(FailureMechanismSectionResultContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(HydraulicBoundariesGroupContext))); - Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(GrassCoverErosionOutwardsWaterLevelLocationsContext))); + Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(GrassCoverErosionOutwardsDesignWaterLevelLocationsContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(GrassCoverErosionOutwardsWaveHeightLocationsContext))); } } @@ -106,7 +106,7 @@ Assert.IsNull(grassCoverErosionOutwardsFailureMechanismProperties.AfterCreate); var waterLevelHydraulicBoundaryLocationsContextProperties = PluginTestHelper.AssertPropertyInfoDefined< - GrassCoverErosionOutwardsWaterLevelLocationsContext, + GrassCoverErosionOutwardsDesignWaterLevelLocationsContext, GrassCoverErosionOutwardsDesignWaterLevelLocationsContextProperties>(propertyInfos); Assert.IsNull(waterLevelHydraulicBoundaryLocationsContextProperties.AdditionalDataCheck); Assert.IsNull(waterLevelHydraulicBoundaryLocationsContextProperties.AfterCreate); Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Data/IHydraulicBoundaryLocation.cs =================================================================== diff -u -r4f5e140bd0d2891988a862ff4c5749a7991a12b0 -r75ac52f6f7e203e77dd212e6c32d68e7e58c28b2 --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Data/IHydraulicBoundaryLocation.cs (.../IHydraulicBoundaryLocation.cs) (revision 4f5e140bd0d2891988a862ff4c5749a7991a12b0) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Data/IHydraulicBoundaryLocation.cs (.../IHydraulicBoundaryLocation.cs) (revision 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2) @@ -19,6 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using Core.Common.Base.Data; using Core.Common.Base.Geometry; using Core.Common.Base.Storage; @@ -43,5 +44,25 @@ /// Gets the coordinates of . /// Point2D Location { get; } + + /// + /// Gets or sets the design water level of . + /// + RoundedDouble DesignWaterLevel { get; set; } + + /// + /// Gets or sets the wave height of . + /// + RoundedDouble WaveHeight { get; set; } + + /// + /// Gets or sets the convergence status of the design waterlevel calculation. + /// + CalculationConvergence DesignWaterLevelCalculationConvergence { get; set; } + + /// + /// Gets or sets the convergence status of the waveheight calculation. + /// + CalculationConvergence WaveHeightCalculationConvergence { get; set; } } } \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/DesignWaterLevelLocationsView.cs =================================================================== diff -u -r2befc47af352397e7f89175bd08d273735603ae0 -r75ac52f6f7e203e77dd212e6c32d68e7e58c28b2 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/DesignWaterLevelLocationsView.cs (.../DesignWaterLevelLocationsView.cs) (revision 2befc47af352397e7f89175bd08d273735603ae0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/DesignWaterLevelLocationsView.cs (.../DesignWaterLevelLocationsView.cs) (revision 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2) @@ -56,8 +56,12 @@ { return; } - CalculationGuiService.CalculateDesignWaterLevels(AssessmentSection.HydraulicBoundaryDatabase, locations, - AssessmentSection.Id, AssessmentSection.FailureMechanismContribution.Norm); + CalculationGuiService.CalculateDesignWaterLevels( + AssessmentSection.HydraulicBoundaryDatabase.FilePath, + AssessmentSection.HydraulicBoundaryDatabase, + locations, + AssessmentSection.Id, + AssessmentSection.FailureMechanismContribution.Norm); } protected override void InitializeDataGridView() Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WaveHeightLocationsView.cs =================================================================== diff -u -r2befc47af352397e7f89175bd08d273735603ae0 -r75ac52f6f7e203e77dd212e6c32d68e7e58c28b2 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WaveHeightLocationsView.cs (.../WaveHeightLocationsView.cs) (revision 2befc47af352397e7f89175bd08d273735603ae0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WaveHeightLocationsView.cs (.../WaveHeightLocationsView.cs) (revision 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2) @@ -56,8 +56,12 @@ { return; } - CalculationGuiService.CalculateWaveHeights(AssessmentSection.HydraulicBoundaryDatabase, locations, - AssessmentSection.Id, AssessmentSection.FailureMechanismContribution.Norm); + CalculationGuiService.CalculateWaveHeights( + AssessmentSection.HydraulicBoundaryDatabase.FilePath, + AssessmentSection.HydraulicBoundaryDatabase, + locations, + AssessmentSection.Id, + AssessmentSection.FailureMechanismContribution.Norm); } protected override void InitializeDataGridView() Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs =================================================================== diff -u -r3e5a3e2990566fe86caaaa87136d0f57543a9666 -r75ac52f6f7e203e77dd212e6c32d68e7e58c28b2 --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 3e5a3e2990566fe86caaaa87136d0f57543a9666) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2) @@ -1091,6 +1091,7 @@ IAssessmentSection assessmentSection = nodeData.WrappedData; hydraulicBoundaryLocationCalculationGuiService.CalculateDesignWaterLevels( + assessmentSection.HydraulicBoundaryDatabase.FilePath, assessmentSection.HydraulicBoundaryDatabase, assessmentSection.HydraulicBoundaryDatabase.Locations, assessmentSection.Id, @@ -1126,6 +1127,7 @@ } IAssessmentSection assessmentSection = nodeData.WrappedData; hydraulicBoundaryLocationCalculationGuiService.CalculateWaveHeights( + assessmentSection.HydraulicBoundaryDatabase.FilePath, assessmentSection.HydraulicBoundaryDatabase, assessmentSection.HydraulicBoundaryDatabase.Locations, assessmentSection.Id, Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/DesignWaterLevelLocationsViewTest.cs =================================================================== diff -u -r915001caffacbbee15c0e3bf449072245bc5f509 -r75ac52f6f7e203e77dd212e6c32d68e7e58c28b2 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/DesignWaterLevelLocationsViewTest.cs (.../DesignWaterLevelLocationsViewTest.cs) (revision 915001caffacbbee15c0e3bf449072245bc5f509) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/DesignWaterLevelLocationsViewTest.cs (.../DesignWaterLevelLocationsViewTest.cs) (revision 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2) @@ -216,8 +216,8 @@ var guiServiceMock = mockRepository.StrictMock(); IEnumerable locations = null; - guiServiceMock.Expect(ch => ch.CalculateDesignWaterLevels(null, null, null, 1)).IgnoreArguments().WhenCalled( - invocation => { locations = (IEnumerable) invocation.Arguments[1]; }); + guiServiceMock.Expect(ch => ch.CalculateDesignWaterLevels(null, null, null, null, 1)).IgnoreArguments().WhenCalled( + invocation => { locations = (IEnumerable) invocation.Arguments[2]; }); mockRepository.ReplayAll(); view.CalculationGuiService = guiServiceMock; Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/WaveHeightLocationsViewTest.cs =================================================================== diff -u -r915001caffacbbee15c0e3bf449072245bc5f509 -r75ac52f6f7e203e77dd212e6c32d68e7e58c28b2 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/WaveHeightLocationsViewTest.cs (.../WaveHeightLocationsViewTest.cs) (revision 915001caffacbbee15c0e3bf449072245bc5f509) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/WaveHeightLocationsViewTest.cs (.../WaveHeightLocationsViewTest.cs) (revision 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2) @@ -212,8 +212,8 @@ var guiServiceMock = mockRepository.StrictMock(); IEnumerable locations = null; - guiServiceMock.Expect(ch => ch.CalculateWaveHeights(null, null, null, 1)).IgnoreArguments().WhenCalled( - invocation => { locations = (IEnumerable) invocation.Arguments[1]; }); + guiServiceMock.Expect(ch => ch.CalculateWaveHeights(null, null, null, null, 1)).IgnoreArguments().WhenCalled( + invocation => { locations = (IEnumerable) invocation.Arguments[2]; }); mockRepository.ReplayAll(); view.CalculationGuiService = guiServiceMock;