Fisheye: Tag fc4f536da3543bb4d5367d240ed1aef5aa7655da refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.Data/Hydraulics/DesignWaterLevelCalculation.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/src/Ringtoets.Common.Data/Hydraulics/HydraulicBoundaryCalculationWrapper.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.Data/Hydraulics/HydraulicBoundaryCalculationWrapper.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.Data/Hydraulics/HydraulicBoundaryCalculationWrapper.cs (revision fc4f536da3543bb4d5367d240ed1aef5aa7655da) @@ -0,0 +1,120 @@ +// Copyright (C) Stichting Deltares 2017. 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; + +namespace Ringtoets.Common.Data.Hydraulics +{ + /// + /// Wrapper of an hydraulic boundary location calculation. + /// + public class HydraulicBoundaryCalculationWrapper : IHydraulicBoundaryCalculationWrapper + { + private readonly HydraulicBoundaryLocation hydraulicBoundaryLocation; + private readonly HydraulicBoundaryLocationCalculation hydraulicBoundaryLocationCalculation; + + /// + /// Creates a new instance of . + /// + /// The hydraulic boundary location the + /// belongs to. + /// The hydraulic boundary location + /// calculation to wrap. + /// Thrown when + /// or is null. + public HydraulicBoundaryCalculationWrapper(HydraulicBoundaryLocation hydraulicBoundaryLocation, + HydraulicBoundaryLocationCalculation hydraulicBoundaryLocationCalculation) + { + if (hydraulicBoundaryLocation == null) + { + throw new ArgumentNullException(nameof(hydraulicBoundaryLocation)); + } + + if (hydraulicBoundaryLocationCalculation == null) + { + throw new ArgumentNullException(nameof(hydraulicBoundaryLocationCalculation)); + } + + this.hydraulicBoundaryLocation = hydraulicBoundaryLocation; + this.hydraulicBoundaryLocationCalculation = hydraulicBoundaryLocationCalculation; + } + + /// + /// Gets the observable object to notify upon an internal state change. + /// + public IObservable ObservableObject + { + get + { + return hydraulicBoundaryLocation; + } + } + + public long Id + { + get + { + return hydraulicBoundaryLocation.Id; + } + } + + public string Name + { + get + { + return hydraulicBoundaryLocation.Name; + } + } + + public bool CalculateIllustrationPoints + { + get + { + return hydraulicBoundaryLocationCalculation.InputParameters.ShouldIllustrationPointsBeCalculated; + } + } + + public HydraulicBoundaryLocationOutput Output + { + get + { + return hydraulicBoundaryLocationCalculation.Output; + } + set + { + hydraulicBoundaryLocationCalculation.Output = value; + } + } + + /// + /// Gets a value indicating whether the wrapped calculation has already been calculated. + /// + /// true if the calculation is fully calculated, false otherwise. + /// A calculation is fully calculated, depending on if the illustration points + /// are set to be calculated. + public bool IsCalculated() + { + return hydraulicBoundaryLocationCalculation.HasOutput + && hydraulicBoundaryLocationCalculation.InputParameters.ShouldIllustrationPointsBeCalculated == hydraulicBoundaryLocationCalculation.Output.HasGeneralResult; + } + } +} \ No newline at end of file Fisheye: Tag fc4f536da3543bb4d5367d240ed1aef5aa7655da refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.Data/Hydraulics/WaveHeightCalculation.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/src/Ringtoets.Common.Data/Ringtoets.Common.Data.csproj =================================================================== diff -u -r951f02b96cdc472aa253c44196d69f21ea26d560 -rfc4f536da3543bb4d5367d240ed1aef5aa7655da --- Ringtoets/Common/src/Ringtoets.Common.Data/Ringtoets.Common.Data.csproj (.../Ringtoets.Common.Data.csproj) (revision 951f02b96cdc472aa253c44196d69f21ea26d560) +++ Ringtoets/Common/src/Ringtoets.Common.Data/Ringtoets.Common.Data.csproj (.../Ringtoets.Common.Data.csproj) (revision fc4f536da3543bb4d5367d240ed1aef5aa7655da) @@ -43,7 +43,7 @@ - + @@ -70,7 +70,6 @@ - Index: Ringtoets/Common/src/Ringtoets.Common.Forms/GuiServices/HydraulicBoundaryLocationCalculationGuiService.cs =================================================================== diff -u -r0225653c669d19e281784bea8146c25bfe568a29 -rfc4f536da3543bb4d5367d240ed1aef5aa7655da --- Ringtoets/Common/src/Ringtoets.Common.Forms/GuiServices/HydraulicBoundaryLocationCalculationGuiService.cs (.../HydraulicBoundaryLocationCalculationGuiService.cs) (revision 0225653c669d19e281784bea8146c25bfe568a29) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/GuiServices/HydraulicBoundaryLocationCalculationGuiService.cs (.../HydraulicBoundaryLocationCalculationGuiService.cs) (revision fc4f536da3543bb4d5367d240ed1aef5aa7655da) @@ -82,7 +82,7 @@ RunActivities(hydraulicBoundaryDatabaseFilePath, preprocessorDirectory, - locations.Select(location => new DesignWaterLevelCalculationActivity(new DesignWaterLevelCalculation(location, getCalculationFunc(location)), + locations.Select(location => new DesignWaterLevelCalculationActivity(new HydraulicBoundaryCalculationWrapper(location, getCalculationFunc(location)), hydraulicBoundaryDatabaseFilePath, preprocessorDirectory, norm, @@ -113,7 +113,7 @@ RunActivities(hydraulicBoundaryDatabaseFilePath, preprocessorDirectory, - locations.Select(location => new WaveHeightCalculationActivity(new WaveHeightCalculation(location, getCalculationFunc(location)), + locations.Select(location => new WaveHeightCalculationActivity(new HydraulicBoundaryCalculationWrapper(location, getCalculationFunc(location)), hydraulicBoundaryDatabaseFilePath, preprocessorDirectory, norm, Index: Ringtoets/Common/src/Ringtoets.Common.Service/DesignWaterLevelCalculationActivity.cs =================================================================== diff -u -rf8c28b3b04cdabb62ea37772efcb1f4ebbbf2b9e -rfc4f536da3543bb4d5367d240ed1aef5aa7655da --- Ringtoets/Common/src/Ringtoets.Common.Service/DesignWaterLevelCalculationActivity.cs (.../DesignWaterLevelCalculationActivity.cs) (revision f8c28b3b04cdabb62ea37772efcb1f4ebbbf2b9e) +++ Ringtoets/Common/src/Ringtoets.Common.Service/DesignWaterLevelCalculationActivity.cs (.../DesignWaterLevelCalculationActivity.cs) (revision fc4f536da3543bb4d5367d240ed1aef5aa7655da) @@ -32,50 +32,49 @@ /// public class DesignWaterLevelCalculationActivity : HydraRingActivityBase { - private readonly DesignWaterLevelCalculation designWaterLevelCalculation; private readonly double norm; private readonly string hydraulicBoundaryDatabaseFilePath; private readonly string preprocessorDirectory; private readonly ICalculationMessageProvider messageProvider; private readonly DesignWaterLevelCalculationService calculationService; + private readonly HydraulicBoundaryCalculationWrapper calculationWrapper; /// /// Creates a new instance of . /// - /// The to perform the calculation for. + /// The to perform the calculation for. /// The hydraulic boundary database file that should be used for performing the calculation. /// The preprocessor directory. /// The norm to use during the calculation. /// The provider of the messages to use during the calculation. /// Preprocessing is disabled when equals . - /// Thrown when , - /// , or + /// Thrown when or /// is null. - public DesignWaterLevelCalculationActivity(DesignWaterLevelCalculation designWaterLevelCalculation, + public DesignWaterLevelCalculationActivity(HydraulicBoundaryCalculationWrapper calculationWrapper, string hydraulicBoundaryDatabaseFilePath, string preprocessorDirectory, double norm, ICalculationMessageProvider messageProvider) { - if (designWaterLevelCalculation == null) + if (calculationWrapper == null) { - throw new ArgumentNullException(nameof(designWaterLevelCalculation)); + throw new ArgumentNullException(nameof(calculationWrapper)); } if (messageProvider == null) { throw new ArgumentNullException(nameof(messageProvider)); } - this.designWaterLevelCalculation = designWaterLevelCalculation; + this.calculationWrapper = calculationWrapper; this.messageProvider = messageProvider; this.hydraulicBoundaryDatabaseFilePath = hydraulicBoundaryDatabaseFilePath; this.preprocessorDirectory = preprocessorDirectory; this.norm = norm; calculationService = new DesignWaterLevelCalculationService(); - Description = messageProvider.GetActivityDescription(designWaterLevelCalculation.Name); + Description = messageProvider.GetActivityDescription(calculationWrapper.Name); } protected override bool Validate() @@ -93,12 +92,11 @@ { if (State != ActivityState.Skipped) { - calculationService.Calculate( - designWaterLevelCalculation, - hydraulicBoundaryDatabaseFilePath, - preprocessorDirectory, - norm, - messageProvider); + calculationService.Calculate(calculationWrapper, + hydraulicBoundaryDatabaseFilePath, + preprocessorDirectory, + norm, + messageProvider); } } @@ -109,14 +107,14 @@ protected override void OnFinish() { - designWaterLevelCalculation.ObservableObject.NotifyObservers(); + calculationWrapper.ObservableObject.NotifyObservers(); } private bool AlreadyCalculated { get { - return designWaterLevelCalculation.IsCalculated(); + return calculationWrapper.IsCalculated(); } } } Index: Ringtoets/Common/src/Ringtoets.Common.Service/WaveHeightCalculationActivity.cs =================================================================== diff -u -rf8c28b3b04cdabb62ea37772efcb1f4ebbbf2b9e -rfc4f536da3543bb4d5367d240ed1aef5aa7655da --- Ringtoets/Common/src/Ringtoets.Common.Service/WaveHeightCalculationActivity.cs (.../WaveHeightCalculationActivity.cs) (revision f8c28b3b04cdabb62ea37772efcb1f4ebbbf2b9e) +++ Ringtoets/Common/src/Ringtoets.Common.Service/WaveHeightCalculationActivity.cs (.../WaveHeightCalculationActivity.cs) (revision fc4f536da3543bb4d5367d240ed1aef5aa7655da) @@ -32,48 +32,47 @@ /// public class WaveHeightCalculationActivity : HydraRingActivityBase { - private readonly WaveHeightCalculation waveHeightCalculation; private readonly double norm; private readonly string hydraulicBoundaryDatabaseFilePath; private readonly string preprocessorDirectory; private readonly ICalculationMessageProvider messageProvider; private readonly WaveHeightCalculationService calculationService; + private readonly HydraulicBoundaryCalculationWrapper calculationWrapper; /// /// Creates a new instance of . /// - /// The to perform the calculation for. + /// The to perform the calculation for. /// The hydraulic boundary database file that should be used for performing the calculation. /// The preprocessor directory. /// The norm to use during the calculation. /// The provider of the messages to use during the calculation. /// Preprocessing is disabled when equals . - /// Thrown when , - /// , or + /// Thrown when or /// is null. - public WaveHeightCalculationActivity(WaveHeightCalculation waveHeightCalculation, + public WaveHeightCalculationActivity(HydraulicBoundaryCalculationWrapper calculationWrapper, string hydraulicBoundaryDatabaseFilePath, string preprocessorDirectory, double norm, ICalculationMessageProvider messageProvider) { - if (waveHeightCalculation == null) + if (calculationWrapper == null) { - throw new ArgumentNullException(nameof(waveHeightCalculation)); + throw new ArgumentNullException(nameof(calculationWrapper)); } if (messageProvider == null) { throw new ArgumentNullException(nameof(messageProvider)); } - this.waveHeightCalculation = waveHeightCalculation; + this.calculationWrapper = calculationWrapper; this.messageProvider = messageProvider; this.hydraulicBoundaryDatabaseFilePath = hydraulicBoundaryDatabaseFilePath; this.preprocessorDirectory = preprocessorDirectory; this.norm = norm; - Description = messageProvider.GetActivityDescription(waveHeightCalculation.Name); + Description = messageProvider.GetActivityDescription(calculationWrapper.Name); calculationService = new WaveHeightCalculationService(); } @@ -93,12 +92,11 @@ { if (State != ActivityState.Skipped) { - calculationService.Calculate( - waveHeightCalculation, - hydraulicBoundaryDatabaseFilePath, - preprocessorDirectory, - norm, - messageProvider); + calculationService.Calculate(calculationWrapper, + hydraulicBoundaryDatabaseFilePath, + preprocessorDirectory, + norm, + messageProvider); } } @@ -109,14 +107,14 @@ protected override void OnFinish() { - waveHeightCalculation.ObservableObject.NotifyObservers(); + calculationWrapper.ObservableObject.NotifyObservers(); } private bool AlreadyCalculated { get { - return waveHeightCalculation.IsCalculated(); + return calculationWrapper.IsCalculated(); } } } Fisheye: Tag fc4f536da3543bb4d5367d240ed1aef5aa7655da refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Data.Test/Hydraulics/DesignWaterLevelCalculationTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/Hydraulics/HydraulicBoundaryCalculationWrapperTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Data.Test/Hydraulics/HydraulicBoundaryCalculationWrapperTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/Hydraulics/HydraulicBoundaryCalculationWrapperTest.cs (revision fc4f536da3543bb4d5367d240ed1aef5aa7655da) @@ -0,0 +1,133 @@ +// Copyright (C) Stichting Deltares 2017. 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 NUnit.Framework; +using Ringtoets.Common.Data.Hydraulics; +using Ringtoets.Common.Data.TestUtil; + +namespace Ringtoets.Common.Data.Test.Hydraulics +{ + [TestFixture] + public class HydraulicBoundaryCalculationWrapperTest + { + private static IEnumerable HydraulicBoundaryLocationCalculationsToPerform + { + get + { + yield return new TestCaseData(new HydraulicBoundaryLocationCalculation + { + InputParameters = + { + ShouldIllustrationPointsBeCalculated = true + }, + Output = new TestHydraulicBoundaryLocationOutput(1.0, CalculationConvergence.CalculatedConverged) + }, true); + + yield return new TestCaseData(new HydraulicBoundaryLocationCalculation(), true); + + yield return new TestCaseData(new HydraulicBoundaryLocationCalculation + { + Output = new TestHydraulicBoundaryLocationOutput(1.0, CalculationConvergence.CalculatedConverged) + }, false); + } + } + + [Test] + public void Constructor_HydraulicBoundaryLocationNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new HydraulicBoundaryCalculationWrapper(null, new HydraulicBoundaryLocationCalculation()); + + // Assert + string paramName = Assert.Throws(call).ParamName; + Assert.AreEqual("hydraulicBoundaryLocation", paramName); + } + + [Test] + public void Constructor_HydraulicBoundaryLocationCalculationNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new HydraulicBoundaryCalculationWrapper(new TestHydraulicBoundaryLocation(), null); + + // Assert + string paramName = Assert.Throws(call).ParamName; + Assert.AreEqual("hydraulicBoundaryLocationCalculation", paramName); + } + + [Test] + public void Constructor_ValidInputParameters_SetsProperties([Values(true, false)] bool calculateIllustrationPoints) + { + // Setup + var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation(); + var hydraulicBoundaryLocationCalculation = new HydraulicBoundaryLocationCalculation + { + InputParameters = + { + ShouldIllustrationPointsBeCalculated = calculateIllustrationPoints + } + }; + + // Call + var calculation = new HydraulicBoundaryCalculationWrapper(hydraulicBoundaryLocation, hydraulicBoundaryLocationCalculation); + + // Assert + Assert.IsInstanceOf(calculation); + Assert.AreEqual(hydraulicBoundaryLocation.Id, calculation.Id); + Assert.AreSame(hydraulicBoundaryLocation.Name, calculation.Name); + Assert.AreEqual(hydraulicBoundaryLocationCalculation.InputParameters.ShouldIllustrationPointsBeCalculated, calculation.CalculateIllustrationPoints); + Assert.AreSame(hydraulicBoundaryLocation, calculation.ObservableObject); + } + + [Test] + [TestCaseSource(nameof(HydraulicBoundaryLocationCalculationsToPerform))] + public void IsCalculated_NotFullyCalculated_ReturnIsCalculated(HydraulicBoundaryLocationCalculation hydraulicBoundaryLocationCalculation, + bool shouldBeCalculated) + { + // Setup + var calculationWrapper = new HydraulicBoundaryCalculationWrapper(new TestHydraulicBoundaryLocation(), + hydraulicBoundaryLocationCalculation); + + // Call + bool isCalculated = calculationWrapper.IsCalculated(); + + // Assert + Assert.AreEqual(!shouldBeCalculated, isCalculated); + } + + [Test] + public void Output_ValidOutput_SetsOutput() + { + // Setup + var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation(); + var hydraulicBoundaryLocationCalculation = new HydraulicBoundaryLocationCalculation(); + var calculation = new HydraulicBoundaryCalculationWrapper(hydraulicBoundaryLocation, hydraulicBoundaryLocationCalculation); + var output = new TestHydraulicBoundaryLocationOutput(1); + + // Call + calculation.Output = output; + + // Assert + Assert.AreSame(hydraulicBoundaryLocationCalculation.Output, output); + } + } +} \ No newline at end of file Fisheye: Tag fc4f536da3543bb4d5367d240ed1aef5aa7655da refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Data.Test/Hydraulics/WaveHeightCalculationTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/Ringtoets.Common.Data.Test.csproj =================================================================== diff -u -r63fc151e9cf722527465c1eddfa6567a90feb5e6 -rfc4f536da3543bb4d5367d240ed1aef5aa7655da --- Ringtoets/Common/test/Ringtoets.Common.Data.Test/Ringtoets.Common.Data.Test.csproj (.../Ringtoets.Common.Data.Test.csproj) (revision 63fc151e9cf722527465c1eddfa6567a90feb5e6) +++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/Ringtoets.Common.Data.Test.csproj (.../Ringtoets.Common.Data.Test.csproj) (revision fc4f536da3543bb4d5367d240ed1aef5aa7655da) @@ -43,7 +43,7 @@ - + @@ -68,7 +68,6 @@ - Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/DesignWaterLevelCalculationActivityTest.cs =================================================================== diff -u -r3fba9fdabe9b04e4b6fa298c604aaae36d678396 -rfc4f536da3543bb4d5367d240ed1aef5aa7655da --- Ringtoets/Common/test/Ringtoets.Common.Service.Test/DesignWaterLevelCalculationActivityTest.cs (.../DesignWaterLevelCalculationActivityTest.cs) (revision 3fba9fdabe9b04e4b6fa298c604aaae36d678396) +++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/DesignWaterLevelCalculationActivityTest.cs (.../DesignWaterLevelCalculationActivityTest.cs) (revision fc4f536da3543bb4d5367d240ed1aef5aa7655da) @@ -80,14 +80,14 @@ const string activityDescription = "GetActivityDescription"; var calculation = new HydraulicBoundaryLocationCalculation(); - var designWaterLevelCalculation = new DesignWaterLevelCalculation(new TestHydraulicBoundaryLocation(locationName), calculation); + var calculationWrapper = new HydraulicBoundaryCalculationWrapper(new TestHydraulicBoundaryLocation(locationName), calculation); var calculationMessageProvider = mockRepository.StrictMock(); calculationMessageProvider.Expect(calc => calc.GetActivityDescription(locationName)).Return(activityDescription); mockRepository.ReplayAll(); // Call - var activity = new DesignWaterLevelCalculationActivity(designWaterLevelCalculation, + var activity = new DesignWaterLevelCalculationActivity(calculationWrapper, validFilePath, validPreprocessorDirectory, 1, @@ -105,10 +105,10 @@ public void ParameteredConstructor_CalculationServiceMessageProviderNull_ThrowsArgumentNullException() { // Setup - var calculation = new DesignWaterLevelCalculation(new TestHydraulicBoundaryLocation(), new HydraulicBoundaryLocationCalculation()); + var calculationWrapper = new HydraulicBoundaryCalculationWrapper(new TestHydraulicBoundaryLocation(), new HydraulicBoundaryLocationCalculation()); // Call - TestDelegate call = () => new DesignWaterLevelCalculationActivity(calculation, + TestDelegate call = () => new DesignWaterLevelCalculationActivity(calculationWrapper, validFilePath, validPreprocessorDirectory, 1, @@ -120,7 +120,7 @@ } [Test] - public void ParameteredConstructor_DesignWaterLevelCalculationNull_ThrowsArgumentNullException() + public void ParameteredConstructor_CalculationWrapperNull_ThrowsArgumentNullException() { // Setup var calculationMessageProvider = mockRepository.Stub(); @@ -147,13 +147,13 @@ const string locationName = "testLocation"; const string activityDescription = "activityDescription"; - var calculation = new DesignWaterLevelCalculation(new TestHydraulicBoundaryLocation(locationName), new HydraulicBoundaryLocationCalculation()); + var calculationWrapper = new HydraulicBoundaryCalculationWrapper(new TestHydraulicBoundaryLocation(locationName), new HydraulicBoundaryLocationCalculation()); var calculationMessageProvider = mockRepository.StrictMock(); calculationMessageProvider.Expect(calc => calc.GetActivityDescription(locationName)).Return(activityDescription); mockRepository.ReplayAll(); - var activity = new DesignWaterLevelCalculationActivity(calculation, + var activity = new DesignWaterLevelCalculationActivity(calculationWrapper, invalidFilePath, validPreprocessorDirectory, 1, @@ -184,13 +184,13 @@ const string locationName = "testLocation"; const string activityDescription = "activityDescription"; - var calculation = new DesignWaterLevelCalculation(new TestHydraulicBoundaryLocation(locationName), new HydraulicBoundaryLocationCalculation()); + var calculationWrapper = new HydraulicBoundaryCalculationWrapper(new TestHydraulicBoundaryLocation(locationName), new HydraulicBoundaryLocationCalculation()); var calculationMessageProvider = mockRepository.StrictMock(); calculationMessageProvider.Expect(calc => calc.GetActivityDescription(locationName)).Return(activityDescription); mockRepository.ReplayAll(); - var activity = new DesignWaterLevelCalculationActivity(calculation, + var activity = new DesignWaterLevelCalculationActivity(calculationWrapper, validFilePath, invalidPreprocessorDirectory, 1, @@ -221,7 +221,7 @@ const string activityDescription = "activityDescription"; const double norm = 1.0 / 30; - var calculation = new DesignWaterLevelCalculation(new TestHydraulicBoundaryLocation(locationName), new HydraulicBoundaryLocationCalculation()); + var calculationWrapper = new HydraulicBoundaryCalculationWrapper(new TestHydraulicBoundaryLocation(locationName), new HydraulicBoundaryLocationCalculation()); var calculator = new TestDesignWaterLevelCalculator { Converged = true @@ -233,7 +233,7 @@ calculationMessageProvider.Stub(calc => calc.GetActivityDescription(locationName)).Return(activityDescription); mockRepository.ReplayAll(); - var activity = new DesignWaterLevelCalculationActivity(calculation, + var activity = new DesignWaterLevelCalculationActivity(calculationWrapper, validFilePath, validPreprocessorDirectory, norm, @@ -259,7 +259,7 @@ AssessmentLevelCalculationInput designWaterLevelCalculationInput = calculator.ReceivedInputs.Single(); - Assert.AreEqual(calculation.Id, designWaterLevelCalculationInput.HydraulicBoundaryLocationId); + Assert.AreEqual(calculationWrapper.Id, designWaterLevelCalculationInput.HydraulicBoundaryLocationId); Assert.AreEqual(StatisticsConverter.ProbabilityToReliability(norm), designWaterLevelCalculationInput.Beta); } @@ -288,9 +288,9 @@ Output = new TestHydraulicBoundaryLocationOutput(3.0, CalculationConvergence.CalculatedConverged) }; - var calculation = new DesignWaterLevelCalculation(hydraulicBoundaryLocation, hydraulicBoundaryLocationCalculation); + var calculationWrapper = new HydraulicBoundaryCalculationWrapper(hydraulicBoundaryLocation, hydraulicBoundaryLocationCalculation); - var activity = new DesignWaterLevelCalculationActivity(calculation, + var activity = new DesignWaterLevelCalculationActivity(calculationWrapper, validFilePath, validPreprocessorDirectory, norm, @@ -332,9 +332,9 @@ calculationMessageProvider.Expect(calc => calc.GetActivityDescription(locationName)).Return(string.Empty); mockRepository.ReplayAll(); - var calculation = new DesignWaterLevelCalculation(hydraulicBoundaryLocation, hydraulicBoundaryLocationCalculation); + var calculationWrapper = new HydraulicBoundaryCalculationWrapper(hydraulicBoundaryLocation, hydraulicBoundaryLocationCalculation); - var activity = new DesignWaterLevelCalculationActivity(calculation, + var activity = new DesignWaterLevelCalculationActivity(calculationWrapper, validFilePath, validPreprocessorDirectory, norm, @@ -401,9 +401,9 @@ Output = output }; - var calculation = new DesignWaterLevelCalculation(hydraulicBoundaryLocation, hydraulicBoundaryLocationCalculation); + var calculationWrapper = new HydraulicBoundaryCalculationWrapper(hydraulicBoundaryLocation, hydraulicBoundaryLocationCalculation); - var activity = new DesignWaterLevelCalculationActivity(calculation, + var activity = new DesignWaterLevelCalculationActivity(calculationWrapper, validFilePath, validPreprocessorDirectory, 30, @@ -453,10 +453,10 @@ Output = new TestHydraulicBoundaryLocationOutput(double.NaN, CalculationConvergence.CalculatedConverged) }; - var calculation = new DesignWaterLevelCalculation(hydraulicBoundaryLocation, hydraulicBoundaryLocationCalculation); + var calculationWrapper = new HydraulicBoundaryCalculationWrapper(hydraulicBoundaryLocation, hydraulicBoundaryLocationCalculation); const double norm = 1.0 / 300; - var activity = new DesignWaterLevelCalculationActivity(calculation, + var activity = new DesignWaterLevelCalculationActivity(calculationWrapper, validFilePath, validPreprocessorDirectory, norm, @@ -512,10 +512,10 @@ mockRepository.ReplayAll(); - var calculation = new DesignWaterLevelCalculation(hydraulicBoundaryLocation, new HydraulicBoundaryLocationCalculation()); + var calculationWrapper = new HydraulicBoundaryCalculationWrapper(hydraulicBoundaryLocation, new HydraulicBoundaryLocationCalculation()); const double norm = 1.0 / 30; - var activity = new DesignWaterLevelCalculationActivity(calculation, + var activity = new DesignWaterLevelCalculationActivity(calculationWrapper, validFilePath, validPreprocessorDirectory, norm, @@ -542,15 +542,15 @@ { // Setup var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation(); - var calculation = new DesignWaterLevelCalculation(hydraulicBoundaryLocation, new HydraulicBoundaryLocationCalculation()); + var calculationWrapper = new HydraulicBoundaryCalculationWrapper(hydraulicBoundaryLocation, new HydraulicBoundaryLocationCalculation()); var calculationMessageProvider = mockRepository.Stub(); var observer = mockRepository.StrictMock(); observer.Expect(o => o.UpdateObserver()); hydraulicBoundaryLocation.Attach(observer); mockRepository.ReplayAll(); - var activity = new TestDesignWaterLevelCalculationActivity(calculation, + var activity = new TestDesignWaterLevelCalculationActivity(calculationWrapper, validFilePath, validPreprocessorDirectory, 1.0, @@ -566,13 +566,13 @@ private class TestDesignWaterLevelCalculationActivity : DesignWaterLevelCalculationActivity { - public TestDesignWaterLevelCalculationActivity(DesignWaterLevelCalculation designWaterLevelCalculation, + public TestDesignWaterLevelCalculationActivity(HydraulicBoundaryCalculationWrapper calculationWrapper, string hydraulicBoundaryDatabaseFilePath, string preprocessorDirectory, double norm, ICalculationMessageProvider messageProvider, ActivityState state) - : base(designWaterLevelCalculation, + : base(calculationWrapper, hydraulicBoundaryDatabaseFilePath, preprocessorDirectory, norm, Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/WaveHeightCalculationActivityTest.cs =================================================================== diff -u -r3fba9fdabe9b04e4b6fa298c604aaae36d678396 -rfc4f536da3543bb4d5367d240ed1aef5aa7655da --- Ringtoets/Common/test/Ringtoets.Common.Service.Test/WaveHeightCalculationActivityTest.cs (.../WaveHeightCalculationActivityTest.cs) (revision 3fba9fdabe9b04e4b6fa298c604aaae36d678396) +++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/WaveHeightCalculationActivityTest.cs (.../WaveHeightCalculationActivityTest.cs) (revision fc4f536da3543bb4d5367d240ed1aef5aa7655da) @@ -79,14 +79,14 @@ const string activityDescription = "activityDescription"; var calculation = new HydraulicBoundaryLocationCalculation(); - var waveHeightCalculation = new WaveHeightCalculation(new TestHydraulicBoundaryLocation(locationName), calculation); + var calculationWrapper = new HydraulicBoundaryCalculationWrapper(new TestHydraulicBoundaryLocation(locationName), calculation); var calculationMessageProvider = mockRepository.Stub(); calculationMessageProvider.Stub(calc => calc.GetActivityDescription(locationName)).Return(activityDescription); mockRepository.ReplayAll(); // Call - var activity = new WaveHeightCalculationActivity(waveHeightCalculation, validFilePath, validPreprocessorDirectory, 1, calculationMessageProvider); + var activity = new WaveHeightCalculationActivity(calculationWrapper, validFilePath, validPreprocessorDirectory, 1, calculationMessageProvider); // Assert Assert.IsInstanceOf(activity); @@ -100,18 +100,18 @@ public void ParameteredConstructor_CalculationServiceMessageProviderNull_ThrowsArgumentNullException() { // Setup - var calculation = new WaveHeightCalculation(new TestHydraulicBoundaryLocation(), new HydraulicBoundaryLocationCalculation()); + var calculationWrapper = new HydraulicBoundaryCalculationWrapper(new TestHydraulicBoundaryLocation(), new HydraulicBoundaryLocationCalculation()); // Call - TestDelegate call = () => new WaveHeightCalculationActivity(calculation, validFilePath, validPreprocessorDirectory, 1, null); + TestDelegate call = () => new WaveHeightCalculationActivity(calculationWrapper, validFilePath, validPreprocessorDirectory, 1, null); // Assert var exception = Assert.Throws(call); Assert.AreEqual("messageProvider", exception.ParamName); } [Test] - public void ParameteredConstructor_WaveHeightCalculationNull_ThrowsArgumentNullException() + public void ParameteredConstructor_CalculationWrapperNull_ThrowsArgumentNullException() { // Setup var calculationMessageProvider = mockRepository.StrictMock(); @@ -134,13 +134,13 @@ const string locationName = "testLocation"; const string activityDescription = "activityDescription"; - var calculation = new WaveHeightCalculation(new TestHydraulicBoundaryLocation(locationName), new HydraulicBoundaryLocationCalculation()); + var calculationWrapper = new HydraulicBoundaryCalculationWrapper(new TestHydraulicBoundaryLocation(locationName), new HydraulicBoundaryLocationCalculation()); var calculationMessageProvider = mockRepository.StrictMock(); calculationMessageProvider.Stub(calc => calc.GetActivityDescription(locationName)).Return(activityDescription); mockRepository.ReplayAll(); - var activity = new WaveHeightCalculationActivity(calculation, invalidFilePath, validPreprocessorDirectory, 1, calculationMessageProvider); + var activity = new WaveHeightCalculationActivity(calculationWrapper, invalidFilePath, validPreprocessorDirectory, 1, calculationMessageProvider); // Call Action call = () => activity.Run(); @@ -166,13 +166,13 @@ const string locationName = "testLocation"; const string activityDescription = "activityDescription"; - var calculation = new WaveHeightCalculation(new TestHydraulicBoundaryLocation(locationName), new HydraulicBoundaryLocationCalculation()); + var calculationWrapper = new HydraulicBoundaryCalculationWrapper(new TestHydraulicBoundaryLocation(locationName), new HydraulicBoundaryLocationCalculation()); var calculationMessageProvider = mockRepository.StrictMock(); calculationMessageProvider.Expect(calc => calc.GetActivityDescription(locationName)).Return(activityDescription); mockRepository.ReplayAll(); - var activity = new WaveHeightCalculationActivity(calculation, + var activity = new WaveHeightCalculationActivity(calculationWrapper, validFilePath, invalidPreprocessorDirectory, 1, @@ -203,7 +203,7 @@ const string activityDescription = "activityDescription"; const double norm = 1.0 / 30; - var calculation = new WaveHeightCalculation(new TestHydraulicBoundaryLocation(locationName), new HydraulicBoundaryLocationCalculation()); + var calculationWrapper = new HydraulicBoundaryCalculationWrapper(new TestHydraulicBoundaryLocation(locationName), new HydraulicBoundaryLocationCalculation()); var calculator = new TestWaveHeightCalculator { Converged = true @@ -215,7 +215,7 @@ calculationMessageProvider.Stub(calc => calc.GetActivityDescription(locationName)).Return(activityDescription); mockRepository.ReplayAll(); - var activity = new WaveHeightCalculationActivity(calculation, + var activity = new WaveHeightCalculationActivity(calculationWrapper, validFilePath, validPreprocessorDirectory, norm, @@ -240,7 +240,7 @@ }); WaveHeightCalculationInput waveHeightCalculationInput = calculator.ReceivedInputs.Single(); - Assert.AreEqual(calculation.Id, waveHeightCalculationInput.HydraulicBoundaryLocationId); + Assert.AreEqual(calculationWrapper.Id, waveHeightCalculationInput.HydraulicBoundaryLocationId); Assert.AreEqual(StatisticsConverter.ProbabilityToReliability(norm), waveHeightCalculationInput.Beta); } @@ -269,9 +269,9 @@ Output = new TestHydraulicBoundaryLocationOutput(3.0, CalculationConvergence.CalculatedConverged) }; - var calculation = new WaveHeightCalculation(hydraulicBoundaryLocation, hydraulicBoundaryLocationCalculation); + var calculationWrapper = new HydraulicBoundaryCalculationWrapper(hydraulicBoundaryLocation, hydraulicBoundaryLocationCalculation); - var activity = new WaveHeightCalculationActivity(calculation, + var activity = new WaveHeightCalculationActivity(calculationWrapper, validFilePath, validPreprocessorDirectory, norm, @@ -313,9 +313,9 @@ calculationMessageProvider.Stub(calc => calc.GetActivityDescription(locationName)).Return(string.Empty); mockRepository.ReplayAll(); - var calculation = new WaveHeightCalculation(hydraulicBoundaryLocation, hydraulicBoundaryLocationCalculation); + var calculationWrapper = new HydraulicBoundaryCalculationWrapper(hydraulicBoundaryLocation, hydraulicBoundaryLocationCalculation); - var activity = new WaveHeightCalculationActivity(calculation, + var activity = new WaveHeightCalculationActivity(calculationWrapper, validFilePath, validPreprocessorDirectory, norm, @@ -382,9 +382,9 @@ Output = output }; - var calculation = new WaveHeightCalculation(hydraulicBoundaryLocation, hydraulicBoundaryLocationCalculation); + var calculationWrapper = new HydraulicBoundaryCalculationWrapper(hydraulicBoundaryLocation, hydraulicBoundaryLocationCalculation); - var activity = new WaveHeightCalculationActivity(calculation, + var activity = new WaveHeightCalculationActivity(calculationWrapper, validFilePath, validPreprocessorDirectory, 30, @@ -434,10 +434,10 @@ Output = new TestHydraulicBoundaryLocationOutput(double.NaN, CalculationConvergence.CalculatedConverged) }; - var calculation = new WaveHeightCalculation(hydraulicBoundaryLocation, hydraulicBoundaryLocationCalculation); + var calculationWrapper = new HydraulicBoundaryCalculationWrapper(hydraulicBoundaryLocation, hydraulicBoundaryLocationCalculation); const double norm = 1.0 / 300; - var activity = new WaveHeightCalculationActivity(calculation, + var activity = new WaveHeightCalculationActivity(calculationWrapper, validFilePath, validPreprocessorDirectory, norm, @@ -494,10 +494,10 @@ calculationMessageProvider.Stub(calc => calc.GetCalculatedNotConvergedMessage(locationName)).Return(string.Empty); mockRepository.ReplayAll(); - var calculation = new WaveHeightCalculation(hydraulicBoundaryLocation, new HydraulicBoundaryLocationCalculation()); + var calculationWrapper = new HydraulicBoundaryCalculationWrapper(hydraulicBoundaryLocation, new HydraulicBoundaryLocationCalculation()); const double norm = 1.0 / 30; - var activity = new WaveHeightCalculationActivity(calculation, + var activity = new WaveHeightCalculationActivity(calculationWrapper, validFilePath, validPreprocessorDirectory, norm, @@ -524,15 +524,15 @@ { // Setup var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation(); - var calculation = new WaveHeightCalculation(hydraulicBoundaryLocation, new HydraulicBoundaryLocationCalculation()); + var calculationWrapper = new HydraulicBoundaryCalculationWrapper(hydraulicBoundaryLocation, new HydraulicBoundaryLocationCalculation()); var calculationMessageProvider = mockRepository.Stub(); var observer = mockRepository.StrictMock(); observer.Expect(o => o.UpdateObserver()); hydraulicBoundaryLocation.Attach(observer); mockRepository.ReplayAll(); - var activity = new TestWaveHeightCalculationActivity(calculation, + var activity = new TestWaveHeightCalculationActivity(calculationWrapper, validFilePath, validPreprocessorDirectory, 1.0, @@ -548,13 +548,13 @@ private class TestWaveHeightCalculationActivity : WaveHeightCalculationActivity { - public TestWaveHeightCalculationActivity(WaveHeightCalculation waveHeightCalculation, + public TestWaveHeightCalculationActivity(HydraulicBoundaryCalculationWrapper calculationWrapper, string hydraulicBoundaryDatabaseFilePath, string preprocessorDirectory, double norm, ICalculationMessageProvider messageProvider, ActivityState state) - : base(waveHeightCalculation, + : base(calculationWrapper, hydraulicBoundaryDatabaseFilePath, preprocessorDirectory, norm,