Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/BreakWater.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/BreakWater.cs (revision 0) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/BreakWater.cs (revision d847955b7a8b9bd4cd80c5e10e6a055c9d5daa8b) @@ -0,0 +1,50 @@ +// 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. + +namespace Ringtoets.GrassCoverErosionInwards.Data +{ + /// + /// Container for break water related data. + /// + public class BreakWater + { + /// + /// Creates a new instance of . + /// + /// The break water type. + /// The break water height. + public BreakWater(BreakWaterType type, double height) + { + Type = type; + Height = height; + } + + /// + /// Gets the type. + /// + public BreakWaterType Type { get; private set; } + + /// + /// Gets the height. + /// + public double Height { get; private set; } + } +} \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/BreakWaterType.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/BreakWaterType.cs (revision 0) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/BreakWaterType.cs (revision d847955b7a8b9bd4cd80c5e10e6a055c9d5daa8b) @@ -0,0 +1,44 @@ +// 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. + +namespace Ringtoets.GrassCoverErosionInwards.Data +{ + /// + /// Defines the various types of . + /// + public enum BreakWaterType + { + /// + /// A wall. + /// + Wall, + + /// + /// A watertight retaining structure. + /// + Caisson, + + /// + /// A barrier that impounds water or underground streams. + /// + Dam + } +} \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsCalculation.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsCalculation.cs (revision 0) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsCalculation.cs (revision d847955b7a8b9bd4cd80c5e10e6a055c9d5daa8b) @@ -0,0 +1,74 @@ +// 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 Core.Common.Base; +using Ringtoets.Common.Data.Calculation; +using Ringtoets.GrassCoverErosionInwards.Data.Properties; + +namespace Ringtoets.GrassCoverErosionInwards.Data +{ + /// + /// This class holds the grass cover erosion inwards information which can be made visible in the graphical interface of the application. + /// + public class GrassCoverErosionInwardsCalculation : Observable, ICalculation + { + /// + /// Constructs a new instance of . + /// + public GrassCoverErosionInwardsCalculation() + { + Name = Resources.GrassCoverErosionInwardsCalculation_DefaultName; + InputParameters = new GrassCoverErosionInwardsInput(); + } + + /// + /// Gets the input parameters to perform a grass cover erosion inwards calculation with. + /// + public GrassCoverErosionInwardsInput InputParameters { get; private set; } + + /// + /// Gets or sets , which contains the results of a grass cover erosion inwards calculation. + /// + public GrassCoverErosionInwardsOutput Output { get; set; } + + public string Comments { get; set; } + + public string Name { get; set; } + + public bool HasOutput + { + get + { + return Output != null; + } + } + + public void ClearOutput() + { + Output = null; + } + + public void ClearHydraulicBoundaryLocation() + { + InputParameters.HydraulicBoundaryLocation = null; + } + } +} \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsInput.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsInput.cs (revision 0) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsInput.cs (revision d847955b7a8b9bd4cd80c5e10e6a055c9d5daa8b) @@ -0,0 +1,112 @@ +// 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 System.Linq; +using Core.Common.Base.Data; +using Ringtoets.Common.Data.Probabilistics; +using Ringtoets.HydraRing.Data; + +namespace Ringtoets.GrassCoverErosionInwards.Data +{ + /// + /// Class that holds all grass cover erosion inwards calculation specific input parameters. + /// + public class GrassCoverErosionInwardsInput + { + private IEnumerable geometry; + + /// + /// The dike's geometry (without foreshore geometry). + /// + public IEnumerable DikeGeometry + { + get + { + return geometry == null ? Enumerable.Empty() : geometry.Skip(ForeshoreDikeGeometryPoints); + } + } + + /// + /// The dike's foreshore geometry. + /// + public IEnumerable ForeshoreGeometry + { + get + { + return geometry == null ? Enumerable.Empty() : geometry.Take(ForeshoreDikeGeometryPoints); + } + } + + /// + /// Gets or sets the dike's orientation + /// + public RoundedDouble Orientation { get; set; } + + /// + /// Gets or sets the dike's critical flow rate. + /// + public LognormalDistribution CriticalFlowRate { get; set; } + + /// + /// Gets or sets if a foreshore is present. + /// + /// Value of must not be reset when is set to false. + public bool ForeshorePresent { get; set; } + + /// + /// Gets or sets the number of profile points of the dike geometry that form the foreshore geometry. + /// + public int ForeshoreDikeGeometryPoints { get; set; } + + /// + /// Defines if needs to be taken into account. + /// + public bool BreakWaterPresent { get; set; } + + /// + /// Gets or sets the . + /// + public BreakWater BreakWater { get; set; } + + /// + /// Gets or set the hydraulic boundary location from which to use the assessment level. + /// + public HydraulicBoundaryLocation HydraulicBoundaryLocation { get; set; } + + /// + /// Sets the grass cover erosion inwards geometry. + /// + /// The grass cover erosion inwards geometry points. + /// Defines how many in + /// are foreshore. + public void SetGeometry(IEnumerable profileSections, int foreshoreGeometryPoints) + { + if (profileSections == null) + { + throw new ArgumentNullException("profileSections"); + } + geometry = profileSections; + ForeshoreDikeGeometryPoints = foreshoreGeometryPoints; + } + } +} \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsOutput.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsOutput.cs (revision 0) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsOutput.cs (revision d847955b7a8b9bd4cd80c5e10e6a055c9d5daa8b) @@ -0,0 +1,73 @@ +// 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 Core.Common.Base.Data; + +namespace Ringtoets.GrassCoverErosionInwards.Data +{ + /// + /// This class contains the results of a GrassCoverErosioninwards calculation. + /// + public class GrassCoverErosionInwardsOutput + { + /// + /// Creates a new instance of . + /// + /// The required (maximum allowed) probability of failure. + /// The required (maximum allowed) reliability of the failure mechanism. + /// The calculated probability of failing. + /// The calculated reliability of the failure mechanism. + /// The factor of safety for the failure mechanisms. + public GrassCoverErosionInwardsOutput(double requiredProbability, double requiredReliability, double probability, double reliability, double factorOfSafety) + { + RequiredProbability = new RoundedDouble(2, requiredProbability); + RequiredReliability = new RoundedDouble(3, requiredReliability); + Probability = new RoundedDouble(2, probability); + Reliability = new RoundedDouble(3, reliability); + FactorOfSafety = new RoundedDouble(3, factorOfSafety); + } + + /// + /// Gets the required probability of the failure mechanism. + /// + public RoundedDouble RequiredProbability { get; private set; } + + /// + /// Get the required reliability of the failure mechanism. + /// + public RoundedDouble RequiredReliability { get; private set; } + + /// + /// Gets the factor of safety of the failure mechanism. + /// + public RoundedDouble FactorOfSafety { get; private set; } + + /// + /// Gets the reliability of the failure mechanism. + /// + public RoundedDouble Reliability { get; private set; } + + /// + /// Gets the probability of failing.. + /// + public RoundedDouble Probability { get; private set; } + } +} \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/Properties/Resources.Designer.cs =================================================================== diff -u -rd2b3e26fb42063a071bf4fc65b6198ef2369db30 -rd847955b7a8b9bd4cd80c5e10e6a055c9d5daa8b --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision d2b3e26fb42063a071bf4fc65b6198ef2369db30) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision d847955b7a8b9bd4cd80c5e10e6a055c9d5daa8b) @@ -61,6 +61,15 @@ } /// + /// Looks up a localized string similar to Nieuwe berekening. + /// + public static string GrassCoverErosionInwardsCalculation_DefaultName { + get { + return ResourceManager.GetString("GrassCoverErosionInwardsCalculation_DefaultName", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Dijken - Grasbekleding erosie kruin en binnentalud. /// public static string GrassCoverErosionInwardsFailureMechanism_DisplayName { Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/Properties/Resources.resx =================================================================== diff -u -rd2b3e26fb42063a071bf4fc65b6198ef2369db30 -rd847955b7a8b9bd4cd80c5e10e6a055c9d5daa8b --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/Properties/Resources.resx (.../Resources.resx) (revision d2b3e26fb42063a071bf4fc65b6198ef2369db30) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/Properties/Resources.resx (.../Resources.resx) (revision d847955b7a8b9bd4cd80c5e10e6a055c9d5daa8b) @@ -120,4 +120,7 @@ Dijken - Grasbekleding erosie kruin en binnentalud + + Nieuwe berekening + \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/Ringtoets.GrassCoverErosionInwards.Data.csproj =================================================================== diff -u -r14fd4a18a1bc2aa2d11eca464a93856dd89ffcf7 -rd847955b7a8b9bd4cd80c5e10e6a055c9d5daa8b --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/Ringtoets.GrassCoverErosionInwards.Data.csproj (.../Ringtoets.GrassCoverErosionInwards.Data.csproj) (revision 14fd4a18a1bc2aa2d11eca464a93856dd89ffcf7) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/Ringtoets.GrassCoverErosionInwards.Data.csproj (.../Ringtoets.GrassCoverErosionInwards.Data.csproj) (revision d847955b7a8b9bd4cd80c5e10e6a055c9d5daa8b) @@ -44,7 +44,13 @@ Properties\GlobalAssembly.cs + + + + + + True @@ -68,6 +74,10 @@ Ringtoets.Common.Data False + + {70F8CC9C-5BC8-4FB2-B201-EAE7FA8088C2} + Ringtoets.HydraRing.Data + Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/RoughnessProfileSection.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/RoughnessProfileSection.cs (revision 0) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/RoughnessProfileSection.cs (revision d847955b7a8b9bd4cd80c5e10e6a055c9d5daa8b) @@ -0,0 +1,65 @@ +// 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.Geometry; + +namespace Ringtoets.GrassCoverErosionInwards.Data +{ + public class RoughnessProfileSection + { + /// + /// Creates a new instance of the class. + /// + /// + /// + /// The roughness of the section between and . + public RoughnessProfileSection(Point2D startingPoint, Point2D endingPoint, double roughness) + { + if (startingPoint == null) + { + throw new ArgumentNullException("startingPoint"); + } + if (endingPoint == null) + { + throw new ArgumentNullException("endingPoint"); + } + StartingPoint = startingPoint; + EndingPoint = endingPoint; + Roughness = roughness; + } + + /// + /// Gets the starting 2D geometry point of the . + /// + public Point2D StartingPoint { get; private set; } + + /// + /// Gets the ending 2D geometry point of the . + /// + public Point2D EndingPoint { get; private set; } + + /// + /// Gets the roughness of the . + /// + public double Roughness { get; private set; } + } +} \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/BreakWaterTest.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/BreakWaterTest.cs (revision 0) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/BreakWaterTest.cs (revision d847955b7a8b9bd4cd80c5e10e6a055c9d5daa8b) @@ -0,0 +1,44 @@ +// 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 NUnit.Framework; + +namespace Ringtoets.GrassCoverErosionInwards.Data.Test +{ + [TestFixture] + public class BreakWaterTest + { + [Test] + public void Constructor_Always_ExpectedValues() + { + // Setup + BreakWaterType type = BreakWaterType.Caisson; + double height = 100.1; + + // Call + BreakWater breakWater = new BreakWater(type, height); + + // Assert + Assert.AreEqual(type, breakWater.Type); + Assert.AreEqual(height, breakWater.Height); + } + } +} \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsCalculationTest.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsCalculationTest.cs (revision 0) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsCalculationTest.cs (revision d847955b7a8b9bd4cd80c5e10e6a055c9d5daa8b) @@ -0,0 +1,242 @@ +// 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 Core.Common.Base; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data; +using Ringtoets.Common.Data.Calculation; +using Ringtoets.HydraRing.Data; + +namespace Ringtoets.GrassCoverErosionInwards.Data.Test +{ + [TestFixture] + public class GrassCoverErosionInwardsCalculationTest + { + private MockRepository mockRepository; + + [SetUp] + public void SetUp() + { + mockRepository = new MockRepository(); + } + + [Test] + public void Constructor_DefaultPropertyValuesAreSet() + { + // Setup & Call + var calculation = new GrassCoverErosionInwardsCalculation(); + + // Assert + Assert.IsInstanceOf(calculation); + Assert.IsInstanceOf(calculation); + + Assert.AreEqual("Nieuwe berekening", calculation.Name); + Assert.IsInstanceOf(calculation.InputParameters); + Assert.IsFalse(calculation.HasOutput); + Assert.IsNull(calculation.Comments); + Assert.IsNull(calculation.Output); + } + + [Test] + public void Notify_SingleListenerAttached_ListenerIsNotified() + { + // Setup + var observer = mockRepository.StrictMock(); + observer.Expect(o => o.UpdateObserver()); + mockRepository.ReplayAll(); + + var calculation = new GrassCoverErosionInwardsCalculation(); + + calculation.Attach(observer); + + // Call & Assert + calculation.NotifyObservers(); + } + + [Test] + public void Notify_SingleListenerAttachedAndDeattached_ListenerIsNotNotified() + { + // Setup + var observer = mockRepository.StrictMock(); + observer.Expect(o => o.UpdateObserver()).Repeat.Never(); + mockRepository.ReplayAll(); + + var calculation = new GrassCoverErosionInwardsCalculation(); + + calculation.Attach(observer); + calculation.Detach(observer); + + // Call & Assert + calculation.NotifyObservers(); + } + + [Test] + public void Notify_TwoListenersAttached_BothAreNotified() + { + // Setup + var observerA = mockRepository.StrictMock(); + observerA.Expect(o => o.UpdateObserver()); + + var observerB = mockRepository.StrictMock(); + observerB.Expect(o => o.UpdateObserver()); + mockRepository.ReplayAll(); + + var calculation = new GrassCoverErosionInwardsCalculation(); + + calculation.Attach(observerA); + calculation.Attach(observerB); + + // Call & Assert + calculation.NotifyObservers(); + } + + [Test] + public void Notify_TwoListenersAttachedOneDetached_InvokedOnce() + { + // Setup + var observerA = mockRepository.StrictMock(); + observerA.Expect(o => o.UpdateObserver()).Repeat.Never(); + + var observerB = mockRepository.StrictMock(); + observerB.Expect(o => o.UpdateObserver()); + mockRepository.ReplayAll(); + + var calculation = new GrassCoverErosionInwardsCalculation(); + + calculation.Attach(observerA); + calculation.Attach(observerB); + calculation.Detach(observerA); + + // Call & Assert + calculation.NotifyObservers(); + } + + [Test] + public void Detach_DetachNonAttachedObserver_DoesNotThrowException() + { + // Setup + var observer = mockRepository.StrictMock(); + + var calculation = new GrassCoverErosionInwardsCalculation(); + + // Call & Assert + calculation.Detach(observer); + } + + [Test] + [TestCase(null)] + [TestCase("")] + [TestCase(" ")] + public void Properties_Name_ReturnsExpectedValues(string name) + { + // Setup + var calculation = new GrassCoverErosionInwardsCalculation(); + + // Call + calculation.Name = name; + + // Assert + Assert.AreEqual(name, calculation.Name); + } + + [Test] + [TestCase(null)] + [TestCase("")] + [TestCase(" ")] + public void Property_Comments_ReturnsExpectedValues(string comments) + { + // Setup + var calculation = new GrassCoverErosionInwardsCalculation(); + + // Call + calculation.Comments = comments; + + // Assert + Assert.AreEqual(comments, calculation.Comments); + } + + [Test] + public void ClearOutput_Always_SetsOutputToNull() + { + // Setup + var calculation = new GrassCoverErosionInwardsCalculation() + { + Output = new TestGrassCoverErosionInwardsOutput() + }; + + // Call + calculation.ClearOutput(); + + // Assert + Assert.IsNull(calculation.Output); + } + + [Test] + public void HasOutput_OutputNull_ReturnsFalse() + { + // Setup + var calculation = new GrassCoverErosionInwardsCalculation() + { + Output = null + }; + + // Call & Assert + Assert.IsFalse(calculation.HasOutput); + } + + [Test] + public void HasOutput_OutputSet_ReturnsTrue() + { + // Setup + var calculation = new GrassCoverErosionInwardsCalculation() + { + Output = new TestGrassCoverErosionInwardsOutput() + }; + + // Call & Assert + Assert.IsTrue(calculation.HasOutput); + } + + [Test] + public void ClearHydraulicBoundaryLocation_Always_SetHydraulicBoundaryLocationToNull() + { + // Setup + var calculation = new GrassCoverErosionInwardsCalculation(); + var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "test", 1.0, 2.0); + calculation.InputParameters.HydraulicBoundaryLocation = hydraulicBoundaryLocation; + + // Precondition + Assert.AreSame(hydraulicBoundaryLocation, calculation.InputParameters.HydraulicBoundaryLocation); + + // Call + calculation.ClearHydraulicBoundaryLocation(); + + // Assert + Assert.IsNull(calculation.InputParameters.HydraulicBoundaryLocation); + } + } + + public class TestGrassCoverErosionInwardsOutput : GrassCoverErosionInwardsOutput + { + public TestGrassCoverErosionInwardsOutput() : base(0, 0, 0, 0, 0) {} + } +} \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsInputTest.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsInputTest.cs (revision 0) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsInputTest.cs (revision d847955b7a8b9bd4cd80c5e10e6a055c9d5daa8b) @@ -0,0 +1,107 @@ +// 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.Linq; +using Core.Common.Base.Data; +using Core.Common.Base.Geometry; +using NUnit.Framework; +using Ringtoets.Common.Data.Probabilistics; + +namespace Ringtoets.GrassCoverErosionInwards.Data.Test +{ + [TestFixture] + public class GrassCoverErosionInwardsInputTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Setup & Call + var input = new GrassCoverErosionInwardsInput(); + + // Assert + Assert.IsNotNull(input); + CollectionAssert.IsEmpty(input.DikeGeometry); + Assert.IsNull(input.HydraulicBoundaryLocation); + } + + [Test] + public void Properties_ExpectedValues() + { + // Setup + var input = new GrassCoverErosionInwardsInput(); + var orientation = new RoundedDouble(2, 1.18); + var logNormal = new LognormalDistribution(2); + const bool foreshorePresent = true; + var breakWater = new BreakWater(BreakWaterType.Caisson, 2.2); + const bool breakWaterPresent = true; + + // Call + input.Orientation = orientation; + input.CriticalFlowRate = logNormal; + input.ForeshorePresent = foreshorePresent; + input.BreakWater = breakWater; + input.BreakWaterPresent = breakWaterPresent; + + // Assert + Assert.AreEqual(orientation, input.Orientation); + Assert.AreEqual(logNormal, input.CriticalFlowRate); + Assert.AreEqual(foreshorePresent, input.ForeshorePresent); + Assert.AreEqual(breakWater, input.BreakWater); + Assert.AreEqual(breakWaterPresent, input.BreakWaterPresent); + } + + [Test] + public void SetGeometry_NullRoughnessProfileSections_ThrowsArgumentNullException() + { + // Setup + var input = new GrassCoverErosionInwardsInput(); + + // Call + TestDelegate test = () => input.SetGeometry(null, 0); + + // Assert + Assert.Throws(test); + } + + [Test] + public void SetGeometry_ValidRoughnessProfileSections_ReturnsExpectedValues() + { + // Setup + var input = new GrassCoverErosionInwardsInput(); + var foreshoreSection = new RoughnessProfileSection(new Point2D(1.1, 2.2), new Point2D(3.3, 4.4), 1.1); + var dikeSection = new RoughnessProfileSection(new Point2D(3.3, 4.4), new Point2D(5.5, 6.6), 2.2); + const int foreshoreDikeGeometryPoints = 1; + + // Call + input.SetGeometry(new[] + { + foreshoreSection, + dikeSection + }, foreshoreDikeGeometryPoints); + + // Assert + Assert.AreEqual(foreshoreSection, input.ForeshoreGeometry.Single()); + Assert.AreEqual(dikeSection, input.DikeGeometry.Single()); + Assert.AreEqual(foreshoreDikeGeometryPoints, input.ForeshoreDikeGeometryPoints); + } + } +} \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsOutputTest.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsOutputTest.cs (revision 0) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsOutputTest.cs (revision d847955b7a8b9bd4cd80c5e10e6a055c9d5daa8b) @@ -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.Data; +using NUnit.Framework; + +namespace Ringtoets.GrassCoverErosionInwards.Data.Test +{ + [TestFixture] + public class GrassCoverErosionInwardsOutputTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Setup + var random = new Random(5); + var requiredProbability = new RoundedDouble(2, random.NextDouble()); + var requiredReliability = new RoundedDouble(3, random.NextDouble()); + var probability = new RoundedDouble(2, random.NextDouble()); + var reliability = new RoundedDouble(3, random.NextDouble()); + var factorOfSafety = new RoundedDouble(3, random.NextDouble()); + + // Call + var output = new GrassCoverErosionInwardsOutput(requiredProbability, requiredReliability, probability, reliability, factorOfSafety); + + // Assert + Assert.IsNotNull(output); + Assert.AreEqual(requiredProbability, output.RequiredProbability); + Assert.AreEqual(requiredReliability, output.RequiredReliability); + Assert.AreEqual(probability, output.Probability); + Assert.AreEqual(reliability, output.Reliability); + Assert.AreEqual(factorOfSafety, output.FactorOfSafety); + } + } +} \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/Ringtoets.GrassCoverErosionInwards.Data.Test.csproj =================================================================== diff -u -rd2b3e26fb42063a071bf4fc65b6198ef2369db30 -rd847955b7a8b9bd4cd80c5e10e6a055c9d5daa8b --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/Ringtoets.GrassCoverErosionInwards.Data.Test.csproj (.../Ringtoets.GrassCoverErosionInwards.Data.Test.csproj) (revision d2b3e26fb42063a071bf4fc65b6198ef2369db30) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/Ringtoets.GrassCoverErosionInwards.Data.Test.csproj (.../Ringtoets.GrassCoverErosionInwards.Data.Test.csproj) (revision d847955b7a8b9bd4cd80c5e10e6a055c9d5daa8b) @@ -55,7 +55,12 @@ + + + + + @@ -73,6 +78,10 @@ {D4200F43-3F72-4F42-AF0A-8CED416A38EC} Ringtoets.Common.Data + + {70f8cc9c-5bc8-4fb2-b201-eae7fa8088c2} + Ringtoets.HydraRing.Data + {90DE728E-48EF-4665-AB38-3D88E41D9F4D} Ringtoets.GrassCoverErosionInwards.Data Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/RoughnessProfileSectionTest.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/RoughnessProfileSectionTest.cs (revision 0) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/RoughnessProfileSectionTest.cs (revision d847955b7a8b9bd4cd80c5e10e6a055c9d5daa8b) @@ -0,0 +1,71 @@ +// 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.Geometry; +using NUnit.Framework; + +namespace Ringtoets.GrassCoverErosionInwards.Data.Test +{ + [TestFixture] + public class RoughnessProfileSectionTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Setup + var begin = new Point2D(1.1, 2.2); + var end = new Point2D(3.3, 4.4); + const double roughness = 5.5; + + // Call + RoughnessProfileSection roughnessProfileSection = new RoughnessProfileSection(begin, end, roughness); + + // Assert + Assert.IsNotNull(roughnessProfileSection); + Assert.AreEqual(begin, roughnessProfileSection.StartingPoint); + Assert.AreEqual(end, roughnessProfileSection.EndingPoint); + Assert.AreEqual(roughness, roughnessProfileSection.Roughness); + } + + [Test] + public void Constructor_BeginingPointNull_ThrowsArgumentNullException() + { + // Setup & Call + TestDelegate test = () => new RoughnessProfileSection(null, new Point2D(3.3, 4.4), 5.5); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("startingPoint", exception.ParamName); + } + + [Test] + public void Constructor_EndingPointNull_ThrowsArgumentNullException() + { + // Setup & Call + TestDelegate test = () => new RoughnessProfileSection(new Point2D(3.3, 4.4), null, 5.5); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("endingPoint", exception.ParamName); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/Input/HydraRingCalculationInput.cs =================================================================== diff -u -r4a37c3e7379dd57eaa3a2057809dec67261a07dd -rd847955b7a8b9bd4cd80c5e10e6a055c9d5daa8b --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/Input/HydraRingCalculationInput.cs (.../HydraRingCalculationInput.cs) (revision 4a37c3e7379dd57eaa3a2057809dec67261a07dd) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/Input/HydraRingCalculationInput.cs (.../HydraRingCalculationInput.cs) (revision d847955b7a8b9bd4cd80c5e10e6a055c9d5daa8b) @@ -129,7 +129,7 @@ /// /// Gets the sub mechanism model id corresponding to the provided sub mechanism id. /// - /// The sub mechanim id to get the sub mechanism model id for. + /// The sub mechanism id to get the sub mechanism model id for. /// The corresponding sub mechanism model id or null otherwise. public virtual int? GetSubMechanismModelId(int subMechanismId) {