Index: Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Service/ClosingStructuresCalculationService.cs =================================================================== diff -u -r34ba2c960e26c2b6acaddae12e7fcbe6f581f9bb -rd79d26d2ad423b4287d5cdaeb0ac267089a54bf9 --- Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Service/ClosingStructuresCalculationService.cs (.../ClosingStructuresCalculationService.cs) (revision 34ba2c960e26c2b6acaddae12e7fcbe6f581f9bb) +++ Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Service/ClosingStructuresCalculationService.cs (.../ClosingStructuresCalculationService.cs) (revision d79d26d2ad423b4287d5cdaeb0ac267089a54bf9) @@ -131,7 +131,7 @@ /// /// The for which to validate the values. /// The for which to validate the values. - /// Truec> if has no validation errors; Falsec> otherwise. + /// truec> if has no validation errors; falsec> otherwise. public static bool Validate(StructuresCalculation calculation, IAssessmentSection assessmentSection) { CalculationServiceHelper.LogValidationBeginTime(calculation.Name); Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Service.Test/ClosingStructuresCalculationServiceTest.cs =================================================================== diff -u -r34ba2c960e26c2b6acaddae12e7fcbe6f581f9bb -rd79d26d2ad423b4287d5cdaeb0ac267089a54bf9 --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Service.Test/ClosingStructuresCalculationServiceTest.cs (.../ClosingStructuresCalculationServiceTest.cs) (revision 34ba2c960e26c2b6acaddae12e7fcbe6f581f9bb) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Service.Test/ClosingStructuresCalculationServiceTest.cs (.../ClosingStructuresCalculationServiceTest.cs) (revision d79d26d2ad423b4287d5cdaeb0ac267089a54bf9) @@ -32,10 +32,10 @@ using Ringtoets.ClosingStructures.Data; using Ringtoets.ClosingStructures.Data.TestUtil; using Ringtoets.Common.Data.AssessmentSection; -using Ringtoets.Common.Data.Contribution; using Ringtoets.Common.Data.DikeProfiles; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.Structures; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.HydraRing.Calculation.Calculator.Factory; using Ringtoets.HydraRing.Calculation.Data; using Ringtoets.HydraRing.Calculation.Data.Input.Structures; @@ -110,7 +110,7 @@ { // Setup var mockRepository = new MockRepository(); - var assessmentSectionStub = CreateAssessmentSectionStub(new ClosingStructuresFailureMechanism(), mockRepository); + var assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(new ClosingStructuresFailureMechanism(), mockRepository); mockRepository.ReplayAll(); assessmentSectionStub.HydraulicBoundaryDatabase.FilePath = Path.Combine(testDataPath, "notexisting.sqlite"); @@ -150,7 +150,7 @@ { // Setup var mockRepository = new MockRepository(); - var assessmentSectionStub = CreateAssessmentSectionStub(new ClosingStructuresFailureMechanism(), mockRepository); + var assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(new ClosingStructuresFailureMechanism(), mockRepository); mockRepository.ReplayAll(); assessmentSectionStub.HydraulicBoundaryDatabase.FilePath = Path.Combine(testDataPath, "HRD dutch coast south.sqlite"); @@ -190,7 +190,7 @@ { // Setup var mockRepository = new MockRepository(); - var assessmentSectionStub = CreateAssessmentSectionStub(new ClosingStructuresFailureMechanism(), mockRepository); + var assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(new ClosingStructuresFailureMechanism(), mockRepository); mockRepository.ReplayAll(); assessmentSectionStub.HydraulicBoundaryDatabase.FilePath = Path.Combine(testDataPath, "HRD dutch coast south.sqlite"); @@ -233,7 +233,7 @@ { // Setup var mockRepository = new MockRepository(); - var assessmentSectionStub = CreateAssessmentSectionStub(new ClosingStructuresFailureMechanism(), mockRepository); + var assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(new ClosingStructuresFailureMechanism(), mockRepository); mockRepository.ReplayAll(); assessmentSectionStub.HydraulicBoundaryDatabase.FilePath = Path.Combine(testDataPath, "HRD dutch coast south.sqlite"); @@ -291,7 +291,7 @@ { // Setup var mockRepository = new MockRepository(); - var assessmentSectionStub = CreateAssessmentSectionStub(new ClosingStructuresFailureMechanism(), mockRepository); + var assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(new ClosingStructuresFailureMechanism(), mockRepository); mockRepository.ReplayAll(); assessmentSectionStub.HydraulicBoundaryDatabase.FilePath = Path.Combine(testDataPath, "HRD dutch coast south.sqlite"); @@ -410,7 +410,7 @@ { // Setup var mockRepository = new MockRepository(); - var assessmentSectionStub = CreateAssessmentSectionStub(new ClosingStructuresFailureMechanism(), mockRepository); + var assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(new ClosingStructuresFailureMechanism(), mockRepository); mockRepository.ReplayAll(); assessmentSectionStub.HydraulicBoundaryDatabase.FilePath = Path.Combine(testDataPath, "HRD dutch coast south.sqlite"); @@ -496,7 +496,7 @@ var closingStructuresFailureMechanism = new ClosingStructuresFailureMechanism(); var mockRepository = new MockRepository(); - var assessmentSectionStub = CreateAssessmentSectionStub(closingStructuresFailureMechanism, mockRepository); + var assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(closingStructuresFailureMechanism, mockRepository); mockRepository.ReplayAll(); closingStructuresFailureMechanism.AddSection(new FailureMechanismSection("test section", new[] @@ -588,7 +588,7 @@ var closingStructuresFailureMechanism = new ClosingStructuresFailureMechanism(); var mockRepository = new MockRepository(); - var assessmentSectionStub = CreateAssessmentSectionStub(closingStructuresFailureMechanism, mockRepository); + var assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(closingStructuresFailureMechanism, mockRepository); mockRepository.ReplayAll(); closingStructuresFailureMechanism.AddSection(new FailureMechanismSection("test section", new[] @@ -680,7 +680,7 @@ var closingStructuresFailureMechanism = new ClosingStructuresFailureMechanism(); var mockRepository = new MockRepository(); - var assessmentSectionStub = CreateAssessmentSectionStub(closingStructuresFailureMechanism, mockRepository); + var assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(closingStructuresFailureMechanism, mockRepository); mockRepository.ReplayAll(); closingStructuresFailureMechanism.AddSection(new FailureMechanismSection("test section", new[] @@ -770,7 +770,7 @@ var closingStructuresFailureMechanism = new ClosingStructuresFailureMechanism(); var mockRepository = new MockRepository(); - var assessmentSectionStub = CreateAssessmentSectionStub(closingStructuresFailureMechanism, mockRepository); + var assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(closingStructuresFailureMechanism, mockRepository); mockRepository.ReplayAll(); closingStructuresFailureMechanism.AddSection(new FailureMechanismSection("test section", new[] @@ -818,7 +818,7 @@ var closingStructuresFailureMechanism = new ClosingStructuresFailureMechanism(); var mockRepository = new MockRepository(); - var assessmentSectionStub = CreateAssessmentSectionStub(closingStructuresFailureMechanism, mockRepository); + var assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(closingStructuresFailureMechanism, mockRepository); mockRepository.ReplayAll(); closingStructuresFailureMechanism.AddSection(new FailureMechanismSection("test section", new[] @@ -876,7 +876,7 @@ var closingStructuresFailureMechanism = new ClosingStructuresFailureMechanism(); var mockRepository = new MockRepository(); - var assessmentSectionStub = CreateAssessmentSectionStub(closingStructuresFailureMechanism, mockRepository); + var assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(closingStructuresFailureMechanism, mockRepository); mockRepository.ReplayAll(); closingStructuresFailureMechanism.AddSection(new FailureMechanismSection("test section", new[] @@ -911,24 +911,6 @@ } } - private static IAssessmentSection CreateAssessmentSectionStub(IFailureMechanism failureMechanism, MockRepository mockRepository) - { - var assessmentSectionStub = mockRepository.Stub(); - assessmentSectionStub.Stub(a => a.Id).Return("21"); - assessmentSectionStub.Stub(a => a.FailureMechanismContribution).Return(new FailureMechanismContribution(new[] - { - failureMechanism - }, 1, 2)); - assessmentSectionStub.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase - { - Locations = - { - new HydraulicBoundaryLocation(1300001, string.Empty, 0, 0) - } - }; - return assessmentSectionStub; - } - private static void SetInvalidInputParameters(StructuresCalculation input, RoundedDouble value) { input.InputParameters.DeviationWaveDirection = RoundedDouble.NaN; Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Service.Test/Ringtoets.ClosingStructures.Service.Test.csproj =================================================================== diff -u -r73597729ce18d3ee00d8036bca8341e9c12f2953 -rd79d26d2ad423b4287d5cdaeb0ac267089a54bf9 --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Service.Test/Ringtoets.ClosingStructures.Service.Test.csproj (.../Ringtoets.ClosingStructures.Service.Test.csproj) (revision 73597729ce18d3ee00d8036bca8341e9c12f2953) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Service.Test/Ringtoets.ClosingStructures.Service.Test.csproj (.../Ringtoets.ClosingStructures.Service.Test.csproj) (revision d79d26d2ad423b4287d5cdaeb0ac267089a54bf9) @@ -79,6 +79,10 @@ {D4200F43-3F72-4F42-AF0A-8CED416A38EC} Ringtoets.Common.Data + + {4843D6E5-066F-4795-94F5-1D53932DD03C} + Ringtoets.Common.Data.TestUtil + {888d4097-8bc2-4703-9fb1-8744c94d525e} Ringtoets.HydraRing.Calculation Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/AssessmentSectionHelperTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/AssessmentSectionHelperTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/AssessmentSectionHelperTest.cs (revision d79d26d2ad423b4287d5cdaeb0ac267089a54bf9) @@ -0,0 +1,56 @@ +// 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.Linq; +using Core.Common.Base.Geometry; +using NUnit.Framework; +using Rhino.Mocks; + +namespace Ringtoets.Common.Data.TestUtil.Test +{ + [TestFixture] + public class AssessmentSectionHelperTest + { + [Test] + public void CreateAssessmentSectionStub_Always_ReturnsStubbedAssessmentSection() + { + // Setup + var failureMechanism = new TestFailureMechanism(); + var mocks = new MockRepository(); + + // Call + var assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks); + mocks.ReplayAll(); + + // Assert + Assert.IsNotNull(assessmentSectionStub); + Assert.AreEqual("21", assessmentSectionStub.Id); + var hydraulicBoundaryDatabase = assessmentSectionStub.HydraulicBoundaryDatabase; + Assert.IsNotNull(hydraulicBoundaryDatabase); + Assert.AreEqual(1, hydraulicBoundaryDatabase.Locations.Count); + var hydraulicBoundaryLocation = hydraulicBoundaryDatabase.Locations.First(); + Assert.AreEqual(1300001, hydraulicBoundaryLocation.Id); + Assert.AreEqual(string.Empty, hydraulicBoundaryLocation.Name); + Assert.AreEqual(new Point2D(0, 0), hydraulicBoundaryLocation.Location); + mocks.VerifyAll(); + } + } +} \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/Ringtoets.Common.Data.TestUtil.Test.csproj =================================================================== diff -u -r2ce297977651104992063303f71410e6dad9b834 -rd79d26d2ad423b4287d5cdaeb0ac267089a54bf9 --- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/Ringtoets.Common.Data.TestUtil.Test.csproj (.../Ringtoets.Common.Data.TestUtil.Test.csproj) (revision 2ce297977651104992063303f71410e6dad9b834) +++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/Ringtoets.Common.Data.TestUtil.Test.csproj (.../Ringtoets.Common.Data.TestUtil.Test.csproj) (revision d79d26d2ad423b4287d5cdaeb0ac267089a54bf9) @@ -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 + @@ -65,6 +70,10 @@ {3BBFD65B-B277-4E50-AE6D-BD24C3434609} Core.Common.Base + + {70f8cc9c-5bc8-4fb2-b201-eae7fa8088c2} + Ringtoets.HydraRing.Data + {d4200f43-3f72-4f42-af0a-8ced416a38ec} Ringtoets.Common.Data Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/packages.config =================================================================== diff -u -rfea3ed82dfb6dfcad535eef16efcbaa9c01564ed -rd79d26d2ad423b4287d5cdaeb0ac267089a54bf9 --- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/packages.config (.../packages.config) (revision fea3ed82dfb6dfcad535eef16efcbaa9c01564ed) +++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/packages.config (.../packages.config) (revision d79d26d2ad423b4287d5cdaeb0ac267089a54bf9) @@ -23,4 +23,5 @@ --> + \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/AssessmentSectionHelper.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/AssessmentSectionHelper.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/AssessmentSectionHelper.cs (revision d79d26d2ad423b4287d5cdaeb0ac267089a54bf9) @@ -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 Rhino.Mocks; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.Contribution; +using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.HydraRing.Data; + +namespace Ringtoets.Common.Data.TestUtil +{ + /// + /// Helper class for testing the assessment section. + /// + public static class AssessmentSectionHelper + { + /// + /// Creates a stub of . + /// + /// The failure mechanism to set the contribution for. + /// The mock repository to create the stub with. + /// A stubbed . + public static IAssessmentSection CreateAssessmentSectionStub(IFailureMechanism failureMechanism, MockRepository mockRepository) + { + var assessmentSectionStub = mockRepository.Stub(); + assessmentSectionStub.Stub(a => a.Id).Return("21"); + assessmentSectionStub.Stub(a => a.FailureMechanismContribution).Return(new FailureMechanismContribution(new[] + { + failureMechanism + }, 1, 2)); + assessmentSectionStub.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase + { + Locations = + { + new HydraulicBoundaryLocation(1300001, string.Empty, 0, 0) + } + }; + return assessmentSectionStub; + } + } +} \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/Ringtoets.Common.Data.TestUtil.csproj =================================================================== diff -u -r2b2da37541708b8ad95286e731010dd9d27d5070 -rd79d26d2ad423b4287d5cdaeb0ac267089a54bf9 --- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/Ringtoets.Common.Data.TestUtil.csproj (.../Ringtoets.Common.Data.TestUtil.csproj) (revision 2b2da37541708b8ad95286e731010dd9d27d5070) +++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/Ringtoets.Common.Data.TestUtil.csproj (.../Ringtoets.Common.Data.TestUtil.csproj) (revision d79d26d2ad423b4287d5cdaeb0ac267089a54bf9) @@ -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 + @@ -65,6 +70,10 @@ {3BBFD65B-B277-4E50-AE6D-BD24C3434609} Core.Common.Base + + {70f8cc9c-5bc8-4fb2-b201-eae7fa8088c2} + Ringtoets.HydraRing.Data + {D4200F43-3F72-4F42-AF0A-8CED416A38EC} Ringtoets.Common.Data Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/packages.config =================================================================== diff -u -r2ce297977651104992063303f71410e6dad9b834 -rd79d26d2ad423b4287d5cdaeb0ac267089a54bf9 --- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/packages.config (.../packages.config) (revision 2ce297977651104992063303f71410e6dad9b834) +++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/packages.config (.../packages.config) (revision d79d26d2ad423b4287d5cdaeb0ac267089a54bf9) @@ -1,4 +1,5 @@ - + + + + + \ No newline at end of file