Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Service/GrassCoverErosionOutwardsWaveConditionsCalculationActivity.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Service/GrassCoverErosionOutwardsWaveConditionsCalculationActivity.cs (revision 0) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Service/GrassCoverErosionOutwardsWaveConditionsCalculationActivity.cs (revision 85e95a2b6e8fd7a873ba166ddfba608f2466a40c) @@ -0,0 +1,90 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using Core.Common.Base.Service; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.GrassCoverErosionOutwards.Data; +using Ringtoets.HydraRing.Calculation.Activities; +using Ringtoets.Revetment.Data; + +namespace Ringtoets.GrassCoverErosionOutwards.Service +{ + /// + /// for running a grass cover erosion outwards wave conditions calculation. + /// + public class GrassCoverErosionOutwardsWaveConditionsCalculationActivity : HydraRingActivity> + { + private readonly GrassCoverErosionOutwardsWaveConditionsCalculation calculation; + private readonly string hlcdDirectory; + private readonly GrassCoverErosionOutwardsFailureMechanism failureMechanism; + private readonly IAssessmentSection assessmentSection; + + /// + /// Creates a new instance of . + /// + /// The grass cover erosion outwards wave conditions data used for the calculation. + /// The directory of the HLCD file that should be used for performing the calculation. + /// The failure mechanism the calculation belongs to. + /// The assessment section the calculation belongs to. + /// Thrown when any input argument is null. + public GrassCoverErosionOutwardsWaveConditionsCalculationActivity(GrassCoverErosionOutwardsWaveConditionsCalculation calculation, + string hlcdDirectory, + GrassCoverErosionOutwardsFailureMechanism failureMechanism, + IAssessmentSection assessmentSection) + { + if (calculation == null) + { + throw new ArgumentNullException("calculation"); + } + if (hlcdDirectory == null) + { + throw new ArgumentNullException("hlcdDirectory"); + } + if (failureMechanism == null) + { + throw new ArgumentNullException("failureMechanism"); + } + if (assessmentSection == null) + { + throw new ArgumentNullException("assessmentSection"); + } + + this.calculation = calculation; + this.hlcdDirectory = hlcdDirectory; + this.failureMechanism = failureMechanism; + this.assessmentSection = assessmentSection; + + Name = calculation.Name; + } + + protected override void OnRun() + { + throw new System.NotImplementedException(); + } + + protected override void OnFinish() + { + throw new System.NotImplementedException(); + } + } +} \ No newline at end of file Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Service/Ringtoets.GrassCoverErosionOutwards.Service.csproj =================================================================== diff -u -r06b2840a2bb64c0960c8ac29322b5a0971c73c77 -r85e95a2b6e8fd7a873ba166ddfba608f2466a40c --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Service/Ringtoets.GrassCoverErosionOutwards.Service.csproj (.../Ringtoets.GrassCoverErosionOutwards.Service.csproj) (revision 06b2840a2bb64c0960c8ac29322b5a0971c73c77) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Service/Ringtoets.GrassCoverErosionOutwards.Service.csproj (.../Ringtoets.GrassCoverErosionOutwards.Service.csproj) (revision 85e95a2b6e8fd7a873ba166ddfba608f2466a40c) @@ -39,6 +39,7 @@ Properties\GlobalAssembly.cs + @@ -53,11 +54,31 @@ + + {3bbfd65b-b277-4e50-ae6d-bd24c3434609} + Core.Common.Base + False + + + {D4200F43-3F72-4F42-AF0A-8CED416A38EC} + Ringtoets.Common.Data + False + {D951D6DA-FE83-4920-9FDB-63BF96480B54} Ringtoets.Common.Service False + + {888D4097-8BC2-4703-9FB1-8744C94D525E} + Ringtoets.HydraRing.Calculation + False + + + {87C2C553-C0BC-40BF-B1EA-B83BFF357F27} + Ringtoets.Revetment.Data + False + {E7225477-577F-4A17-B7EC-6721158E1543} Ringtoets.GrassCoverErosionOutwards.Data Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Service.Test/GrassCoverErosionOutwardsWaveConditionsCalculationActivityTest.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Service.Test/GrassCoverErosionOutwardsWaveConditionsCalculationActivityTest.cs (revision 0) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Service.Test/GrassCoverErosionOutwardsWaveConditionsCalculationActivityTest.cs (revision 85e95a2b6e8fd7a873ba166ddfba608f2466a40c) @@ -0,0 +1,133 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using Core.Common.Base.Service; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.GrassCoverErosionOutwards.Data; +using Ringtoets.HydraRing.Calculation.Activities; +using Ringtoets.Revetment.Data; + +namespace Ringtoets.GrassCoverErosionOutwards.Service.Test +{ + [TestFixture] + public class GrassCoverErosionOutwardsWaveConditionsCalculationActivityTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Setup + var mocks = new MockRepository(); + var assessmentSectionMock = mocks.StrictMock(); + mocks.ReplayAll(); + + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); + var calculation = new GrassCoverErosionOutwardsWaveConditionsCalculation(); + + // Call + var activity = new GrassCoverErosionOutwardsWaveConditionsCalculationActivity(calculation, string.Empty, failureMechanism, assessmentSectionMock); + + // Assert + Assert.IsInstanceOf>>(activity); + Assert.IsNull(activity.ProgressText); + Assert.AreEqual(ActivityState.None, activity.State); + Assert.AreEqual(calculation.Name, activity.Name); + + mocks.VerifyAll(); + } + + [Test] + public void Constructor_CalculationNull_ThrowsArgumentNullException() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.StrictMock(); + mocks.ReplayAll(); + + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); + + // Call + TestDelegate test = () => new GrassCoverErosionOutwardsWaveConditionsCalculationActivity(null, string.Empty, failureMechanism, assessmentSection); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("calculation", exception.ParamName); + mocks.VerifyAll(); + } + + [Test] + public void Constructor_HlcdDirectoryNull_ThrowsArgumentNullException() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.StrictMock(); + mocks.ReplayAll(); + + var calculation = new GrassCoverErosionOutwardsWaveConditionsCalculation(); + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); + + // Call + TestDelegate test = () => new GrassCoverErosionOutwardsWaveConditionsCalculationActivity(calculation, null, failureMechanism, assessmentSection); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("hlcdDirectory", exception.ParamName); + mocks.VerifyAll(); + } + + [Test] + public void Constructor_FailureMechanismNull_ThrowsArgumentNullException() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.StrictMock(); + mocks.ReplayAll(); + + var calculation = new GrassCoverErosionOutwardsWaveConditionsCalculation(); + + // Call + TestDelegate test = () => new GrassCoverErosionOutwardsWaveConditionsCalculationActivity(calculation, string.Empty, null, assessmentSection); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("failureMechanism", exception.ParamName); + mocks.VerifyAll(); + } + + [Test] + public void Constructor_AssessmentSectionNull_ThrowsArgumentNullException() + { + // Setup + var calculation = new GrassCoverErosionOutwardsWaveConditionsCalculation(); + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); + + // Call + TestDelegate test = () => new GrassCoverErosionOutwardsWaveConditionsCalculationActivity(calculation, string.Empty, failureMechanism, null); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("assessmentSection", exception.ParamName); + } + } +} \ No newline at end of file Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Service.Test/Ringtoets.GrassCoverErosionOutwards.Service.Test.csproj =================================================================== diff -u -r06b2840a2bb64c0960c8ac29322b5a0971c73c77 -r85e95a2b6e8fd7a873ba166ddfba608f2466a40c --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Service.Test/Ringtoets.GrassCoverErosionOutwards.Service.Test.csproj (.../Ringtoets.GrassCoverErosionOutwards.Service.Test.csproj) (revision 06b2840a2bb64c0960c8ac29322b5a0971c73c77) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Service.Test/Ringtoets.GrassCoverErosionOutwards.Service.Test.csproj (.../Ringtoets.GrassCoverErosionOutwards.Service.Test.csproj) (revision 85e95a2b6e8fd7a873ba166ddfba608f2466a40c) @@ -41,13 +41,18 @@ ..\..\..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll True + + ..\..\..\..\packages\RhinoMocks.3.6.1\lib\net\Rhino.Mocks.dll + True + Properties\GlobalAssembly.cs + @@ -58,10 +63,30 @@ + + {3bbfd65b-b277-4e50-ae6d-bd24c3434609} + Core.Common.Base + + + {D4200F43-3F72-4F42-AF0A-8CED416A38EC} + Ringtoets.Common.Data + {d951d6da-fe83-4920-9fdb-63bf96480b54} Ringtoets.Common.Service + + {888D4097-8BC2-4703-9FB1-8744C94D525E} + Ringtoets.HydraRing.Calculation + + + {87C2C553-C0BC-40BF-B1EA-B83BFF357F27} + Ringtoets.Revetment.Data + + + {E7225477-577F-4A17-B7EC-6721158E1543} + Ringtoets.GrassCoverErosionOutwards.Data + {18E9F7C8-3170-4E9D-8D9F-1378225EED90} Ringtoets.GrassCoverErosionOutwards.Service Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Service.Test/packages.config =================================================================== diff -u -r06b2840a2bb64c0960c8ac29322b5a0971c73c77 -r85e95a2b6e8fd7a873ba166ddfba608f2466a40c --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Service.Test/packages.config (.../packages.config) (revision 06b2840a2bb64c0960c8ac29322b5a0971c73c77) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Service.Test/packages.config (.../packages.config) (revision 85e95a2b6e8fd7a873ba166ddfba608f2466a40c) @@ -23,4 +23,5 @@ --> + \ No newline at end of file