Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Service.Test/ClosingStructuresCalculationActivityTest.cs =================================================================== diff -u -rec3dd34acf5bd7b86906fd57db007010b39aa149 -r6ac5917aa7fd76c41f389c1f649b2449229925d8 --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Service.Test/ClosingStructuresCalculationActivityTest.cs (.../ClosingStructuresCalculationActivityTest.cs) (revision ec3dd34acf5bd7b86906fd57db007010b39aa149) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Service.Test/ClosingStructuresCalculationActivityTest.cs (.../ClosingStructuresCalculationActivityTest.cs) (revision 6ac5917aa7fd76c41f389c1f649b2449229925d8) @@ -26,6 +26,7 @@ using Ringtoets.ClosingStructures.Data; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.Structures; +using Ringtoets.HydraRing.Calculation.Activities; namespace Ringtoets.ClosingStructures.Service.Test { @@ -47,7 +48,7 @@ var activity = new ClosingStructuresCalculationActivity(calculation, "", failureMechanism, assessmentSectionMock); // Assert - Assert.IsInstanceOf(activity); + Assert.IsInstanceOf(activity); Assert.AreEqual(calculation.Name, activity.Name); Assert.IsNull(activity.ProgressText); Assert.AreEqual(ActivityState.None, activity.State); Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Service/Ringtoets.StabilityPointStructures.Service.csproj =================================================================== diff -u -r276a32161f29fcba4af79cf7c7f0aeb254d4db54 -r6ac5917aa7fd76c41f389c1f649b2449229925d8 --- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Service/Ringtoets.StabilityPointStructures.Service.csproj (.../Ringtoets.StabilityPointStructures.Service.csproj) (revision 276a32161f29fcba4af79cf7c7f0aeb254d4db54) +++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Service/Ringtoets.StabilityPointStructures.Service.csproj (.../Ringtoets.StabilityPointStructures.Service.csproj) (revision 6ac5917aa7fd76c41f389c1f649b2449229925d8) @@ -49,6 +49,7 @@ True Resources.resx + Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Service/StabilityPointStructuresCalculationActivity.cs =================================================================== diff -u --- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Service/StabilityPointStructuresCalculationActivity.cs (revision 0) +++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Service/StabilityPointStructuresCalculationActivity.cs (revision 6ac5917aa7fd76c41f389c1f649b2449229925d8) @@ -0,0 +1,97 @@ +// 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; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.Structures; +using Ringtoets.HydraRing.Calculation.Activities; +using Ringtoets.StabilityPointStructures.Data; + +namespace Ringtoets.StabilityPointStructures.Service +{ + /// + /// for running a structures stability point calculation. + /// + public class StabilityPointStructuresCalculationActivity : HydraRingActivityBase + { + private readonly StructuresCalculation calculation; + private readonly StabilityPointStructuresCalculationService calculationService; + private readonly StabilityPointStructuresFailureMechanism failureMechanism; + private readonly IAssessmentSection assessmentSection; + private readonly string hlcdFilepath; + + /// + /// Creates a new instance of . + /// + /// The stability point structures data used for the calculation. + /// The filepath 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 StabilityPointStructuresCalculationActivity(StructuresCalculation calculation, string hlcdFilepath, + StabilityPointStructuresFailureMechanism failureMechanism, IAssessmentSection assessmentSection) + { + if (calculation == null) + { + throw new ArgumentNullException("calculation"); + } + + if (hlcdFilepath == null) + { + throw new ArgumentNullException("hlcdFilepath"); + } + + if (failureMechanism == null) + { + throw new ArgumentNullException("failureMechanism"); + } + + if (assessmentSection == null) + { + throw new ArgumentNullException("assessmentSection"); + } + + this.calculation = calculation; + this.failureMechanism = failureMechanism; + this.assessmentSection = assessmentSection; + this.hlcdFilepath = hlcdFilepath; + + Name = calculation.Name; + calculationService = new StabilityPointStructuresCalculationService(); + } + + protected override void OnCancel() + { + + } + + protected override void OnFinish() + { + throw new NotImplementedException(); + } + + protected override void PerformCalculation() + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Service.Test/Ringtoets.StabilityPointStructures.Service.Test.csproj =================================================================== diff -u -r276a32161f29fcba4af79cf7c7f0aeb254d4db54 -r6ac5917aa7fd76c41f389c1f649b2449229925d8 --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Service.Test/Ringtoets.StabilityPointStructures.Service.Test.csproj (.../Ringtoets.StabilityPointStructures.Service.Test.csproj) (revision 276a32161f29fcba4af79cf7c7f0aeb254d4db54) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Service.Test/Ringtoets.StabilityPointStructures.Service.Test.csproj (.../Ringtoets.StabilityPointStructures.Service.Test.csproj) (revision 6ac5917aa7fd76c41f389c1f649b2449229925d8) @@ -57,6 +57,7 @@ Properties\GlobalAssembly.cs + Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Service.Test/StabilityPointStructuresCalculationActivityTest.cs =================================================================== diff -u --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Service.Test/StabilityPointStructuresCalculationActivityTest.cs (revision 0) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Service.Test/StabilityPointStructuresCalculationActivityTest.cs (revision 6ac5917aa7fd76c41f389c1f649b2449229925d8) @@ -0,0 +1,132 @@ +// 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; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.Structures; +using Ringtoets.HydraRing.Calculation.Activities; +using Ringtoets.StabilityPointStructures.Data; + +namespace Ringtoets.StabilityPointStructures.Service.Test +{ + [TestFixture] + public class StabilityPointStructuresCalculationActivityTest + { + [Test] + public void ParameteredConstructor_ExpectedValues() + { + // Setup + var mocks = new MockRepository(); + var assessmentSectionMock = mocks.Stub(); + mocks.ReplayAll(); + + var failureMechanism = new StabilityPointStructuresFailureMechanism(); + var calculation = new StructuresCalculation(); + + // Call + var activity = new StabilityPointStructuresCalculationActivity(calculation, "", failureMechanism, assessmentSectionMock); + + // Assert + Assert.IsInstanceOf(activity); + Assert.AreEqual(calculation.Name, activity.Name); + Assert.IsNull(activity.ProgressText); + Assert.AreEqual(ActivityState.None, activity.State); + + mocks.VerifyAll(); + } + + [Test] + public void ParameteredConstructor_CalculationNull_ThrowsArgumentNullException() + { + // Setup + var mocks = new MockRepository(); + var assessmentSectionMock = mocks.Stub(); + mocks.ReplayAll(); + + var failureMechanism = new StabilityPointStructuresFailureMechanism(); + + // Call + TestDelegate call = () => new StabilityPointStructuresCalculationActivity(null, "", failureMechanism, assessmentSectionMock); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("calculation", exception.ParamName); + mocks.VerifyAll(); + } + + [Test] + public void ParameteredConstructor_HlcdFilePathNull_ThrowsArgumentNullException() + { + // Setup + var mocks = new MockRepository(); + var assessmentSectionMock = mocks.Stub(); + mocks.ReplayAll(); + + var failureMechanism = new StabilityPointStructuresFailureMechanism(); + var calculation = new StructuresCalculation(); + + // Call + TestDelegate call = () => new StabilityPointStructuresCalculationActivity(calculation, null, failureMechanism, assessmentSectionMock); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("hlcdFilepath", exception.ParamName); + mocks.VerifyAll(); + } + + [Test] + public void ParameteredConstructor_FailureMechanismNull_ThrowsArgumentNullException() + { + // Setup + var mocks = new MockRepository(); + var assessmentSectionMock = mocks.Stub(); + mocks.ReplayAll(); + + var calculation = new StructuresCalculation(); + + // Call + TestDelegate call = () => new StabilityPointStructuresCalculationActivity(calculation, "", null, assessmentSectionMock); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("failureMechanism", exception.ParamName); + mocks.VerifyAll(); + } + + [Test] + public void ParameteredConstructor_AssessmentSectionNull_ThrowsArgumentNullException() + { + // Setup + var failureMechanism = new StabilityPointStructuresFailureMechanism(); + var calculation = new StructuresCalculation(); + + // Call + TestDelegate call = () => new StabilityPointStructuresCalculationActivity(calculation, "", failureMechanism, null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("assessmentSection", exception.ParamName); + } + } +} \ No newline at end of file