Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Activities/HydraRingActivity.cs =================================================================== diff -u --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Activities/HydraRingActivity.cs (revision 0) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Activities/HydraRingActivity.cs (revision e4613b1908b45105cdc5be7f3fb2f4fad823473e) @@ -0,0 +1,54 @@ +// 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.Service; + +namespace Ringtoets.HydraRing.Calculation.Activities +{ + /// + /// for running calculations via Hydra-Ring. + /// + public abstract class HydraRingActivity : Activity + { + private readonly Action beforeRunAction; + + /// + /// Creates a new instance of the class. + /// + /// The action to perform before running a Hydra-Ring calculation (like clearing output, validation, etc.). + /// Thrown when is null. + protected HydraRingActivity(Action beforeRunAction) + { + if (beforeRunAction == null) + { + throw new ArgumentNullException("beforeRunAction", @"The action to perform before run should be set."); + } + + this.beforeRunAction = beforeRunAction; + } + + protected override void OnRun() + { + beforeRunAction(); + } + } +} Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Ringtoets.HydraRing.Calculation.csproj =================================================================== diff -u -r74f9fae7e26c7ba15c1ef5681c51acf842f76122 -re4613b1908b45105cdc5be7f3fb2f4fad823473e --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Ringtoets.HydraRing.Calculation.csproj (.../Ringtoets.HydraRing.Calculation.csproj) (revision 74f9fae7e26c7ba15c1ef5681c51acf842f76122) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Ringtoets.HydraRing.Calculation.csproj (.../Ringtoets.HydraRing.Calculation.csproj) (revision e4613b1908b45105cdc5be7f3fb2f4fad823473e) @@ -48,6 +48,7 @@ Properties\GlobalAssembly.cs + Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Activities/HydraRingActivityTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Activities/HydraRingActivityTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Activities/HydraRingActivityTest.cs (revision e4613b1908b45105cdc5be7f3fb2f4fad823473e) @@ -0,0 +1,51 @@ +// 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 NUnit.Framework; +using Ringtoets.HydraRing.Calculation.Activities; + +namespace Ringtoets.HydraRing.Calculation.Test.Activities +{ + [TestFixture] + public class HydraRingActivityTest + { + [Test] + public void Constructor_BeforeRunActionNull_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => new TestHydraRingActivity(null); + + // Assert + var paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("beforeRunAction", paramName); + } + + private class TestHydraRingActivity : HydraRingActivity + { + public TestHydraRingActivity(Action beforeRunAction) : base(beforeRunAction) {} + + protected override void OnCancel() {} + + protected override void OnFinish() {} + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Ringtoets.HydraRing.Calculation.Test.csproj =================================================================== diff -u -r74f9fae7e26c7ba15c1ef5681c51acf842f76122 -re4613b1908b45105cdc5be7f3fb2f4fad823473e --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Ringtoets.HydraRing.Calculation.Test.csproj (.../Ringtoets.HydraRing.Calculation.Test.csproj) (revision 74f9fae7e26c7ba15c1ef5681c51acf842f76122) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Ringtoets.HydraRing.Calculation.Test.csproj (.../Ringtoets.HydraRing.Calculation.Test.csproj) (revision e4613b1908b45105cdc5be7f3fb2f4fad823473e) @@ -61,6 +61,7 @@ + Index: Ringtoets/Piping/src/Ringtoets.Piping.Service/PipingCalculationActivity.cs =================================================================== diff -u -r74e3dea657b90b371e265914bee337c76e509d93 -re4613b1908b45105cdc5be7f3fb2f4fad823473e --- Ringtoets/Piping/src/Ringtoets.Piping.Service/PipingCalculationActivity.cs (.../PipingCalculationActivity.cs) (revision 74e3dea657b90b371e265914bee337c76e509d93) +++ Ringtoets/Piping/src/Ringtoets.Piping.Service/PipingCalculationActivity.cs (.../PipingCalculationActivity.cs) (revision e4613b1908b45105cdc5be7f3fb2f4fad823473e) @@ -57,7 +57,7 @@ } LogMessages.Clear(); - calculation.Output = null; + calculation.ClearOutput();; PipingCalculationService.Calculate(calculation); PipingSemiProbabilisticCalculationService.Calculate(calculation);