Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PresentationObjects/GrassCoverErosionOutwardsWaveConditionsInputContext.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PresentationObjects/GrassCoverErosionOutwardsWaveConditionsInputContext.cs (revision 0) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PresentationObjects/GrassCoverErosionOutwardsWaveConditionsInputContext.cs (revision 723cafd68e612c8febe955bfd9c1d1057e7b7341) @@ -0,0 +1,75 @@ +// 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.Controls.PresentationObjects; +using Ringtoets.Common.Data.DikeProfiles; +using Ringtoets.GrassCoverErosionOutwards.Data; +using Ringtoets.HydraRing.Data; +using Ringtoets.Revetment.Data; +using Ringtoets.Revetment.Forms.PresentationObjects; + +namespace Ringtoets.GrassCoverErosionOutwards.Forms.PresentationObjects +{ + /// + /// Presentation object for for the . + /// + public class GrassCoverErosionOutwardsWaveConditionsInputContext : ObservableWrappedObjectContextBase, + IWaveConditionsInputContext + { + private readonly GrassCoverErosionOutwardsFailureMechanism failureMechanism; + + /// + /// Creates a new instance of . + /// + /// The wrapped . + /// The + /// the context belongs to. + /// Thrown when any paramater is null. + public GrassCoverErosionOutwardsWaveConditionsInputContext(WaveConditionsInput wrappedData, + GrassCoverErosionOutwardsFailureMechanism failureMechanism) + : base(wrappedData) + { + if (failureMechanism == null) + { + throw new ArgumentNullException("failureMechanism"); + } + this.failureMechanism = failureMechanism; + } + + public IEnumerable HydraulicBoundaryLocations + { + get + { + return failureMechanism.HydraulicBoundaryLocations; + } + } + + public IEnumerable ForeshoreProfiles + { + get + { + return failureMechanism.ForeshoreProfiles; + } + } + } +} \ No newline at end of file Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Ringtoets.GrassCoverErosionOutwards.Forms.csproj =================================================================== diff -u -r88a71efb5e821ce8738d822e5c92580cfc7b172c -r723cafd68e612c8febe955bfd9c1d1057e7b7341 --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Ringtoets.GrassCoverErosionOutwards.Forms.csproj (.../Ringtoets.GrassCoverErosionOutwards.Forms.csproj) (revision 88a71efb5e821ce8738d822e5c92580cfc7b172c) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Ringtoets.GrassCoverErosionOutwards.Forms.csproj (.../Ringtoets.GrassCoverErosionOutwards.Forms.csproj) (revision 723cafd68e612c8febe955bfd9c1d1057e7b7341) @@ -50,6 +50,7 @@ + Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PresentationObjects/GrassCoverErosionOutwardsWaveConditionsInputContextTest.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PresentationObjects/GrassCoverErosionOutwardsWaveConditionsInputContextTest.cs (revision 0) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PresentationObjects/GrassCoverErosionOutwardsWaveConditionsInputContextTest.cs (revision 723cafd68e612c8febe955bfd9c1d1057e7b7341) @@ -0,0 +1,95 @@ +// 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.Geometry; +using Core.Common.Controls.PresentationObjects; +using NUnit.Framework; +using Ringtoets.Common.Data.DikeProfiles; +using Ringtoets.GrassCoverErosionOutwards.Data; +using Ringtoets.GrassCoverErosionOutwards.Forms.PresentationObjects; +using Ringtoets.HydraRing.Data; +using Ringtoets.Revetment.Data; +using Ringtoets.Revetment.Forms.PresentationObjects; + +namespace Ringtoets.GrassCoverErosionOutwards.Forms.Test.PresentationObjects +{ + [TestFixture] + public class GrassCoverErosionOutwardsWaveConditionsInputContextTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Setup + var foreshoreProfile = new ForeshoreProfile(new Point2D(0, 0), + Enumerable.Empty(), + null, + new ForeshoreProfile.ConstructionProperties()); + + var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, string.Empty, 0, 0); + + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); + failureMechanism.ForeshoreProfiles.Add(foreshoreProfile); + failureMechanism.HydraulicBoundaryLocations.Add(hydraulicBoundaryLocation); + + var input = new WaveConditionsInput(WaveConditionsRevetment.Grass); + + // Call + var context = new GrassCoverErosionOutwardsWaveConditionsInputContext(input, failureMechanism); + + // Assert + Assert.IsInstanceOf(context); + Assert.IsInstanceOf>(context); + Assert.AreSame(input, context.WrappedData); + CollectionAssert.AreEqual(new[] { foreshoreProfile }, context.ForeshoreProfiles); + CollectionAssert.AreEqual(new[] { hydraulicBoundaryLocation }, context.HydraulicBoundaryLocations); + } + + [Test] + public void Constructor_InputNull_ThrowsArgumentNullException() + { + // Setup + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); + + // Call + TestDelegate test = () => new GrassCoverErosionOutwardsWaveConditionsInputContext(null, failureMechanism); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("wrappedData", exception.ParamName); + } + + [Test] + public void Constructor_FailureMechanismNull_ThrowsArgumentNullException() + { + // Setup + var input = new WaveConditionsInput(WaveConditionsRevetment.Grass); + + // Call + TestDelegate test = () => new GrassCoverErosionOutwardsWaveConditionsInputContext(input, null); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("failureMechanism", exception.ParamName); + } + } +} \ No newline at end of file Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Ringtoets.GrassCoverErosionOutwards.Forms.Test.csproj =================================================================== diff -u -rc0c23a5508146aad6005fc0eb3b78bab7a63dc63 -r723cafd68e612c8febe955bfd9c1d1057e7b7341 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Ringtoets.GrassCoverErosionOutwards.Forms.Test.csproj (.../Ringtoets.GrassCoverErosionOutwards.Forms.Test.csproj) (revision c0c23a5508146aad6005fc0eb3b78bab7a63dc63) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Ringtoets.GrassCoverErosionOutwards.Forms.Test.csproj (.../Ringtoets.GrassCoverErosionOutwards.Forms.Test.csproj) (revision 723cafd68e612c8febe955bfd9c1d1057e7b7341) @@ -70,6 +70,7 @@ + Index: Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/PresentationObjects/WaveConditionsInputContextTest.cs =================================================================== diff -u -rfae43a9590e1fd964bd37cdcdf62b4d7f8a00b15 -r723cafd68e612c8febe955bfd9c1d1057e7b7341 --- Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/PresentationObjects/WaveConditionsInputContextTest.cs (.../WaveConditionsInputContextTest.cs) (revision fae43a9590e1fd964bd37cdcdf62b4d7f8a00b15) +++ Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/PresentationObjects/WaveConditionsInputContextTest.cs (.../WaveConditionsInputContextTest.cs) (revision 723cafd68e612c8febe955bfd9c1d1057e7b7341) @@ -122,6 +122,7 @@ // Assert Assert.IsInstanceOf>(context); + Assert.IsInstanceOf(context); Assert.AreSame(input, context.WrappedData); CollectionAssert.AreEqual(foreshoreProfiles, context.ForeshoreProfiles); CollectionAssert.AreEqual(locations, context.HydraulicBoundaryLocations);