Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PresentationObjects/GrassCoverErosionOutwardsContext.cs
===================================================================
diff -u -ree395d64328db8f999b871e80491399a0a65e844 -r172f313c5afd8dafa9756d9d1600c78ea2e9fcf9
--- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PresentationObjects/GrassCoverErosionOutwardsContext.cs (.../GrassCoverErosionOutwardsContext.cs) (revision ee395d64328db8f999b871e80491399a0a65e844)
+++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PresentationObjects/GrassCoverErosionOutwardsContext.cs (.../GrassCoverErosionOutwardsContext.cs) (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -40,7 +40,7 @@
/// The concrete data instance wrapped by this context object.
/// The failure mechanism which the context belongs to.
/// The assessment section which the context belongs to.
- /// Thrown when any paramater is null .
+ /// Thrown when any parameter is null .
protected GrassCoverErosionOutwardsContext(T wrappedData,
GrassCoverErosionOutwardsFailureMechanism failureMechanism,
IAssessmentSection assessmentSection)
Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PresentationObjects/GrassCoverErosionOutwardsWaveConditionsInputContext.cs
===================================================================
diff -u -r723cafd68e612c8febe955bfd9c1d1057e7b7341 -r172f313c5afd8dafa9756d9d1600c78ea2e9fcf9
--- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PresentationObjects/GrassCoverErosionOutwardsWaveConditionsInputContext.cs (.../GrassCoverErosionOutwardsWaveConditionsInputContext.cs) (revision 723cafd68e612c8febe955bfd9c1d1057e7b7341)
+++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PresentationObjects/GrassCoverErosionOutwardsWaveConditionsInputContext.cs (.../GrassCoverErosionOutwardsWaveConditionsInputContext.cs) (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -21,7 +21,6 @@
using System;
using System.Collections.Generic;
-using Core.Common.Controls.PresentationObjects;
using Ringtoets.Common.Data.DikeProfiles;
using Ringtoets.GrassCoverErosionOutwards.Data;
using Ringtoets.HydraRing.Data;
@@ -33,8 +32,7 @@
///
/// Presentation object for for the .
///
- public class GrassCoverErosionOutwardsWaveConditionsInputContext : ObservableWrappedObjectContextBase,
- IWaveConditionsInputContext
+ public class GrassCoverErosionOutwardsWaveConditionsInputContext : WaveConditionsInputContext
{
private readonly GrassCoverErosionOutwardsFailureMechanism failureMechanism;
@@ -44,7 +42,7 @@
/// The wrapped .
/// The
/// the context belongs to.
- /// Thrown when any paramater is null .
+ /// Thrown when any parameter is null .
public GrassCoverErosionOutwardsWaveConditionsInputContext(WaveConditionsInput wrappedData,
GrassCoverErosionOutwardsFailureMechanism failureMechanism)
: base(wrappedData)
@@ -56,15 +54,15 @@
this.failureMechanism = failureMechanism;
}
- public IEnumerable HydraulicBoundaryLocations
+ public override IEnumerable HydraulicBoundaryLocations
{
get
{
return failureMechanism.HydraulicBoundaryLocations;
}
}
- public IEnumerable ForeshoreProfiles
+ public override IEnumerable ForeshoreProfiles
{
get
{
Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Properties/Resources.Designer.cs
===================================================================
diff -u -r5144a0cdb812048a94e9d812b30018415eebb07d -r172f313c5afd8dafa9756d9d1600c78ea2e9fcf9
--- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 5144a0cdb812048a94e9d812b30018415eebb07d)
+++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -22,7 +22,7 @@
//------------------------------------------------------------------------------
//
// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
+// Runtime Version:4.0.30319.17929
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -202,6 +202,36 @@
}
///
+ /// Looks up a localized string similar to Berekende waterstand bij doorsnede-eis op de geselecteerde locatie..
+ ///
+ public static string GrassCoverErosionOutwardsWaveConditionsInputContextProperties_DesignWaterLevel_Description {
+ get {
+ return ResourceManager.GetString("GrassCoverErosionOutwardsWaveConditionsInputContextProperties_DesignWaterLevel_De" +
+ "scription", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Bovengrens bepaald aan de hand van de waarde van de waterstand bij doorsnede-eis op de geselecteerde hydraulische locatie..
+ ///
+ public static string GrassCoverErosionOutwardsWaveConditionsInputContextProperties_UpperBoundaryDesignWaterLevel_Description {
+ get {
+ return ResourceManager.GetString("GrassCoverErosionOutwardsWaveConditionsInputContextProperties_UpperBoundaryDesign" +
+ "WaterLevel_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Bovengrens op basis van waterstand bij doorsnede-eis [m+NAP].
+ ///
+ public static string GrassCoverErosionOutwardsWaveConditionsInputContextProperties_UpperBoundaryDesignWaterLevel_DisplayName {
+ get {
+ return ResourceManager.GetString("GrassCoverErosionOutwardsWaveConditionsInputContextProperties_UpperBoundaryDesign" +
+ "WaterLevel_DisplayName", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized string similar to Berekende resultaten voor de hydraulische randvoorwaarden voor gras..
///
public static string GrassCoverErosionOutwardsWaveConditionsOutputProperties_HydraulicBoundaryLocationResult_Description {
Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Properties/Resources.resx
===================================================================
diff -u -r5144a0cdb812048a94e9d812b30018415eebb07d -r172f313c5afd8dafa9756d9d1600c78ea2e9fcf9
--- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Properties/Resources.resx (.../Resources.resx) (revision 5144a0cdb812048a94e9d812b30018415eebb07d)
+++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Properties/Resources.resx (.../Resources.resx) (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -165,4 +165,13 @@
Hydraulische randvoorwaarden voor gras
+
+ Bovengrens bepaald aan de hand van de waarde van de waterstand bij doorsnede-eis op de geselecteerde hydraulische locatie.
+
+
+ Bovengrens op basis van waterstand bij doorsnede-eis [m+NAP]
+
+
+ Berekende waterstand bij doorsnede-eis op de geselecteerde locatie.
+
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PropertyClasses/GrassCoverErosionOutwardsWaveConditionsInputContextProperties.cs
===================================================================
diff -u
--- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PropertyClasses/GrassCoverErosionOutwardsWaveConditionsInputContextProperties.cs (revision 0)
+++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PropertyClasses/GrassCoverErosionOutwardsWaveConditionsInputContextProperties.cs (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -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 Core.Common.Base.Data;
+using Core.Common.Utils.Attributes;
+using Ringtoets.GrassCoverErosionOutwards.Forms.PresentationObjects;
+using Ringtoets.GrassCoverErosionOutwards.Forms.Properties;
+using Ringtoets.Revetment.Data;
+using Ringtoets.Revetment.Forms.PropertyClasses;
+
+namespace Ringtoets.GrassCoverErosionOutwards.Forms.PropertyClasses
+{
+ ///
+ /// Property control the .
+ ///
+ public class GrassCoverErosionOutwardsWaveConditionsInputContextProperties
+ : WaveConditionsInputContextProperties
+ {
+ [ResourcesDisplayName(typeof(Resources), "GrassCoverErosionOutwardsHydraulicBoundaryLocation_DesignWaterLevel_DisplayName")]
+ [ResourcesDescription(typeof(Resources), "GrassCoverErosionOutwardsWaveConditionsInputContextProperties_DesignWaterLevel_Description")]
+ public override RoundedDouble AssessmentLevel
+ {
+ get
+ {
+ return base.AssessmentLevel;
+ }
+ }
+
+ [ResourcesDisplayName(typeof(Resources), "GrassCoverErosionOutwardsWaveConditionsInputContextProperties_UpperBoundaryDesignWaterLevel_DisplayName")]
+ [ResourcesDescription(typeof(Resources), "GrassCoverErosionOutwardsWaveConditionsInputContextProperties_UpperBoundaryDesignWaterLevel_Description")]
+ public override RoundedDouble UpperBoundaryDesignWaterLevel
+ {
+ get
+ {
+ return base.UpperBoundaryDesignWaterLevel;
+ }
+ }
+
+ public override WaveConditionsRevetment RevetmentType
+ {
+ get
+ {
+ return WaveConditionsRevetment.Grass;
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Ringtoets.GrassCoverErosionOutwards.Forms.csproj
===================================================================
diff -u -r723cafd68e612c8febe955bfd9c1d1057e7b7341 -r172f313c5afd8dafa9756d9d1600c78ea2e9fcf9
--- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Ringtoets.GrassCoverErosionOutwards.Forms.csproj (.../Ringtoets.GrassCoverErosionOutwards.Forms.csproj) (revision 723cafd68e612c8febe955bfd9c1d1057e7b7341)
+++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Ringtoets.GrassCoverErosionOutwards.Forms.csproj (.../Ringtoets.GrassCoverErosionOutwards.Forms.csproj) (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -53,6 +53,7 @@
+
Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs
===================================================================
diff -u -rc0c23a5508146aad6005fc0eb3b78bab7a63dc63 -r172f313c5afd8dafa9756d9d1600c78ea2e9fcf9
--- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs (.../GrassCoverErosionOutwardsPlugin.cs) (revision c0c23a5508146aad6005fc0eb3b78bab7a63dc63)
+++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs (.../GrassCoverErosionOutwardsPlugin.cs) (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -87,6 +87,8 @@
};
yield return new PropertyInfo();
+
+ yield return new PropertyInfo();
}
public override IEnumerable GetViewInfos()
@@ -182,6 +184,15 @@
.AddPropertiesItem()
.Build()
};
+
+ yield return new TreeNodeInfo
+ {
+ Text = context => RingtoetsCommonFormsResources.Calculation_Input,
+ Image = context => RingtoetsCommonFormsResources.GenericInputOutputIcon,
+ ContextMenuStrip = (nodeData, parentData, treeViewControl) => Gui.Get(nodeData, treeViewControl)
+ .AddPropertiesItem()
+ .Build()
+ };
}
public override IEnumerable GetExportInfos()
@@ -679,9 +690,8 @@
var childNodes = new List
{
new CommentContext(context.WrappedData),
- new WaveConditionsInputContext(context.WrappedData.InputParameters,
- context.FailureMechanism.ForeshoreProfiles,
- context.AssessmentSection)
+ new GrassCoverErosionOutwardsWaveConditionsInputContext(context.WrappedData.InputParameters,
+ context.FailureMechanism)
};
if (context.WrappedData.HasOutput)
Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PresentationObjects/GrassCoverErosionOutwardsWaveConditionsInputContextTest.cs
===================================================================
diff -u -r723cafd68e612c8febe955bfd9c1d1057e7b7341 -r172f313c5afd8dafa9756d9d1600c78ea2e9fcf9
--- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PresentationObjects/GrassCoverErosionOutwardsWaveConditionsInputContextTest.cs (.../GrassCoverErosionOutwardsWaveConditionsInputContextTest.cs) (revision 723cafd68e612c8febe955bfd9c1d1057e7b7341)
+++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PresentationObjects/GrassCoverErosionOutwardsWaveConditionsInputContextTest.cs (.../GrassCoverErosionOutwardsWaveConditionsInputContextTest.cs) (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -29,7 +29,6 @@
using Ringtoets.GrassCoverErosionOutwards.Forms.PresentationObjects;
using Ringtoets.HydraRing.Data;
using Ringtoets.Revetment.Data;
-using Ringtoets.Revetment.Forms.PresentationObjects;
namespace Ringtoets.GrassCoverErosionOutwards.Forms.Test.PresentationObjects
{
@@ -57,7 +56,6 @@
var context = new GrassCoverErosionOutwardsWaveConditionsInputContext(input, failureMechanism);
// Assert
- Assert.IsInstanceOf(context);
Assert.IsInstanceOf>(context);
Assert.AreSame(input, context.WrappedData);
CollectionAssert.AreEqual(new[] { foreshoreProfile }, context.ForeshoreProfiles);
Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PropertyClasses/GrassCoverErosionOutwardsWaveConditionsInputContextPropertiesTest.cs
===================================================================
diff -u
--- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PropertyClasses/GrassCoverErosionOutwardsWaveConditionsInputContextPropertiesTest.cs (revision 0)
+++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PropertyClasses/GrassCoverErosionOutwardsWaveConditionsInputContextPropertiesTest.cs (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -0,0 +1,400 @@
+// 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.ComponentModel;
+using System.Linq;
+using Core.Common.Base;
+using Core.Common.Base.Data;
+using Core.Common.Base.Geometry;
+using Core.Common.Gui.Converters;
+using Core.Common.Gui.PropertyBag;
+using Core.Common.Utils;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.DikeProfiles;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.GrassCoverErosionOutwards.Data;
+using Ringtoets.GrassCoverErosionOutwards.Forms.PresentationObjects;
+using Ringtoets.GrassCoverErosionOutwards.Forms.PropertyClasses;
+using Ringtoets.HydraRing.Data;
+using Ringtoets.Revetment.Data;
+using Ringtoets.Revetment.Forms.PropertyClasses;
+
+namespace Ringtoets.GrassCoverErosionOutwards.Forms.Test.PropertyClasses
+{
+ [TestFixture]
+ public class GrassCoverErosionOutwardsWaveConditionsInputContextPropertiesTest
+ {
+ private const int hydraulicBoundaryLocationPropertyIndex = 0;
+ private const int assessmentLevelPropertyIndex = 1;
+ private const int upperBoundaryDesignWaterLevelPropertyIndex = 2;
+ private const int upperBoundaryRevetmentPropertyIndex = 3;
+ private const int lowerBoundaryRevetmentPropertyIndex = 4;
+ private const int upperBoundaryWaterLevelsPropertyIndex = 5;
+ private const int lowerBoundaryWaterLevelsPropertyIndex = 6;
+ private const int stepSizePropertyIndex = 7;
+ private const int waterLevelsPropertyIndex = 8;
+
+ private const int foreshoreProfilePropertyIndex = 9;
+ private const int worldReferencePointPropertyIndex = 10;
+ private const int orientationPropertyIndex = 11;
+ private const int breakWaterPropertyIndex = 12;
+ private const int foreshoreGeometryPropertyIndex = 13;
+ private const int revetmentTypePropertyIndex = 14;
+
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Call
+ var properties = new GrassCoverErosionOutwardsWaveConditionsInputContextProperties();
+
+ // Assert
+ Assert.IsInstanceOf>(properties);
+ Assert.IsNull(properties.Data);
+ }
+
+ [Test]
+ public void Data_SetDefaultInputContextInstance_ReturnCorrectPropertyValues()
+ {
+ // Setup
+ var input = new WaveConditionsInput(WaveConditionsRevetment.Grass);
+ var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism();
+ var inputContext = new GrassCoverErosionOutwardsWaveConditionsInputContext(input, failureMechanism);
+
+ // Call
+ var properties = new GrassCoverErosionOutwardsWaveConditionsInputContextProperties
+ {
+ Data = inputContext
+ };
+
+ // Assert
+ Assert.IsNaN(properties.AssessmentLevel.Value);
+ Assert.IsNaN(properties.UpperBoundaryDesignWaterLevel.Value);
+ Assert.AreEqual(2, properties.UpperBoundaryDesignWaterLevel.NumberOfDecimalPlaces);
+ Assert.IsNaN(properties.UpperBoundaryRevetment.Value);
+ Assert.AreEqual(2, properties.UpperBoundaryRevetment.NumberOfDecimalPlaces);
+ Assert.IsNaN(properties.LowerBoundaryRevetment.Value);
+ Assert.AreEqual(2, properties.LowerBoundaryRevetment.NumberOfDecimalPlaces);
+ Assert.IsNaN(properties.UpperBoundaryWaterLevels.Value);
+ Assert.AreEqual(2, properties.UpperBoundaryWaterLevels.NumberOfDecimalPlaces);
+ Assert.IsNaN(properties.LowerBoundaryWaterLevels.Value);
+ Assert.AreEqual(2, properties.LowerBoundaryWaterLevels.NumberOfDecimalPlaces);
+ Assert.AreEqual(0.5, properties.StepSize.AsValue());
+ CollectionAssert.AreEqual(input.WaterLevels, properties.WaterLevels);
+
+ Assert.IsNull(properties.ForeshoreProfile);
+ Assert.IsNull(properties.WorldReferencePoint);
+ Assert.AreEqual(2, properties.Orientation.NumberOfDecimalPlaces);
+ Assert.AreEqual(0, properties.Orientation.Value);
+ Assert.AreSame(input, properties.BreakWater.Data);
+ Assert.AreSame(input, properties.ForeshoreGeometry.Data);
+ Assert.AreEqual(input.RevetmentType, properties.RevetmentType);
+ }
+
+ [Test]
+ public void Data_SetNewInputContextInstanceWithForeshoreProfile_ReturnCorrectPropertyValues()
+ {
+ // Setup
+ var random = new Random(21);
+ var assessmentLevel = (RoundedDouble)random.NextDouble();
+ var lowerBoundaryRevetment = (RoundedDouble)random.NextDouble();
+ var lowerBoundaryWaterLevels = (RoundedDouble)random.NextDouble();
+ var upperBoundaryRevetment = lowerBoundaryRevetment + (RoundedDouble)random.NextDouble();
+ var upperBoundaryWaterLevels = lowerBoundaryWaterLevels + (RoundedDouble)random.NextDouble();
+ var stepSize = WaveConditionsInputStepSize.Half;
+
+ var worldX = (RoundedDouble)random.NextDouble();
+ var worldY = (RoundedDouble)random.NextDouble();
+ var damHeight = (RoundedDouble)random.NextDouble();
+ var foreshoreProfileOrientation = (RoundedDouble)random.NextDouble();
+
+ var foreshoreProfile = new ForeshoreProfile(
+ new Point2D(worldX, worldY),
+ Enumerable.Empty(),
+ new BreakWater(BreakWaterType.Dam, damHeight),
+ new ForeshoreProfile.ConstructionProperties
+ {
+ Name = string.Empty,
+ Orientation = foreshoreProfileOrientation,
+ X0 = -3
+ });
+ var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, string.Empty, 0, 0)
+ {
+ DesignWaterLevel = assessmentLevel
+ };
+ var input = new WaveConditionsInput(WaveConditionsRevetment.StabilityStone)
+ {
+ ForeshoreProfile = foreshoreProfile,
+ HydraulicBoundaryLocation = hydraulicBoundaryLocation,
+ UpperBoundaryRevetment = upperBoundaryRevetment,
+ LowerBoundaryRevetment = lowerBoundaryRevetment,
+ UpperBoundaryWaterLevels = upperBoundaryWaterLevels,
+ LowerBoundaryWaterLevels = lowerBoundaryWaterLevels,
+ StepSize = stepSize
+ };
+
+ var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism();
+ failureMechanism.HydraulicBoundaryLocations.Add(hydraulicBoundaryLocation);
+ failureMechanism.ForeshoreProfiles.Add(foreshoreProfile);
+
+ var inputContext = new GrassCoverErosionOutwardsWaveConditionsInputContext(input, failureMechanism);
+
+ // Call
+ var properties = new GrassCoverErosionOutwardsWaveConditionsInputContextProperties
+ {
+ Data = inputContext
+ };
+
+ // Assert
+ Assert.AreSame(hydraulicBoundaryLocation, properties.HydraulicBoundaryLocation);
+ Assert.AreEqual(assessmentLevel.Value, properties.AssessmentLevel.Value, properties.AssessmentLevel.GetAccuracy());
+ Assert.AreSame(foreshoreProfile, properties.ForeshoreProfile);
+ Assert.AreEqual(worldX, properties.WorldReferencePoint.X, 0.5);
+ Assert.AreEqual(worldY, properties.WorldReferencePoint.Y, 0.5);
+ Assert.AreEqual(2, properties.Orientation.NumberOfDecimalPlaces);
+ Assert.AreEqual(foreshoreProfileOrientation, properties.Orientation.Value, properties.Orientation.GetAccuracy());
+ Assert.AreEqual(BreakWaterType.Dam, properties.BreakWater.BreakWaterType);
+ Assert.AreEqual(damHeight, properties.BreakWater.BreakWaterHeight.Value, properties.BreakWater.BreakWaterHeight.GetAccuracy());
+ Assert.IsEmpty(properties.ForeshoreGeometry.Coordinates);
+ }
+
+ [Test]
+ public void SetProperties_IndividualProperties_UpdateDataAndNotifyObservers()
+ {
+ // Setup
+ var mockRepository = new MockRepository();
+ var observerMock = mockRepository.StrictMock();
+ const int numberProperties = 8;
+ observerMock.Expect(o => o.UpdateObserver()).Repeat.Times(numberProperties);
+ mockRepository.ReplayAll();
+
+ var random = new Random(21);
+ var orientation = (RoundedDouble)random.NextDouble();
+ var assessmentLevel = (RoundedDouble)random.NextDouble();
+ var newLowerBoundaryRevetment = (RoundedDouble)random.NextDouble();
+ var newLowerBoundaryWaterLevels = (RoundedDouble)random.NextDouble();
+ var newUpperBoundaryRevetment = newLowerBoundaryRevetment + (RoundedDouble)random.NextDouble();
+ var newUpperBoundaryWaterLevels = newLowerBoundaryWaterLevels + (RoundedDouble)random.NextDouble();
+ var newStepSize = WaveConditionsInputStepSize.Half;
+
+ var newHydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, "name", 0.0, 1.1)
+ {
+ DesignWaterLevel = assessmentLevel
+ };
+
+ var input = new WaveConditionsInput(WaveConditionsRevetment.StabilityStone);
+ input.Attach(observerMock);
+
+ var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism();
+
+ var inputContext = new GrassCoverErosionOutwardsWaveConditionsInputContext(input, failureMechanism);
+
+ var newForeshoreProfile = new ForeshoreProfile(
+ new Point2D(
+ (RoundedDouble)random.NextDouble(),
+ (RoundedDouble)random.NextDouble()),
+ Enumerable.Empty(),
+ new BreakWater(BreakWaterType.Dam, (RoundedDouble)random.NextDouble()),
+ new ForeshoreProfile.ConstructionProperties());
+
+ var properties = new GrassCoverErosionOutwardsWaveConditionsInputContextProperties
+ {
+ Data = inputContext
+ };
+
+ // Call
+ properties.ForeshoreProfile = newForeshoreProfile;
+ properties.UpperBoundaryRevetment = newUpperBoundaryRevetment;
+ properties.LowerBoundaryRevetment = newLowerBoundaryRevetment;
+ properties.UpperBoundaryWaterLevels = newUpperBoundaryWaterLevels;
+ properties.LowerBoundaryWaterLevels = newLowerBoundaryWaterLevels;
+ properties.StepSize = newStepSize;
+ properties.HydraulicBoundaryLocation = newHydraulicBoundaryLocation;
+ properties.Orientation = orientation;
+
+ // Assert
+ Assert.AreSame(input.HydraulicBoundaryLocation, properties.HydraulicBoundaryLocation);
+ Assert.AreEqual(input.HydraulicBoundaryLocation.DesignWaterLevel.Value, properties.AssessmentLevel.Value);
+ Assert.AreEqual(assessmentLevel - 0.01, properties.UpperBoundaryDesignWaterLevel.Value, properties.UpperBoundaryDesignWaterLevel.GetAccuracy());
+ Assert.AreEqual(2, properties.UpperBoundaryDesignWaterLevel.NumberOfDecimalPlaces);
+ Assert.AreEqual(newUpperBoundaryRevetment.Value, properties.UpperBoundaryRevetment.Value, properties.UpperBoundaryRevetment.GetAccuracy());
+ Assert.AreEqual(2, properties.UpperBoundaryRevetment.NumberOfDecimalPlaces);
+ Assert.AreEqual(newLowerBoundaryRevetment.Value, properties.LowerBoundaryRevetment.Value, properties.LowerBoundaryRevetment.GetAccuracy());
+ Assert.AreEqual(2, properties.LowerBoundaryRevetment.NumberOfDecimalPlaces);
+ Assert.AreEqual(newUpperBoundaryWaterLevels.Value, properties.UpperBoundaryWaterLevels.Value, properties.UpperBoundaryWaterLevels.GetAccuracy());
+ Assert.AreEqual(2, properties.UpperBoundaryWaterLevels.NumberOfDecimalPlaces);
+ Assert.AreEqual(newLowerBoundaryWaterLevels.Value, properties.LowerBoundaryWaterLevels.Value, properties.LowerBoundaryWaterLevels.GetAccuracy());
+ Assert.AreEqual(2, properties.LowerBoundaryWaterLevels.NumberOfDecimalPlaces);
+ Assert.AreEqual(orientation, properties.Orientation.Value, properties.Orientation.GetAccuracy());
+ Assert.AreEqual(2, properties.Orientation.NumberOfDecimalPlaces);
+ Assert.AreEqual(newStepSize, properties.StepSize);
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ public void PropertyAttributes_ReturnExpectedValues(
+ [Values(true, false)] bool withForeshoreProfile)
+ {
+ // Setup
+ var input = new WaveConditionsInput(WaveConditionsRevetment.StabilityStone);
+ var foreshoreProfile = new ForeshoreProfile(
+ new Point2D(0, 0),
+ Enumerable.Empty(),
+ null,
+ new ForeshoreProfile.ConstructionProperties());
+
+ if (withForeshoreProfile)
+ {
+ input.ForeshoreProfile = foreshoreProfile;
+ }
+ var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism();
+
+ var inputContext = new GrassCoverErosionOutwardsWaveConditionsInputContext(input, failureMechanism);
+
+ // Call
+ var properties = new GrassCoverErosionOutwardsWaveConditionsInputContextProperties
+ {
+ Data = inputContext
+ };
+
+ // Assert
+ var dynamicPropertyBag = new DynamicPropertyBag(properties);
+ PropertyDescriptorCollection dynamicProperties = dynamicPropertyBag.GetProperties(new Attribute[]
+ {
+ BrowsableAttribute.Yes
+ });
+ Assert.AreEqual(15, dynamicProperties.Count);
+
+ var hydraulicParametersCategory = "Hydraulische gegevens";
+ var schematizationCategory = "Schematisatie";
+
+ PropertyDescriptor hydraulicBoundaryLocationProperty = dynamicProperties[hydraulicBoundaryLocationPropertyIndex];
+ Assert.IsNotNull(hydraulicBoundaryLocationProperty);
+ Assert.IsFalse(hydraulicBoundaryLocationProperty.IsReadOnly);
+ Assert.AreEqual(hydraulicParametersCategory, hydraulicBoundaryLocationProperty.Category);
+ Assert.AreEqual("Locatie met hydraulische randvoorwaarden", hydraulicBoundaryLocationProperty.DisplayName);
+ Assert.AreEqual("De locatie met hydraulische randvoorwaarden.", hydraulicBoundaryLocationProperty.Description);
+
+ PropertyDescriptor assessmentLevelProperty = dynamicProperties[assessmentLevelPropertyIndex];
+ Assert.IsNotNull(assessmentLevelProperty);
+ Assert.IsTrue(assessmentLevelProperty.IsReadOnly);
+ Assert.AreEqual(hydraulicParametersCategory, assessmentLevelProperty.Category);
+ Assert.AreEqual("Waterstand bij doorsnede-eis [m+NAP]", assessmentLevelProperty.DisplayName);
+ Assert.AreEqual("Berekende waterstand bij doorsnede-eis op de geselecteerde locatie.", assessmentLevelProperty.Description);
+
+ PropertyDescriptor upperBoundaryDesignWaterLevelProperty = dynamicProperties[upperBoundaryDesignWaterLevelPropertyIndex];
+ Assert.IsNotNull(upperBoundaryDesignWaterLevelProperty);
+ Assert.IsTrue(upperBoundaryDesignWaterLevelProperty.IsReadOnly);
+ Assert.AreEqual(hydraulicParametersCategory, upperBoundaryDesignWaterLevelProperty.Category);
+ Assert.AreEqual("Bovengrens op basis van waterstand bij doorsnede-eis [m+NAP]", upperBoundaryDesignWaterLevelProperty.DisplayName);
+ Assert.AreEqual("Bovengrens bepaald aan de hand van de waarde van de waterstand bij doorsnede-eis op de geselecteerde hydraulische locatie.", upperBoundaryDesignWaterLevelProperty.Description);
+
+ PropertyDescriptor upperBoundaryRevetmentProperty = dynamicProperties[upperBoundaryRevetmentPropertyIndex];
+ Assert.IsNotNull(upperBoundaryRevetmentProperty);
+ Assert.IsTrue(upperBoundaryDesignWaterLevelProperty.IsReadOnly);
+ Assert.AreEqual(hydraulicParametersCategory, upperBoundaryRevetmentProperty.Category);
+ Assert.AreEqual("Bovengrens bekleding [m+NAP]", upperBoundaryRevetmentProperty.DisplayName);
+ Assert.AreEqual("Bovengrens van de bekleding.", upperBoundaryRevetmentProperty.Description);
+
+ PropertyDescriptor lowerBoundaryRevetmentProperty = dynamicProperties[lowerBoundaryRevetmentPropertyIndex];
+ Assert.IsNotNull(lowerBoundaryRevetmentProperty);
+ Assert.IsFalse(lowerBoundaryRevetmentProperty.IsReadOnly);
+ Assert.AreEqual(hydraulicParametersCategory, lowerBoundaryRevetmentProperty.Category);
+ Assert.AreEqual("Ondergrens bekleding [m+NAP]", lowerBoundaryRevetmentProperty.DisplayName);
+ Assert.AreEqual("Ondergrens van de bekleding.", lowerBoundaryRevetmentProperty.Description);
+
+ PropertyDescriptor upperBoundaryWaterLevelsProperty = dynamicProperties[upperBoundaryWaterLevelsPropertyIndex];
+ Assert.IsNotNull(upperBoundaryWaterLevelsProperty);
+ Assert.IsFalse(upperBoundaryWaterLevelsProperty.IsReadOnly);
+ Assert.AreEqual(hydraulicParametersCategory, upperBoundaryWaterLevelsProperty.Category);
+ Assert.AreEqual("Bovengrens waterstanden [m+NAP]", upperBoundaryWaterLevelsProperty.DisplayName);
+ Assert.AreEqual("Een aangepaste bovengrens voor de waterstanden.", upperBoundaryWaterLevelsProperty.Description);
+
+ PropertyDescriptor lowerBoundaryWaterLevelsProperty = dynamicProperties[lowerBoundaryWaterLevelsPropertyIndex];
+ Assert.IsNotNull(lowerBoundaryWaterLevelsProperty);
+ Assert.IsFalse(lowerBoundaryWaterLevelsProperty.IsReadOnly);
+ Assert.AreEqual(hydraulicParametersCategory, lowerBoundaryWaterLevelsProperty.Category);
+ Assert.AreEqual("Ondergrens waterstanden [m+NAP]", lowerBoundaryWaterLevelsProperty.DisplayName);
+ Assert.AreEqual("Een aangepaste ondergrens voor de waterstanden.", lowerBoundaryWaterLevelsProperty.Description);
+
+ PropertyDescriptor stepSizeProperty = dynamicProperties[stepSizePropertyIndex];
+ Assert.IsNotNull(stepSizeProperty);
+ Assert.IsInstanceOf(stepSizeProperty.Converter);
+ Assert.IsFalse(stepSizeProperty.IsReadOnly);
+ Assert.AreEqual(hydraulicParametersCategory, stepSizeProperty.Category);
+ Assert.AreEqual("Stapgrootte [m]", stepSizeProperty.DisplayName);
+ Assert.AreEqual("Grootte van de stappen waarmee de waterstanden in de berekening worden bepaald.", stepSizeProperty.Description);
+
+ PropertyDescriptor waterLevelsProperty = dynamicProperties[waterLevelsPropertyIndex];
+ Assert.IsNotNull(waterLevelsProperty);
+ Assert.IsInstanceOf(waterLevelsProperty.Converter);
+ Assert.IsTrue(waterLevelsProperty.IsReadOnly);
+ Assert.AreEqual(hydraulicParametersCategory, waterLevelsProperty.Category);
+ Assert.AreEqual("Waterstanden in berekening [m+NAP]", waterLevelsProperty.DisplayName);
+ Assert.AreEqual("De waterstanden waarvoor gerekend moet worden. Deze zijn afgeleid van de opgegeven boven- en ondergrenzen, en van de stapgrootte.", waterLevelsProperty.Description);
+
+ PropertyDescriptor foreshoreProfileProperty = dynamicProperties[foreshoreProfilePropertyIndex];
+ Assert.IsNotNull(foreshoreProfileProperty);
+ Assert.IsFalse(foreshoreProfileProperty.IsReadOnly);
+ Assert.AreEqual(schematizationCategory, foreshoreProfileProperty.Category);
+ Assert.AreEqual("Voorlandprofiel", foreshoreProfileProperty.DisplayName);
+ Assert.AreEqual("De schematisatie van het voorlandprofiel.", foreshoreProfileProperty.Description);
+
+ PropertyDescriptor worldReferencePointProperty = dynamicProperties[worldReferencePointPropertyIndex];
+ Assert.IsNotNull(worldReferencePointProperty);
+ Assert.IsTrue(worldReferencePointProperty.IsReadOnly);
+ Assert.AreEqual(schematizationCategory, worldReferencePointProperty.Category);
+ Assert.AreEqual("Locatie (RD) [m]", worldReferencePointProperty.DisplayName);
+ Assert.AreEqual("De coördinaten van de locatie van het voorlandprofiel in het Rijksdriehoeksstelsel.", worldReferencePointProperty.Description);
+
+ PropertyDescriptor orientationProperty = dynamicProperties[orientationPropertyIndex];
+ Assert.IsNotNull(orientationProperty);
+ Assert.IsFalse(orientationProperty.IsReadOnly);
+ Assert.AreEqual(schematizationCategory, orientationProperty.Category);
+ Assert.AreEqual("Oriëntatie [°]", orientationProperty.DisplayName);
+ Assert.AreEqual("Oriëntatie van de dijknormaal ten opzichte van het noorden.", orientationProperty.Description);
+
+ PropertyDescriptor breakWaterProperty = dynamicProperties[breakWaterPropertyIndex];
+ Assert.IsNotNull(breakWaterProperty);
+ Assert.IsInstanceOf(breakWaterProperty.Converter);
+ Assert.IsTrue(breakWaterProperty.IsReadOnly);
+ Assert.AreEqual(schematizationCategory, breakWaterProperty.Category);
+ Assert.AreEqual("Dam", breakWaterProperty.DisplayName);
+ Assert.AreEqual("Eigenschappen van de dam.", breakWaterProperty.Description);
+
+ PropertyDescriptor foreshoreGeometryProperty = dynamicProperties[foreshoreGeometryPropertyIndex];
+ Assert.IsNotNull(foreshoreGeometryProperty);
+ Assert.IsInstanceOf(foreshoreGeometryProperty.Converter);
+ Assert.IsTrue(foreshoreGeometryProperty.IsReadOnly);
+ Assert.AreEqual(schematizationCategory, foreshoreGeometryProperty.Category);
+ Assert.AreEqual("Voorlandgeometrie", foreshoreGeometryProperty.DisplayName);
+ Assert.AreEqual("Eigenschappen van de voorlandgeometrie.", foreshoreGeometryProperty.Description);
+
+ PropertyDescriptor revetmentTypeProperty = dynamicProperties[revetmentTypePropertyIndex];
+ Assert.IsNotNull(revetmentTypeProperty);
+ Assert.IsTrue(revetmentTypeProperty.IsReadOnly);
+ Assert.AreEqual(schematizationCategory, revetmentTypeProperty.Category);
+ Assert.AreEqual("Type bekleding", revetmentTypeProperty.DisplayName);
+ Assert.AreEqual("Het type van de bekleding waarvoor berekend wordt.", revetmentTypeProperty.Description);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Ringtoets.GrassCoverErosionOutwards.Forms.Test.csproj
===================================================================
diff -u -r723cafd68e612c8febe955bfd9c1d1057e7b7341 -r172f313c5afd8dafa9756d9d1600c78ea2e9fcf9
--- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Ringtoets.GrassCoverErosionOutwards.Forms.Test.csproj (.../Ringtoets.GrassCoverErosionOutwards.Forms.Test.csproj) (revision 723cafd68e612c8febe955bfd9c1d1057e7b7341)
+++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Ringtoets.GrassCoverErosionOutwards.Forms.Test.csproj (.../Ringtoets.GrassCoverErosionOutwards.Forms.Test.csproj) (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -81,6 +81,7 @@
+
@@ -90,6 +91,7 @@
+
Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/TreeNodeInfos/GrassCoverErosionOutwardsWaveConditionsCalculationContextTreeNodeInfoTest.cs
===================================================================
diff -u -r86401a913aaf544979e4062d00acfe1fb24e1e4f -r172f313c5afd8dafa9756d9d1600c78ea2e9fcf9
--- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/TreeNodeInfos/GrassCoverErosionOutwardsWaveConditionsCalculationContextTreeNodeInfoTest.cs (.../GrassCoverErosionOutwardsWaveConditionsCalculationContextTreeNodeInfoTest.cs) (revision 86401a913aaf544979e4062d00acfe1fb24e1e4f)
+++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/TreeNodeInfos/GrassCoverErosionOutwardsWaveConditionsCalculationContextTreeNodeInfoTest.cs (.../GrassCoverErosionOutwardsWaveConditionsCalculationContextTreeNodeInfoTest.cs) (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -326,6 +326,10 @@
ForeshoreProfiles =
{
foreshoreProfile
+ },
+ HydraulicBoundaryLocations =
+ {
+ location
}
};
var context = new GrassCoverErosionOutwardsWaveConditionsCalculationContext(calculation,
@@ -341,7 +345,7 @@
var commentsContext = (CommentContext) children[0];
Assert.AreSame(calculation, commentsContext.WrappedData);
- var inputContext = (WaveConditionsInputContext) children[1];
+ var inputContext = (GrassCoverErosionOutwardsWaveConditionsInputContext)children[1];
Assert.AreSame(calculation.InputParameters, inputContext.WrappedData);
CollectionAssert.AreEqual(new[]
{
@@ -386,6 +390,10 @@
ForeshoreProfiles =
{
foreshoreProfile
+ },
+ HydraulicBoundaryLocations =
+ {
+ location
}
};
var context = new GrassCoverErosionOutwardsWaveConditionsCalculationContext(calculation,
@@ -401,7 +409,7 @@
var commentsContext = (CommentContext) children[0];
Assert.AreSame(calculation, commentsContext.WrappedData);
- var inputContext = (WaveConditionsInputContext) children[1];
+ var inputContext = (GrassCoverErosionOutwardsWaveConditionsInputContext) children[1];
Assert.AreSame(calculation.InputParameters, inputContext.WrappedData);
CollectionAssert.AreEqual(new[]
{
Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/TreeNodeInfos/GrassCoverErosionOutwardsWaveConditionsInputContextTreeNodeInfoTest.cs
===================================================================
diff -u
--- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/TreeNodeInfos/GrassCoverErosionOutwardsWaveConditionsInputContextTreeNodeInfoTest.cs (revision 0)
+++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/TreeNodeInfos/GrassCoverErosionOutwardsWaveConditionsInputContextTreeNodeInfoTest.cs (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -0,0 +1,150 @@
+// 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.Drawing;
+using System.Linq;
+using Core.Common.Controls.TreeView;
+using Core.Common.Gui;
+using Core.Common.Gui.ContextMenu;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.GrassCoverErosionOutwards.Data;
+using Ringtoets.GrassCoverErosionOutwards.Forms.PresentationObjects;
+using Ringtoets.GrassCoverErosionOutwards.Plugin;
+using Ringtoets.Revetment.Data;
+using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+
+namespace Ringtoets.GrassCoverErosionOutwards.Forms.Test.TreeNodeInfos
+{
+ [TestFixture]
+ public class GrassCoverErosionOutwardsWaveConditionsInputContextTreeNodeInfoTest
+ {
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Setup
+ using (var plugin = new GrassCoverErosionOutwardsPlugin())
+ {
+ var info = GetInfo(plugin);
+
+ // Assert
+ Assert.IsNull(info.EnsureVisibleOnCreate);
+ Assert.IsNull(info.CanRename);
+ Assert.IsNull(info.OnNodeRenamed);
+ Assert.IsNull(info.CanRemove);
+ Assert.IsNull(info.OnNodeRemoved);
+ Assert.IsNull(info.CanCheck);
+ Assert.IsNull(info.IsChecked);
+ Assert.IsNull(info.OnNodeChecked);
+ Assert.IsNull(info.CanDrag);
+ Assert.IsNull(info.CanDrop);
+ Assert.IsNull(info.CanInsert);
+ Assert.IsNull(info.OnDrop);
+ Assert.IsNull(info.ChildNodeObjects);
+ Assert.IsNull(info.ForeColor);
+ }
+ }
+
+ [Test]
+ public void Text_Always_ReturnName()
+ {
+ // Setup
+ var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism();
+
+ var input = new WaveConditionsInput(WaveConditionsRevetment.Grass);
+ var context = new GrassCoverErosionOutwardsWaveConditionsInputContext(input, failureMechanism);
+
+ using (var plugin = new GrassCoverErosionOutwardsPlugin())
+ {
+ var info = GetInfo(plugin);
+
+ // Call
+ string nodeText = info.Text(context);
+
+ // Assert
+ Assert.AreEqual("Invoer", nodeText);
+ }
+ }
+
+ [Test]
+ public void Image_Always_ReturnOutputIcon()
+ {
+ // Setup
+ var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism();
+
+ var input = new WaveConditionsInput(WaveConditionsRevetment.Grass);
+ var context = new GrassCoverErosionOutwardsWaveConditionsInputContext(input, failureMechanism);
+
+ using (var plugin = new GrassCoverErosionOutwardsPlugin())
+ {
+ var info = GetInfo(plugin);
+ // Call
+ Image icon = info.Image(context);
+
+ // Assert
+ TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.GenericInputOutputIcon, icon);
+ }
+ }
+
+ [Test]
+ public void ContextMenuStrip_FailureMechanismIsRelevant_CallsContextMenuBuilderMethods()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ using (var treeViewControl = new TreeViewControl())
+ {
+ var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism();
+
+ var input = new WaveConditionsInput(WaveConditionsRevetment.Grass);
+ var context = new GrassCoverErosionOutwardsWaveConditionsInputContext(input, failureMechanism);
+
+ var menuBuilder = mocks.StrictMock();
+ menuBuilder.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilder);
+ menuBuilder.Expect(mb => mb.Build()).Return(null);
+
+ var gui = mocks.StrictMock();
+ gui.Expect(cmp => cmp.Get(context, treeViewControl)).Return(menuBuilder);
+ gui.Stub(g => g.ProjectOpened += null).IgnoreArguments();
+ gui.Stub(g => g.ProjectOpened -= null).IgnoreArguments();
+
+ mocks.ReplayAll();
+
+ using (var plugin = new GrassCoverErosionOutwardsPlugin())
+ {
+ var info = GetInfo(plugin);
+ plugin.Gui = gui;
+
+ // Call
+ info.ContextMenuStrip(context, null, treeViewControl);
+ }
+ }
+
+ // Assert
+ mocks.VerifyAll();
+ }
+
+ private TreeNodeInfo GetInfo(GrassCoverErosionOutwardsPlugin plugin)
+ {
+ return plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(GrassCoverErosionOutwardsWaveConditionsInputContext));
+ }
+ }
+}
Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/GrassCoverErosionOutwardsPluginTest.cs
===================================================================
diff -u -r6da94dc5f56cf8edbf991440dd97f5b28856e658 -r172f313c5afd8dafa9756d9d1600c78ea2e9fcf9
--- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/GrassCoverErosionOutwardsPluginTest.cs (.../GrassCoverErosionOutwardsPluginTest.cs) (revision 6da94dc5f56cf8edbf991440dd97f5b28856e658)
+++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/GrassCoverErosionOutwardsPluginTest.cs (.../GrassCoverErosionOutwardsPluginTest.cs) (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -79,7 +79,7 @@
TreeNodeInfo[] treeNodeInfos = plugin.GetTreeNodeInfos().ToArray();
// Assert
- Assert.AreEqual(9, treeNodeInfos.Length);
+ Assert.AreEqual(10, treeNodeInfos.Length);
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(GrassCoverErosionOutwardsFailureMechanismContext)));
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(FailureMechanismSectionResultContext)));
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(HydraulicBoundariesGroupContext)));
@@ -89,6 +89,7 @@
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(GrassCoverErosionOutwardsWaveConditionsCalculationContext)));
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(EmptyGrassCoverErosionOutwardsOutput)));
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(GrassCoverErosionOutwardsWaveConditionsOutput)));
+ Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(GrassCoverErosionOutwardsWaveConditionsInputContext)));
}
}
@@ -102,7 +103,7 @@
PropertyInfo[] propertyInfos = plugin.GetPropertyInfos().ToArray();
// Assert
- Assert.AreEqual(4, propertyInfos.Length);
+ Assert.AreEqual(5, propertyInfos.Length);
PropertyInfo grassCoverErosionOutwardsFailureMechanismProperties = PluginTestHelper.AssertPropertyInfoDefined<
GrassCoverErosionOutwardsFailureMechanismContext,
@@ -127,6 +128,12 @@
GrassCoverErosionOutwardsWaveConditionsOutputProperties>(propertyInfos);
Assert.IsNull(grassCoverErosionWaveConditionsOutputProperties.AdditionalDataCheck);
Assert.IsNull(grassCoverErosionWaveConditionsOutputProperties.AfterCreate);
+
+ var grassCoverErosionWaveConditionsInputContextroperties = PluginTestHelper.AssertPropertyInfoDefined<
+ GrassCoverErosionOutwardsWaveConditionsInputContext,
+ GrassCoverErosionOutwardsWaveConditionsInputContextProperties>(propertyInfos);
+ Assert.IsNull(grassCoverErosionWaveConditionsInputContextroperties.AdditionalDataCheck);
+ Assert.IsNull(grassCoverErosionWaveConditionsInputContextroperties.AfterCreate);
}
}
Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs
===================================================================
diff -u -rd582180db4f7e3bafb689cb22ead5ef10e8e8235 -r172f313c5afd8dafa9756d9d1600c78ea2e9fcf9
--- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision d582180db4f7e3bafb689cb22ead5ef10e8e8235)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -281,7 +281,6 @@
};
yield return new PropertyInfo();
yield return new PropertyInfo();
- yield return new PropertyInfo>();
}
///
@@ -599,15 +598,6 @@
.Build()
};
- yield return new TreeNodeInfo
- {
- Text = context => RingtoetsCommonFormsResources.Calculation_Input,
- Image = context => RingtoetsCommonFormsResources.GenericInputOutputIcon,
- ContextMenuStrip = (nodeData, parentData, treeViewControl) => Gui.Get(nodeData, treeViewControl)
- .AddPropertiesItem()
- .Build()
- };
-
yield return CreateFailureMechanismSectionResultTreeNodeInfo();
yield return CreateFailureMechanismSectionResultTreeNodeInfo();
yield return CreateFailureMechanismSectionResultTreeNodeInfo();
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj
===================================================================
diff -u -rc0c23a5508146aad6005fc0eb3b78bab7a63dc63 -r172f313c5afd8dafa9756d9d1600c78ea2e9fcf9
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision c0c23a5508146aad6005fc0eb3b78bab7a63dc63)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -110,7 +110,6 @@
-
Fisheye: Tag 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9 refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/WaveConditionsInputContextTreeNodeInfoTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs
===================================================================
diff -u -rd582180db4f7e3bafb689cb22ead5ef10e8e8235 -r172f313c5afd8dafa9756d9d1600c78ea2e9fcf9
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs (.../RingtoetsPluginTest.cs) (revision d582180db4f7e3bafb689cb22ead5ef10e8e8235)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs (.../RingtoetsPluginTest.cs) (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -201,7 +201,7 @@
PropertyInfo[] propertyInfos = plugin.GetPropertyInfos().ToArray();
// Assert
- Assert.AreEqual(13, propertyInfos.Length);
+ Assert.AreEqual(12, propertyInfos.Length);
PropertyInfo ringtoetsProjectProperties = PluginTestHelper.AssertPropertyInfoDefined
(propertyInfos);
@@ -274,13 +274,6 @@
Assert.IsNull(foreshoreProfileProperties.AdditionalDataCheck);
Assert.IsNull(foreshoreProfileProperties.GetObjectPropertiesData);
Assert.IsNull(foreshoreProfileProperties.AfterCreate);
-
- PropertyInfo waveConditionsInputProperites = PluginTestHelper.AssertPropertyInfoDefined<
- WaveConditionsInputContext,
- WaveConditionsInputContextProperties>(propertyInfos);
- Assert.IsNull(waveConditionsInputProperites.AdditionalDataCheck);
- Assert.IsNull(waveConditionsInputProperites.GetObjectPropertiesData);
- Assert.IsNull(waveConditionsInputProperites.AfterCreate);
}
}
@@ -410,7 +403,7 @@
TreeNodeInfo[] treeNodeInfos = plugin.GetTreeNodeInfos().ToArray();
// Assert
- Assert.AreEqual(28, treeNodeInfos.Length);
+ Assert.AreEqual(27, treeNodeInfos.Length);
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(AssessmentSection)));
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(ReferenceLineContext)));
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(FailureMechanismContext)));
@@ -438,7 +431,6 @@
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(CommentContext)));
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(ProbabilityAssessmentOutput)));
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(RingtoetsProject)));
- Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(WaveConditionsInputContext)));
}
}
Fisheye: Tag 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9 refers to a dead (removed) revision in file `Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/PresentationObjects/IWaveConditionsInputContext.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/PresentationObjects/WaveConditionsInputContext.cs
===================================================================
diff -u -rd582180db4f7e3bafb689cb22ead5ef10e8e8235 -r172f313c5afd8dafa9756d9d1600c78ea2e9fcf9
--- Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/PresentationObjects/WaveConditionsInputContext.cs (.../WaveConditionsInputContext.cs) (revision d582180db4f7e3bafb689cb22ead5ef10e8e8235)
+++ Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/PresentationObjects/WaveConditionsInputContext.cs (.../WaveConditionsInputContext.cs) (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -21,9 +21,7 @@
using System;
using System.Collections.Generic;
-using System.Linq;
using Core.Common.Controls.PresentationObjects;
-using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.Data.DikeProfiles;
using Ringtoets.HydraRing.Data;
using Ringtoets.Revetment.Data;
@@ -33,45 +31,24 @@
///
/// Presentation object for the .
///
- public class WaveConditionsInputContext : ObservableWrappedObjectContextBase, IWaveConditionsInputContext
+ public abstract class WaveConditionsInputContext : ObservableWrappedObjectContextBase
{
- private readonly IAssessmentSection assessmentSection;
-
///
/// Initializes a new instance of the class.
///
/// The wrapped .
- ///
- /// The assessment section which the context belongs to.
/// Thrown when any input argument is null .
- public WaveConditionsInputContext(WaveConditionsInput wrappedData,
- IEnumerable foreshoreProfiles,
- IAssessmentSection assessmentSection)
- : base(wrappedData)
- {
- if (foreshoreProfiles == null)
- {
- throw new ArgumentNullException("foreshoreProfiles");
- }
- if (assessmentSection == null)
- {
- throw new ArgumentNullException("assessmentSection");
- }
+ protected WaveConditionsInputContext(WaveConditionsInput wrappedData)
+ : base(wrappedData) {}
- ForeshoreProfiles = foreshoreProfiles;
- this.assessmentSection = assessmentSection;
- }
+ ///
+ /// Gets the hydraulic boundary locations.
+ ///
+ public abstract IEnumerable HydraulicBoundaryLocations { get; }
- public IEnumerable HydraulicBoundaryLocations
- {
- get
- {
- return assessmentSection.HydraulicBoundaryDatabase != null ?
- assessmentSection.HydraulicBoundaryDatabase.Locations :
- Enumerable.Empty();
- }
- }
-
- public IEnumerable ForeshoreProfiles { get; private set; }
+ ///
+ /// Gets the foreshore profiles.
+ ///
+ public abstract IEnumerable ForeshoreProfiles { get; }
}
}
\ No newline at end of file
Index: Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/PropertyClasses/IWaveConditionsInputContextProperties.cs
===================================================================
diff -u
--- Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/PropertyClasses/IWaveConditionsInputContextProperties.cs (revision 0)
+++ Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/PropertyClasses/IWaveConditionsInputContextProperties.cs (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -0,0 +1,53 @@
+// 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.Collections.Generic;
+using Core.Common.Gui.PropertyBag;
+using Ringtoets.Common.Data.DikeProfiles;
+using Ringtoets.HydraRing.Data;
+using Ringtoets.Revetment.Forms.PresentationObjects;
+
+namespace Ringtoets.Revetment.Forms.PropertyClasses
+{
+ ///
+ /// Interface for wave conditions input properties classes.
+ ///
+ /// The type of the wave conditions input presentation object.
+ public interface IWaveConditionsInputContextProperties : IObjectProperties where T : WaveConditionsInputContext
+ {
+ ///
+ /// Gets the available .
+ ///
+ /// An of available .
+ IEnumerable GetAvailableHydraulicBoundaryLocations();
+
+ ///
+ /// Gets the available .
+ ///
+ /// An of available .
+ IEnumerable GetAvailableForeshoreProfiles();
+
+ ///
+ /// Gets and sets the selected .
+ ///
+ HydraulicBoundaryLocation HydraulicBoundaryLocation { get; set; }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/PropertyClasses/WaveConditionsInputContextProperties.cs
===================================================================
diff -u -rd582180db4f7e3bafb689cb22ead5ef10e8e8235 -r172f313c5afd8dafa9756d9d1600c78ea2e9fcf9
--- Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/PropertyClasses/WaveConditionsInputContextProperties.cs (.../WaveConditionsInputContextProperties.cs) (revision d582180db4f7e3bafb689cb22ead5ef10e8e8235)
+++ Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/PropertyClasses/WaveConditionsInputContextProperties.cs (.../WaveConditionsInputContextProperties.cs) (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -25,7 +25,6 @@
using System.Linq;
using Core.Common.Base.Data;
using Core.Common.Base.Geometry;
-using Core.Common.Controls.PresentationObjects;
using Core.Common.Gui.Attributes;
using Core.Common.Gui.Converters;
using Core.Common.Gui.PropertyBag;
@@ -44,8 +43,7 @@
///
/// ViewModel of for properties panel.
///
- public class WaveConditionsInputContextProperties : ObjectProperties where T : WrappedObjectContextBase,
- IWaveConditionsInputContext
+ public class WaveConditionsInputContextProperties : ObjectProperties, IWaveConditionsInputContextProperties where T : WaveConditionsInputContext
{
private const int hydraulicBoundaryLocationPropertyIndex = 0;
private const int assessmentLevelPropertyIndex = 1;
@@ -110,7 +108,7 @@
[ResourcesCategory(typeof(RingtoetsCommonFormsResources), "Categories_HydraulicData")]
[ResourcesDisplayName(typeof(Resources), "WaveConditionsInput_UpperBoundaryRevetment_DisplayName")]
[ResourcesDescription(typeof(Resources), "WaveConditionsInput_UpperBoundaryRevetment_Description")]
- public virtual RoundedDouble UpperBoundaryRevetment
+ public RoundedDouble UpperBoundaryRevetment
{
get
{
@@ -127,7 +125,7 @@
[ResourcesCategory(typeof(RingtoetsCommonFormsResources), "Categories_HydraulicData")]
[ResourcesDisplayName(typeof(Resources), "WaveConditionsInput_LowerBoundaryRevetment_DisplayName")]
[ResourcesDescription(typeof(Resources), "WaveConditionsInput_LowerBoundaryRevetment_Description")]
- public virtual RoundedDouble LowerBoundaryRevetment
+ public RoundedDouble LowerBoundaryRevetment
{
get
{
@@ -144,7 +142,7 @@
[ResourcesCategory(typeof(RingtoetsCommonFormsResources), "Categories_HydraulicData")]
[ResourcesDisplayName(typeof(Resources), "WaveConditionsInput_UpperBoundaryWaterLevels_DisplayName")]
[ResourcesDescription(typeof(Resources), "WaveConditionsInput_UpperBoundaryWaterLevels_Description")]
- public virtual RoundedDouble UpperBoundaryWaterLevels
+ public RoundedDouble UpperBoundaryWaterLevels
{
get
{
@@ -161,7 +159,7 @@
[ResourcesCategory(typeof(RingtoetsCommonFormsResources), "Categories_HydraulicData")]
[ResourcesDisplayName(typeof(Resources), "WaveConditionsInput_LowerBoundaryWaterLevels_DisplayName")]
[ResourcesDescription(typeof(Resources), "WaveConditionsInput_LowerBoundaryWaterLevels_Description")]
- public virtual RoundedDouble LowerBoundaryWaterLevels
+ public RoundedDouble LowerBoundaryWaterLevels
{
get
{
@@ -179,7 +177,7 @@
[ResourcesCategory(typeof(RingtoetsCommonFormsResources), "Categories_HydraulicData")]
[ResourcesDisplayName(typeof(Resources), "WaveConditionsInput_StepSize_DisplayName")]
[ResourcesDescription(typeof(Resources), "WaveConditionsInput_StepSize_Description")]
- public virtual WaveConditionsInputStepSize StepSize
+ public WaveConditionsInputStepSize StepSize
{
get
{
@@ -197,7 +195,7 @@
[ResourcesCategory(typeof(RingtoetsCommonFormsResources), "Categories_HydraulicData")]
[ResourcesDisplayName(typeof(Resources), "WaveConditionsInput_WaterLevels_DisplayName")]
[ResourcesDescription(typeof(Resources), "WaveConditionsInput_WaterLevels_Description")]
- public virtual RoundedDouble[] WaterLevels
+ public RoundedDouble[] WaterLevels
{
get
{
@@ -210,7 +208,7 @@
[ResourcesCategory(typeof(RingtoetsCommonFormsResources), "Categories_Schematization")]
[ResourcesDisplayName(typeof(Resources), "ForeshoreProfile_DisplayName")]
[ResourcesDescription(typeof(Resources), "ForeshoreProfile_Description")]
- public virtual ForeshoreProfile ForeshoreProfile
+ public ForeshoreProfile ForeshoreProfile
{
get
{
@@ -227,7 +225,7 @@
[ResourcesCategory(typeof(RingtoetsCommonFormsResources), "Categories_Schematization")]
[ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), "WorldReferencePoint_DisplayName")]
[ResourcesDescription(typeof(RingtoetsCommonFormsResources), "WorldReferencePoint_ForeshoreProfile_Description")]
- public virtual Point2D WorldReferencePoint
+ public Point2D WorldReferencePoint
{
get
{
@@ -242,7 +240,7 @@
[ResourcesCategory(typeof(RingtoetsCommonFormsResources), "Categories_Schematization")]
[ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), "Orientation_DisplayName")]
[ResourcesDescription(typeof(RingtoetsCommonFormsResources), "Orientation_ForeshoreProfile_Description")]
- public virtual RoundedDouble Orientation
+ public RoundedDouble Orientation
{
get
{
@@ -260,7 +258,7 @@
[ResourcesCategory(typeof(RingtoetsCommonFormsResources), "Categories_Schematization")]
[ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), "BreakWaterProperties_DisplayName")]
[ResourcesDescription(typeof(RingtoetsCommonFormsResources), "BreakWaterProperties_Description")]
- public virtual WaveConditionsInputBreakWaterProperties BreakWater
+ public WaveConditionsInputBreakWaterProperties BreakWater
{
get
{
Index: Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/Ringtoets.Revetment.Forms.csproj
===================================================================
diff -u -rd582180db4f7e3bafb689cb22ead5ef10e8e8235 -r172f313c5afd8dafa9756d9d1600c78ea2e9fcf9
--- Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/Ringtoets.Revetment.Forms.csproj (.../Ringtoets.Revetment.Forms.csproj) (revision d582180db4f7e3bafb689cb22ead5ef10e8e8235)
+++ Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/Ringtoets.Revetment.Forms.csproj (.../Ringtoets.Revetment.Forms.csproj) (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -40,10 +40,10 @@
Properties\GlobalAssembly.cs
-
+
Index: Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/UITypeEditors/WaveConditionsInputContextHydraulicBoundaryLocationEditor.cs
===================================================================
diff -u -rd582180db4f7e3bafb689cb22ead5ef10e8e8235 -r172f313c5afd8dafa9756d9d1600c78ea2e9fcf9
--- Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/UITypeEditors/WaveConditionsInputContextHydraulicBoundaryLocationEditor.cs (.../WaveConditionsInputContextHydraulicBoundaryLocationEditor.cs) (revision d582180db4f7e3bafb689cb22ead5ef10e8e8235)
+++ Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/UITypeEditors/WaveConditionsInputContextHydraulicBoundaryLocationEditor.cs (.../WaveConditionsInputContextHydraulicBoundaryLocationEditor.cs) (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -34,7 +34,7 @@
/// from a collection.
///
public class WaveConditionsInputContextHydraulicBoundaryLocationEditor :
- SelectionEditor, HydraulicBoundaryLocation>
+ SelectionEditor, HydraulicBoundaryLocation>
{
///
/// Creates a new instance of .
Index: Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/PresentationObjects/WaveConditionsInputContextTest.cs
===================================================================
diff -u -r723cafd68e612c8febe955bfd9c1d1057e7b7341 -r172f313c5afd8dafa9756d9d1600c78ea2e9fcf9
--- Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/PresentationObjects/WaveConditionsInputContextTest.cs (.../WaveConditionsInputContextTest.cs) (revision 723cafd68e612c8febe955bfd9c1d1057e7b7341)
+++ Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/PresentationObjects/WaveConditionsInputContextTest.cs (.../WaveConditionsInputContextTest.cs) (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -20,11 +20,9 @@
// All rights reserved.
using System;
-using Core.Common.Base.Geometry;
+using System.Collections.Generic;
using Core.Common.Controls.PresentationObjects;
using NUnit.Framework;
-using Rhino.Mocks;
-using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.Data.DikeProfiles;
using Ringtoets.HydraRing.Data;
using Ringtoets.Revetment.Data;
@@ -38,95 +36,48 @@
[Test]
public void Constructor_WaveConditionsInputNull_ThrowArgumentNullException()
{
- // Setup
- var mocks = new MockRepository();
- var assessmentSection = mocks.Stub();
- mocks.ReplayAll();
-
// Call
- TestDelegate call = () => new WaveConditionsInputContext(null, new ForeshoreProfile[0], assessmentSection);
+ TestDelegate call = () => new TestWaveConditionsInputContext(null);
// Assert
string paramName = Assert.Throws(call).ParamName;
Assert.AreEqual("wrappedData", paramName);
- mocks.VerifyAll();
}
[Test]
- public void Constructor_ForeshoreProfilesNull_ThrowArgumentNullException()
+ public void Constructor_ExpectedValues()
{
// Setup
- var mocks = new MockRepository();
- var assessmentSection = mocks.Stub();
- mocks.ReplayAll();
-
var input = new WaveConditionsInput(WaveConditionsRevetment.StabilityStone);
// Call
- TestDelegate call = () => new WaveConditionsInputContext(input, null, assessmentSection);
+ var context = new TestWaveConditionsInputContext(input);
// Assert
- string paramName = Assert.Throws(call).ParamName;
- Assert.AreEqual("foreshoreProfiles", paramName);
- mocks.VerifyAll();
+ Assert.IsInstanceOf>(context);
+ Assert.IsInstanceOf(context);
+ Assert.AreSame(input, context.WrappedData);
}
-
- [Test]
- public void Constructor_AssessmentSectionNull_ThrowArgumentNullException()
+
+ private class TestWaveConditionsInputContext : WaveConditionsInputContext
{
- // Setup
- var input = new WaveConditionsInput(WaveConditionsRevetment.StabilityStone);
+ public TestWaveConditionsInputContext(WaveConditionsInput wrappedData) : base(wrappedData) {}
- // Call
- TestDelegate call = () => new WaveConditionsInputContext(input, new ForeshoreProfile[0], null);
-
- // Assert
- string paramName = Assert.Throws(call).ParamName;
- Assert.AreEqual("assessmentSection", paramName);
- }
-
- [Test]
- public void Constructor_ExpectedValues()
- {
- // Setup
- var locations = new[]
+ public override IEnumerable HydraulicBoundaryLocations
{
- new HydraulicBoundaryLocation(0, "A", 0, 0),
- new HydraulicBoundaryLocation(1, "B", 1, 1)
- };
+ get
+ {
+ throw new NotImplementedException();
+ }
+ }
- var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase();
- hydraulicBoundaryDatabase.Locations.AddRange(locations);
-
- var mocks = new MockRepository();
- var assessmentSection = mocks.Stub();
- assessmentSection.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase;
- mocks.ReplayAll();
-
- var input = new WaveConditionsInput(WaveConditionsRevetment.StabilityStone);
-
- var foreshoreProfiles = new[]
+ public override IEnumerable ForeshoreProfiles
{
- new ForeshoreProfile(new Point2D(0, 0),
- new Point2D[0],
- null,
- new ForeshoreProfile.ConstructionProperties()),
- new ForeshoreProfile(new Point2D(1, 1),
- new Point2D[0],
- null,
- new ForeshoreProfile.ConstructionProperties())
- };
-
- // Call
- var context = new WaveConditionsInputContext(input, foreshoreProfiles, assessmentSection);
-
- // Assert
- Assert.IsInstanceOf>(context);
- Assert.IsInstanceOf(context);
- Assert.AreSame(input, context.WrappedData);
- CollectionAssert.AreEqual(foreshoreProfiles, context.ForeshoreProfiles);
- CollectionAssert.AreEqual(locations, context.HydraulicBoundaryLocations);
- mocks.VerifyAll();
+ get
+ {
+ throw new NotImplementedException();
+ }
+ }
}
}
}
\ No newline at end of file
Index: Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/PropertyClasses/WaveConditionsInputContextPropertiesTest.cs
===================================================================
diff -u -rd582180db4f7e3bafb689cb22ead5ef10e8e8235 -r172f313c5afd8dafa9756d9d1600c78ea2e9fcf9
--- Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/PropertyClasses/WaveConditionsInputContextPropertiesTest.cs (.../WaveConditionsInputContextPropertiesTest.cs) (revision d582180db4f7e3bafb689cb22ead5ef10e8e8235)
+++ Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/PropertyClasses/WaveConditionsInputContextPropertiesTest.cs (.../WaveConditionsInputContextPropertiesTest.cs) (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -20,6 +20,7 @@
// All rights reserved.
using System;
+using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using Core.Common.Base;
@@ -30,7 +31,6 @@
using Core.Common.Utils;
using NUnit.Framework;
using Rhino.Mocks;
-using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.Data.DikeProfiles;
using Ringtoets.Common.Data.TestUtil;
using Ringtoets.HydraRing.Data;
@@ -60,14 +60,6 @@
private const int foreshoreGeometryPropertyIndex = 13;
private const int revetmentTypePropertyIndex = 14;
- private MockRepository mockRepository;
-
- [SetUp]
- public void SetUp()
- {
- mockRepository = new MockRepository();
- }
-
[Test]
public void Constructor_ExpectedValues()
{
@@ -76,18 +68,16 @@
// Assert
Assert.IsInstanceOf>(properties);
+ Assert.IsInstanceOf>(properties);
Assert.IsNull(properties.Data);
}
-
+
[Test]
public void Data_SetDefaultInputContextInstance_ReturnCorrectPropertyValues()
{
// Setup
- var assessmentSectionMock = mockRepository.StrictMock();
- mockRepository.ReplayAll();
-
var input = new WaveConditionsInput(WaveConditionsRevetment.StabilityStone);
- var inputContext = new WaveConditionsInputContext(input, new ForeshoreProfile[0], assessmentSectionMock);
+ var inputContext = new TestWaveConditionsInputContext(input, new ForeshoreProfile[0], new HydraulicBoundaryLocation[0]);
// Call
var properties = new WaveConditionsInputContextProperties
@@ -117,34 +107,29 @@
Assert.AreSame(input, properties.BreakWater.Data);
Assert.AreSame(input, properties.ForeshoreGeometry.Data);
Assert.AreEqual(input.RevetmentType, properties.RevetmentType);
-
- mockRepository.VerifyAll();
}
[Test]
public void Data_SetNewInputContextInstanceWithForeshoreProfile_ReturnCorrectPropertyValues()
{
// Setup
- var assessmentSectionMock = mockRepository.StrictMock();
- mockRepository.ReplayAll();
-
var random = new Random(21);
- var assessmentLevel = (RoundedDouble)random.NextDouble();
- var lowerBoundaryRevetment = (RoundedDouble)random.NextDouble();
- var lowerBoundaryWaterLevels = (RoundedDouble)random.NextDouble();
- var upperBoundaryRevetment = lowerBoundaryRevetment + (RoundedDouble)random.NextDouble();
- var upperBoundaryWaterLevels = lowerBoundaryWaterLevels + (RoundedDouble)random.NextDouble();
+ var assessmentLevel = (RoundedDouble) random.NextDouble();
+ var lowerBoundaryRevetment = (RoundedDouble) random.NextDouble();
+ var lowerBoundaryWaterLevels = (RoundedDouble) random.NextDouble();
+ var upperBoundaryRevetment = lowerBoundaryRevetment + (RoundedDouble) random.NextDouble();
+ var upperBoundaryWaterLevels = lowerBoundaryWaterLevels + (RoundedDouble) random.NextDouble();
var stepSize = WaveConditionsInputStepSize.Half;
var worldX = (RoundedDouble) random.NextDouble();
var worldY = (RoundedDouble) random.NextDouble();
var damHeight = (RoundedDouble) random.NextDouble();
- var foreshoreProfileOrientation = (RoundedDouble)random.NextDouble();
+ var foreshoreProfileOrientation = (RoundedDouble) random.NextDouble();
var foreshoreProfile = new ForeshoreProfile(
- new Point2D(worldX, worldY),
- Enumerable.Empty(),
- new BreakWater(BreakWaterType.Dam, damHeight),
+ new Point2D(worldX, worldY),
+ Enumerable.Empty(),
+ new BreakWater(BreakWaterType.Dam, damHeight),
new ForeshoreProfile.ConstructionProperties
{
Name = string.Empty,
@@ -165,10 +150,13 @@
LowerBoundaryWaterLevels = lowerBoundaryWaterLevels,
StepSize = stepSize
};
- var inputContext = new WaveConditionsInputContext(input, new[]
+ var inputContext = new TestWaveConditionsInputContext(input, new[]
{
foreshoreProfile
- }, assessmentSectionMock);
+ }, new[]
+ {
+ hydraulicBoundaryLocation
+ });
// Call
var properties = new WaveConditionsInputContextProperties
@@ -187,26 +175,25 @@
Assert.AreEqual(BreakWaterType.Dam, properties.BreakWater.BreakWaterType);
Assert.AreEqual(damHeight, properties.BreakWater.BreakWaterHeight.Value, properties.BreakWater.BreakWaterHeight.GetAccuracy());
Assert.IsEmpty(properties.ForeshoreGeometry.Coordinates);
- mockRepository.VerifyAll();
}
[Test]
public void SetProperties_IndividualProperties_UpdateDataAndNotifyObservers()
{
// Setup
+ var mockRepository = new MockRepository();
var observerMock = mockRepository.StrictMock();
const int numberProperties = 8;
observerMock.Expect(o => o.UpdateObserver()).Repeat.Times(numberProperties);
- var assessmentSectionMock = mockRepository.StrictMock();
mockRepository.ReplayAll();
-
+
var random = new Random(21);
- var orientation = (RoundedDouble)random.NextDouble();
- var assessmentLevel = (RoundedDouble)random.NextDouble();
- var newLowerBoundaryRevetment = (RoundedDouble)random.NextDouble();
- var newLowerBoundaryWaterLevels = (RoundedDouble)random.NextDouble();
- var newUpperBoundaryRevetment = newLowerBoundaryRevetment + (RoundedDouble)random.NextDouble();
- var newUpperBoundaryWaterLevels = newLowerBoundaryWaterLevels + (RoundedDouble)random.NextDouble();
+ var orientation = (RoundedDouble) random.NextDouble();
+ var assessmentLevel = (RoundedDouble) random.NextDouble();
+ var newLowerBoundaryRevetment = (RoundedDouble) random.NextDouble();
+ var newLowerBoundaryWaterLevels = (RoundedDouble) random.NextDouble();
+ var newUpperBoundaryRevetment = newLowerBoundaryRevetment + (RoundedDouble) random.NextDouble();
+ var newUpperBoundaryWaterLevels = newLowerBoundaryWaterLevels + (RoundedDouble) random.NextDouble();
var newStepSize = WaveConditionsInputStepSize.Half;
var newHydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, "name", 0.0, 1.1)
@@ -216,14 +203,14 @@
var input = new WaveConditionsInput(WaveConditionsRevetment.StabilityStone);
input.Attach(observerMock);
- var inputContext = new WaveConditionsInputContext(input, new ForeshoreProfile[0], assessmentSectionMock);
+ var inputContext = new TestWaveConditionsInputContext(input, new ForeshoreProfile[0], new HydraulicBoundaryLocation[0]);
var newForeshoreProfile = new ForeshoreProfile(
new Point2D(
- (RoundedDouble)random.NextDouble(),
- (RoundedDouble)random.NextDouble()),
+ (RoundedDouble) random.NextDouble(),
+ (RoundedDouble) random.NextDouble()),
Enumerable.Empty(),
- new BreakWater(BreakWaterType.Dam, (RoundedDouble)random.NextDouble()),
+ new BreakWater(BreakWaterType.Dam, (RoundedDouble) random.NextDouble()),
new ForeshoreProfile.ConstructionProperties());
var properties = new WaveConditionsInputContextProperties
@@ -262,27 +249,24 @@
[Test]
public void PropertyAttributes_ReturnExpectedValues(
- [Values(true,false)] bool withForeshoreProfile)
+ [Values(true, false)] bool withForeshoreProfile)
{
// Setup
- var assessmentSectionMock = mockRepository.StrictMock();
- mockRepository.ReplayAll();
-
var input = new WaveConditionsInput(WaveConditionsRevetment.StabilityStone);
var foreshoreProfile = new ForeshoreProfile(
- new Point2D(0,0),
- Enumerable.Empty(),
- null,
+ new Point2D(0, 0),
+ Enumerable.Empty(),
+ null,
new ForeshoreProfile.ConstructionProperties());
-
+
if (withForeshoreProfile)
{
input.ForeshoreProfile = foreshoreProfile;
}
- var inputContext = new WaveConditionsInputContext(input, new[]
+ var inputContext = new TestWaveConditionsInputContext(input, new[]
{
foreshoreProfile
- }, assessmentSectionMock);
+ }, new HydraulicBoundaryLocation[0]);
// Call
var properties = new WaveConditionsInputContextProperties
@@ -409,8 +393,36 @@
Assert.AreEqual(schematizationCategory, revetmentTypeProperty.Category);
Assert.AreEqual("Type bekleding", revetmentTypeProperty.DisplayName);
Assert.AreEqual("Het type van de bekleding waarvoor berekend wordt.", revetmentTypeProperty.Description);
+ }
- mockRepository.VerifyAll();
+ private class TestWaveConditionsInputContext : WaveConditionsInputContext
+ {
+ private readonly IEnumerable foreshoreProfiles;
+ private readonly IEnumerable locations;
+
+ public TestWaveConditionsInputContext(WaveConditionsInput wrappedData,
+ IEnumerable foreshoreProfiles,
+ IEnumerable locations) : base(wrappedData)
+ {
+ this.foreshoreProfiles = foreshoreProfiles;
+ this.locations = locations;
+ }
+
+ public override IEnumerable HydraulicBoundaryLocations
+ {
+ get
+ {
+ return locations;
+ }
+ }
+
+ public override IEnumerable ForeshoreProfiles
+ {
+ get
+ {
+ return foreshoreProfiles;
+ }
+ }
}
}
}
\ No newline at end of file
Index: Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/UITypeEditors/WaveConditionsInputContextForeshoreProfileEditorTest.cs
===================================================================
diff -u -rd582180db4f7e3bafb689cb22ead5ef10e8e8235 -r172f313c5afd8dafa9756d9d1600c78ea2e9fcf9
--- Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/UITypeEditors/WaveConditionsInputContextForeshoreProfileEditorTest.cs (.../WaveConditionsInputContextForeshoreProfileEditorTest.cs) (revision d582180db4f7e3bafb689cb22ead5ef10e8e8235)
+++ Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/UITypeEditors/WaveConditionsInputContextForeshoreProfileEditorTest.cs (.../WaveConditionsInputContextForeshoreProfileEditorTest.cs) (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -20,6 +20,7 @@
// All rights reserved.
using System;
+using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Forms.Design;
using Core.Common.Base.Geometry;
@@ -28,6 +29,7 @@
using Rhino.Mocks;
using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.Data.DikeProfiles;
+using Ringtoets.HydraRing.Data;
using Ringtoets.Revetment.Data;
using Ringtoets.Revetment.Forms.PresentationObjects;
using Ringtoets.Revetment.Forms.PropertyClasses;
@@ -58,10 +60,8 @@
var grassCoverErosionInwardsInput = new WaveConditionsInput(WaveConditionsRevetment.StabilityStone);
- var assessmentSectionMock = mockRepository.StrictMock();
- var inputContext = new WaveConditionsInputContext(grassCoverErosionInwardsInput,
- foreshoreProfiles,
- assessmentSectionMock);
+ var inputContext = new TestWaveConditionsInputContext(grassCoverErosionInwardsInput,
+ foreshoreProfiles);
var properties = new WaveConditionsInputContextProperties
{
@@ -102,9 +102,11 @@
};
var assessmentSectionMock = mockRepository.StrictMock();
- var inputContext = new WaveConditionsInputContext(waveConditionsInput,
- new[] { foreshoreProfile },
- assessmentSectionMock);
+ var inputContext = new TestWaveConditionsInputContext(waveConditionsInput,
+ new[]
+ {
+ foreshoreProfile
+ });
var properties = new WaveConditionsInputContextProperties
{
@@ -132,5 +134,32 @@
mockRepository.VerifyAll();
}
+
+ private class TestWaveConditionsInputContext : WaveConditionsInputContext
+ {
+ private readonly IEnumerable foreshoreProfiles;
+
+ public TestWaveConditionsInputContext(WaveConditionsInput wrappedData,
+ IEnumerable foreshoreProfiles) : base(wrappedData)
+ {
+ this.foreshoreProfiles = foreshoreProfiles;
+ }
+
+ public override IEnumerable HydraulicBoundaryLocations
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ public override IEnumerable ForeshoreProfiles
+ {
+ get
+ {
+ return foreshoreProfiles;
+ }
+ }
+ }
}
}
\ No newline at end of file
Index: Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/UITypeEditors/WaveConditionsInputContextHydraulicBoundaryLocationEditorTest.cs
===================================================================
diff -u -rd582180db4f7e3bafb689cb22ead5ef10e8e8235 -r172f313c5afd8dafa9756d9d1600c78ea2e9fcf9
--- Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/UITypeEditors/WaveConditionsInputContextHydraulicBoundaryLocationEditorTest.cs (.../WaveConditionsInputContextHydraulicBoundaryLocationEditorTest.cs) (revision d582180db4f7e3bafb689cb22ead5ef10e8e8235)
+++ Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/UITypeEditors/WaveConditionsInputContextHydraulicBoundaryLocationEditorTest.cs (.../WaveConditionsInputContextHydraulicBoundaryLocationEditorTest.cs) (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -20,12 +20,12 @@
// All rights reserved.
using System;
+using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Forms.Design;
using Core.Common.Gui.PropertyBag;
using NUnit.Framework;
using Rhino.Mocks;
-using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.Data.DikeProfiles;
using Ringtoets.HydraRing.Data;
using Ringtoets.Revetment.Data;
@@ -50,18 +50,13 @@
public void EditValue_NoCurrentItemInAvailableItems_ReturnsOriginalValue()
{
// Setup
- var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase();
- hydraulicBoundaryDatabase.Locations.Add(new TestHydraulicBoundaryLocation());
-
var grassCoverErosionInwardsInput = new WaveConditionsInput(WaveConditionsRevetment.Grass);
- var assessmentSectionMock = mockRepository.StrictMock();
- assessmentSectionMock.Expect(asm => asm.HydraulicBoundaryDatabase)
- .Return(hydraulicBoundaryDatabase)
- .Repeat.AtLeastOnce();
- var inputContext = new WaveConditionsInputContext(grassCoverErosionInwardsInput,
- new ForeshoreProfile[0],
- assessmentSectionMock);
+ var inputContext = new TestWaveConditionsInputContext(grassCoverErosionInwardsInput,
+ new[]
+ {
+ new TestHydraulicBoundaryLocation()
+ });
var properties = new WaveConditionsInputContextProperties
{
@@ -93,22 +88,18 @@
public void EditValue_WithCurrentItemInAvailableItems_ReturnsCurrentItem()
{
// Setup
- var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase();
var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation();
- hydraulicBoundaryDatabase.Locations.Add(hydraulicBoundaryLocation);
var waveConditionsInput = new WaveConditionsInput(WaveConditionsRevetment.Grass)
{
HydraulicBoundaryLocation = hydraulicBoundaryLocation
};
- var assessmentSectionMock = mockRepository.StrictMock();
- assessmentSectionMock.Expect(asm => asm.HydraulicBoundaryDatabase)
- .Return(hydraulicBoundaryDatabase)
- .Repeat.AtLeastOnce();
- var inputContext = new WaveConditionsInputContext(waveConditionsInput,
- new ForeshoreProfile[0],
- assessmentSectionMock);
+ var inputContext = new TestWaveConditionsInputContext(waveConditionsInput,
+ new[]
+ {
+ hydraulicBoundaryLocation
+ });
var properties = new WaveConditionsInputContextProperties
{
@@ -141,5 +132,31 @@
{
public TestHydraulicBoundaryLocation() : base(0, string.Empty, 0, 0) {}
}
+
+ private class TestWaveConditionsInputContext : WaveConditionsInputContext
+ {
+ private readonly IEnumerable locations;
+
+ public TestWaveConditionsInputContext(WaveConditionsInput wrappedData, IEnumerable locations) : base(wrappedData)
+ {
+ this.locations = locations;
+ }
+
+ public override IEnumerable HydraulicBoundaryLocations
+ {
+ get
+ {
+ return locations;
+ }
+ }
+
+ public override IEnumerable ForeshoreProfiles
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ }
+ }
}
}
\ No newline at end of file
Index: Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Forms/PresentationObjects/StabilityStoneCoverWaveConditionsInputContext.cs
===================================================================
diff -u
--- Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Forms/PresentationObjects/StabilityStoneCoverWaveConditionsInputContext.cs (revision 0)
+++ Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Forms/PresentationObjects/StabilityStoneCoverWaveConditionsInputContext.cs (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -0,0 +1,83 @@
+// 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 Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.DikeProfiles;
+using Ringtoets.HydraRing.Data;
+using Ringtoets.Revetment.Data;
+using Ringtoets.Revetment.Forms.PresentationObjects;
+using Ringtoets.StabilityStoneCover.Data;
+
+namespace Ringtoets.StabilityStoneCover.Forms.PresentationObjects
+{
+ ///
+ /// Presentation object for for the .
+ ///
+ public class StabilityStoneCoverWaveConditionsInputContext : WaveConditionsInputContext
+ {
+ private readonly IEnumerable foreshoreProfiles;
+ private readonly IAssessmentSection assessmentSection;
+
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The wrapped .>
+ /// The foreshore profiles of the .
+ /// The assessment section which the context belongs to.
+ /// Thrown when any parameter is null .
+ public StabilityStoneCoverWaveConditionsInputContext(WaveConditionsInput wrappedData,
+ IEnumerable foreshoreProfiles,
+ IAssessmentSection assessmentSection) : base(wrappedData)
+ {
+ if (foreshoreProfiles == null)
+ {
+ throw new ArgumentNullException("foreshoreProfiles");
+ }
+ if (assessmentSection == null)
+ {
+ throw new ArgumentNullException("assessmentSection");
+ }
+ this.foreshoreProfiles = foreshoreProfiles;
+ this.assessmentSection = assessmentSection;
+ }
+
+ public override IEnumerable HydraulicBoundaryLocations
+ {
+ get
+ {
+ return assessmentSection.HydraulicBoundaryDatabase != null
+ ? assessmentSection.HydraulicBoundaryDatabase.Locations
+ : Enumerable.Empty();
+ }
+ }
+
+ public override IEnumerable ForeshoreProfiles
+ {
+ get
+ {
+ return foreshoreProfiles;
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Forms/PropertyClasses/StabilityStoneCoverWaveConditionsInputContextProperties.cs
===================================================================
diff -u
--- Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Forms/PropertyClasses/StabilityStoneCoverWaveConditionsInputContextProperties.cs (revision 0)
+++ Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Forms/PropertyClasses/StabilityStoneCoverWaveConditionsInputContextProperties.cs (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -0,0 +1,42 @@
+// 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 Ringtoets.Revetment.Data;
+using Ringtoets.Revetment.Forms.PropertyClasses;
+using Ringtoets.StabilityStoneCover.Forms.PresentationObjects;
+
+namespace Ringtoets.StabilityStoneCover.Forms.PropertyClasses
+{
+ ///
+ /// Property control the .
+ ///
+ public class StabilityStoneCoverWaveConditionsInputContextProperties
+ : WaveConditionsInputContextProperties
+ {
+ public override WaveConditionsRevetment RevetmentType
+ {
+ get
+ {
+ return WaveConditionsRevetment.StabilityStone;
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Forms/Ringtoets.StabilityStoneCover.Forms.csproj
===================================================================
diff -u -r6da94dc5f56cf8edbf991440dd97f5b28856e658 -r172f313c5afd8dafa9756d9d1600c78ea2e9fcf9
--- Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Forms/Ringtoets.StabilityStoneCover.Forms.csproj (.../Ringtoets.StabilityStoneCover.Forms.csproj) (revision 6da94dc5f56cf8edbf991440dd97f5b28856e658)
+++ Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Forms/Ringtoets.StabilityStoneCover.Forms.csproj (.../Ringtoets.StabilityStoneCover.Forms.csproj) (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -46,13 +46,15 @@
+
True
True
Resources.resx
+
Index: Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Plugin/StabilityStoneCoverPlugin.cs
===================================================================
diff -u -r6da94dc5f56cf8edbf991440dd97f5b28856e658 -r172f313c5afd8dafa9756d9d1600c78ea2e9fcf9
--- Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Plugin/StabilityStoneCoverPlugin.cs (.../StabilityStoneCoverPlugin.cs) (revision 6da94dc5f56cf8edbf991440dd97f5b28856e658)
+++ Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Plugin/StabilityStoneCoverPlugin.cs (.../StabilityStoneCoverPlugin.cs) (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -67,6 +67,7 @@
GetObjectPropertiesData = context => context.WrappedData
};
yield return new PropertyInfo();
+ yield return new PropertyInfo();
}
public override IEnumerable GetViewInfos()
@@ -128,6 +129,15 @@
.AddOpenItem()
.Build()
};
+
+ yield return new TreeNodeInfo
+ {
+ Text = context => RingtoetsCommonFormsResources.Calculation_Input,
+ Image = context => RingtoetsCommonFormsResources.GenericInputOutputIcon,
+ ContextMenuStrip = (nodeData, parentData, treeViewControl) => Gui.Get(nodeData, treeViewControl)
+ .AddPropertiesItem()
+ .Build()
+ };
}
public override IEnumerable GetExportInfos()
@@ -464,9 +474,9 @@
var childNodes = new List
{
new CommentContext(context.WrappedData),
- new WaveConditionsInputContext(context.WrappedData.InputParameters,
- context.FailureMechanism.ForeshoreProfiles,
- context.AssessmentSection)
+ new StabilityStoneCoverWaveConditionsInputContext(context.WrappedData.InputParameters,
+ context.FailureMechanism.ForeshoreProfiles,
+ context.AssessmentSection)
};
if (context.WrappedData.HasOutput)
Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/PresentationObjects/StabilityStoneCoverWaveConditionsInputContextTest.cs
===================================================================
diff -u
--- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/PresentationObjects/StabilityStoneCoverWaveConditionsInputContextTest.cs (revision 0)
+++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/PresentationObjects/StabilityStoneCoverWaveConditionsInputContextTest.cs (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -0,0 +1,165 @@
+// 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.Geometry;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.DikeProfiles;
+using Ringtoets.HydraRing.Data;
+using Ringtoets.Revetment.Data;
+using Ringtoets.Revetment.Forms.PresentationObjects;
+using Ringtoets.StabilityStoneCover.Data;
+using Ringtoets.StabilityStoneCover.Forms.PresentationObjects;
+
+namespace Ringtoets.StabilityStoneCover.Forms.Test.PresentationObjects
+{
+ [TestFixture]
+ public class StabilityStoneCoverWaveConditionsInputContextTest
+ {
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Setup
+ var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, string.Empty, 0, 0);
+ var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase()
+ {
+ Locations =
+ {
+ hydraulicBoundaryLocation
+ }
+ };
+
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ assessmentSection.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase;
+ mocks.ReplayAll();
+
+ var foreshoreProfile = new ForeshoreProfile(new Point2D(0, 0), Enumerable.Empty(),
+ null, new ForeshoreProfile.ConstructionProperties());
+
+ var failureMechanism = new StabilityStoneCoverFailureMechanism
+ {
+ ForeshoreProfiles =
+ {
+ foreshoreProfile
+ }
+ };
+
+ var input = new WaveConditionsInput(WaveConditionsRevetment.StabilityStone);
+
+ // Call
+ var context = new StabilityStoneCoverWaveConditionsInputContext(input,
+ failureMechanism.ForeshoreProfiles,
+ assessmentSection);
+
+ // Assert
+ Assert.IsInstanceOf(context);
+ Assert.AreEqual(input, context.WrappedData);
+ CollectionAssert.AreEqual(failureMechanism.ForeshoreProfiles, context.ForeshoreProfiles);
+ CollectionAssert.AreEqual(hydraulicBoundaryDatabase.Locations, context.HydraulicBoundaryLocations);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Constructor_InputNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new StabilityStoneCoverFailureMechanism();
+
+ // Call
+ TestDelegate test = () => new StabilityStoneCoverWaveConditionsInputContext(null,
+ failureMechanism.ForeshoreProfiles,
+ assessmentSection);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("wrappedData", exception.ParamName);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Constructor_ForeshoreProfilesNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var input = new WaveConditionsInput(WaveConditionsRevetment.StabilityStone);
+
+ // Call
+ TestDelegate test = () => new StabilityStoneCoverWaveConditionsInputContext(input,
+ null,
+ assessmentSection);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("foreshoreProfiles", exception.ParamName);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Constructor_AssessmentSectionNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var input = new WaveConditionsInput(WaveConditionsRevetment.StabilityStone);
+ var failureMechanism = new StabilityStoneCoverFailureMechanism();
+
+ // Call
+ TestDelegate test = () => new StabilityStoneCoverWaveConditionsInputContext(input,
+ failureMechanism.ForeshoreProfiles,
+ null);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("assessmentSection", exception.ParamName);
+ }
+
+ [Test]
+ public void HydraulicBoundaryLocations_HydraulicBoundaryDatabaseNull_ReturnEmptyCollection()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var input = new WaveConditionsInput(WaveConditionsRevetment.StabilityStone);
+ var failureMechanism = new StabilityStoneCoverFailureMechanism();
+
+ var context = new StabilityStoneCoverWaveConditionsInputContext(input, failureMechanism.ForeshoreProfiles, assessmentSection);
+
+ // Call
+ IEnumerable locations = context.HydraulicBoundaryLocations;
+
+ // Assert
+ CollectionAssert.IsEmpty(locations);
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/PropertyClasses/StabilityStoneCoverWaveConditionsInputContextPropertiesTest.cs
===================================================================
diff -u
--- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/PropertyClasses/StabilityStoneCoverWaveConditionsInputContextPropertiesTest.cs (revision 0)
+++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/PropertyClasses/StabilityStoneCoverWaveConditionsInputContextPropertiesTest.cs (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -0,0 +1,440 @@
+// 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.ComponentModel;
+using System.Linq;
+using Core.Common.Base;
+using Core.Common.Base.Data;
+using Core.Common.Base.Geometry;
+using Core.Common.Gui.Converters;
+using Core.Common.Gui.PropertyBag;
+using Core.Common.Utils;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.DikeProfiles;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.HydraRing.Data;
+using Ringtoets.Revetment.Data;
+using Ringtoets.Revetment.Forms.PropertyClasses;
+using Ringtoets.StabilityStoneCover.Data;
+using Ringtoets.StabilityStoneCover.Forms.PresentationObjects;
+using Ringtoets.StabilityStoneCover.Forms.PropertyClasses;
+
+namespace Ringtoets.StabilityStoneCover.Forms.Test.PropertyClasses
+{
+ [TestFixture]
+ public class StabilityStoneCoverWaveConditionsInputContextPropertiesTest
+ {
+ private const int hydraulicBoundaryLocationPropertyIndex = 0;
+ private const int assessmentLevelPropertyIndex = 1;
+ private const int upperBoundaryDesignWaterLevelPropertyIndex = 2;
+ private const int upperBoundaryRevetmentPropertyIndex = 3;
+ private const int lowerBoundaryRevetmentPropertyIndex = 4;
+ private const int upperBoundaryWaterLevelsPropertyIndex = 5;
+ private const int lowerBoundaryWaterLevelsPropertyIndex = 6;
+ private const int stepSizePropertyIndex = 7;
+ private const int waterLevelsPropertyIndex = 8;
+
+ private const int foreshoreProfilePropertyIndex = 9;
+ private const int worldReferencePointPropertyIndex = 10;
+ private const int orientationPropertyIndex = 11;
+ private const int breakWaterPropertyIndex = 12;
+ private const int foreshoreGeometryPropertyIndex = 13;
+ private const int revetmentTypePropertyIndex = 14;
+
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Call
+ var properties = new StabilityStoneCoverWaveConditionsInputContextProperties();
+
+ // Assert
+ Assert.IsInstanceOf>(properties);
+ Assert.IsNull(properties.Data);
+ }
+
+ [Test]
+ public void Data_SetDefaultInputContextInstance_ReturnCorrectPropertyValues()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var input = new WaveConditionsInput(WaveConditionsRevetment.StabilityStone);
+ var failureMechanism = new StabilityStoneCoverFailureMechanism();
+ var inputContext = new StabilityStoneCoverWaveConditionsInputContext(input,
+ failureMechanism.ForeshoreProfiles,
+ assessmentSection);
+
+ // Call
+ var properties = new StabilityStoneCoverWaveConditionsInputContextProperties
+ {
+ Data = inputContext
+ };
+
+ // Assert
+ Assert.IsNaN(properties.AssessmentLevel.Value);
+ Assert.IsNaN(properties.UpperBoundaryDesignWaterLevel.Value);
+ Assert.AreEqual(2, properties.UpperBoundaryDesignWaterLevel.NumberOfDecimalPlaces);
+ Assert.IsNaN(properties.UpperBoundaryRevetment.Value);
+ Assert.AreEqual(2, properties.UpperBoundaryRevetment.NumberOfDecimalPlaces);
+ Assert.IsNaN(properties.LowerBoundaryRevetment.Value);
+ Assert.AreEqual(2, properties.LowerBoundaryRevetment.NumberOfDecimalPlaces);
+ Assert.IsNaN(properties.UpperBoundaryWaterLevels.Value);
+ Assert.AreEqual(2, properties.UpperBoundaryWaterLevels.NumberOfDecimalPlaces);
+ Assert.IsNaN(properties.LowerBoundaryWaterLevels.Value);
+ Assert.AreEqual(2, properties.LowerBoundaryWaterLevels.NumberOfDecimalPlaces);
+ Assert.AreEqual(0.5, properties.StepSize.AsValue());
+ CollectionAssert.AreEqual(input.WaterLevels, properties.WaterLevels);
+
+ Assert.IsNull(properties.ForeshoreProfile);
+ Assert.IsNull(properties.WorldReferencePoint);
+ Assert.AreEqual(2, properties.Orientation.NumberOfDecimalPlaces);
+ Assert.AreEqual(0, properties.Orientation.Value);
+ Assert.AreSame(input, properties.BreakWater.Data);
+ Assert.AreSame(input, properties.ForeshoreGeometry.Data);
+ Assert.AreEqual(input.RevetmentType, properties.RevetmentType);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Data_SetNewInputContextInstanceWithForeshoreProfile_ReturnCorrectPropertyValues()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var random = new Random(21);
+ var assessmentLevel = (RoundedDouble)random.NextDouble();
+ var lowerBoundaryRevetment = (RoundedDouble)random.NextDouble();
+ var lowerBoundaryWaterLevels = (RoundedDouble)random.NextDouble();
+ var upperBoundaryRevetment = lowerBoundaryRevetment + (RoundedDouble)random.NextDouble();
+ var upperBoundaryWaterLevels = lowerBoundaryWaterLevels + (RoundedDouble)random.NextDouble();
+ var stepSize = WaveConditionsInputStepSize.Half;
+
+ var worldX = (RoundedDouble)random.NextDouble();
+ var worldY = (RoundedDouble)random.NextDouble();
+ var damHeight = (RoundedDouble)random.NextDouble();
+ var foreshoreProfileOrientation = (RoundedDouble)random.NextDouble();
+
+ var foreshoreProfile = new ForeshoreProfile(
+ new Point2D(worldX, worldY),
+ Enumerable.Empty(),
+ new BreakWater(BreakWaterType.Dam, damHeight),
+ new ForeshoreProfile.ConstructionProperties
+ {
+ Name = string.Empty,
+ Orientation = foreshoreProfileOrientation,
+ X0 = -3
+ });
+ var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, string.Empty, 0, 0)
+ {
+ DesignWaterLevel = assessmentLevel
+ };
+ assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase
+ {
+ Locations =
+ {
+ hydraulicBoundaryLocation
+ }
+ };
+
+ var input = new WaveConditionsInput(WaveConditionsRevetment.StabilityStone)
+ {
+ ForeshoreProfile = foreshoreProfile,
+ HydraulicBoundaryLocation = hydraulicBoundaryLocation,
+ UpperBoundaryRevetment = upperBoundaryRevetment,
+ LowerBoundaryRevetment = lowerBoundaryRevetment,
+ UpperBoundaryWaterLevels = upperBoundaryWaterLevels,
+ LowerBoundaryWaterLevels = lowerBoundaryWaterLevels,
+ StepSize = stepSize
+ };
+
+ var failureMechanism = new StabilityStoneCoverFailureMechanism();
+ failureMechanism.ForeshoreProfiles.Add(foreshoreProfile);
+
+ var inputContext = new StabilityStoneCoverWaveConditionsInputContext(input,
+ failureMechanism.ForeshoreProfiles,
+ assessmentSection);
+
+ // Call
+ var properties = new StabilityStoneCoverWaveConditionsInputContextProperties
+ {
+ Data = inputContext
+ };
+
+ // Assert
+ Assert.AreSame(hydraulicBoundaryLocation, properties.HydraulicBoundaryLocation);
+ Assert.AreEqual(assessmentLevel.Value, properties.AssessmentLevel.Value, properties.AssessmentLevel.GetAccuracy());
+ Assert.AreSame(foreshoreProfile, properties.ForeshoreProfile);
+ Assert.AreEqual(worldX, properties.WorldReferencePoint.X, 0.5);
+ Assert.AreEqual(worldY, properties.WorldReferencePoint.Y, 0.5);
+ Assert.AreEqual(2, properties.Orientation.NumberOfDecimalPlaces);
+ Assert.AreEqual(foreshoreProfileOrientation, properties.Orientation.Value, properties.Orientation.GetAccuracy());
+ Assert.AreEqual(BreakWaterType.Dam, properties.BreakWater.BreakWaterType);
+ Assert.AreEqual(damHeight, properties.BreakWater.BreakWaterHeight.Value, properties.BreakWater.BreakWaterHeight.GetAccuracy());
+ Assert.IsEmpty(properties.ForeshoreGeometry.Coordinates);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void SetProperties_IndividualProperties_UpdateDataAndNotifyObservers()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var observerMock = mocks.StrictMock();
+ const int numberProperties = 8;
+ observerMock.Expect(o => o.UpdateObserver()).Repeat.Times(numberProperties);
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var random = new Random(21);
+ var orientation = (RoundedDouble)random.NextDouble();
+ var assessmentLevel = (RoundedDouble)random.NextDouble();
+ var newLowerBoundaryRevetment = (RoundedDouble)random.NextDouble();
+ var newLowerBoundaryWaterLevels = (RoundedDouble)random.NextDouble();
+ var newUpperBoundaryRevetment = newLowerBoundaryRevetment + (RoundedDouble)random.NextDouble();
+ var newUpperBoundaryWaterLevels = newLowerBoundaryWaterLevels + (RoundedDouble)random.NextDouble();
+ var newStepSize = WaveConditionsInputStepSize.Half;
+
+ var newHydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, "name", 0.0, 1.1)
+ {
+ DesignWaterLevel = assessmentLevel
+ };
+
+ assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase
+ {
+ Locations =
+ {
+ newHydraulicBoundaryLocation
+ }
+ };
+
+ var input = new WaveConditionsInput(WaveConditionsRevetment.StabilityStone);
+ input.Attach(observerMock);
+
+ var failureMechanism = new StabilityStoneCoverFailureMechanism();
+
+ var inputContext = new StabilityStoneCoverWaveConditionsInputContext(input,
+ failureMechanism.ForeshoreProfiles,
+ assessmentSection);
+
+ var newForeshoreProfile = new ForeshoreProfile(
+ new Point2D(
+ (RoundedDouble)random.NextDouble(),
+ (RoundedDouble)random.NextDouble()),
+ Enumerable.Empty(),
+ new BreakWater(BreakWaterType.Dam, (RoundedDouble)random.NextDouble()),
+ new ForeshoreProfile.ConstructionProperties());
+
+ var properties = new StabilityStoneCoverWaveConditionsInputContextProperties
+ {
+ Data = inputContext
+ };
+
+ // Call
+ properties.ForeshoreProfile = newForeshoreProfile;
+ properties.UpperBoundaryRevetment = newUpperBoundaryRevetment;
+ properties.LowerBoundaryRevetment = newLowerBoundaryRevetment;
+ properties.UpperBoundaryWaterLevels = newUpperBoundaryWaterLevels;
+ properties.LowerBoundaryWaterLevels = newLowerBoundaryWaterLevels;
+ properties.StepSize = newStepSize;
+ properties.HydraulicBoundaryLocation = newHydraulicBoundaryLocation;
+ properties.Orientation = orientation;
+
+ // Assert
+ Assert.AreSame(input.HydraulicBoundaryLocation, properties.HydraulicBoundaryLocation);
+ Assert.AreEqual(input.HydraulicBoundaryLocation.DesignWaterLevel.Value, properties.AssessmentLevel.Value);
+ Assert.AreEqual(assessmentLevel - 0.01, properties.UpperBoundaryDesignWaterLevel.Value, properties.UpperBoundaryDesignWaterLevel.GetAccuracy());
+ Assert.AreEqual(2, properties.UpperBoundaryDesignWaterLevel.NumberOfDecimalPlaces);
+ Assert.AreEqual(newUpperBoundaryRevetment.Value, properties.UpperBoundaryRevetment.Value, properties.UpperBoundaryRevetment.GetAccuracy());
+ Assert.AreEqual(2, properties.UpperBoundaryRevetment.NumberOfDecimalPlaces);
+ Assert.AreEqual(newLowerBoundaryRevetment.Value, properties.LowerBoundaryRevetment.Value, properties.LowerBoundaryRevetment.GetAccuracy());
+ Assert.AreEqual(2, properties.LowerBoundaryRevetment.NumberOfDecimalPlaces);
+ Assert.AreEqual(newUpperBoundaryWaterLevels.Value, properties.UpperBoundaryWaterLevels.Value, properties.UpperBoundaryWaterLevels.GetAccuracy());
+ Assert.AreEqual(2, properties.UpperBoundaryWaterLevels.NumberOfDecimalPlaces);
+ Assert.AreEqual(newLowerBoundaryWaterLevels.Value, properties.LowerBoundaryWaterLevels.Value, properties.LowerBoundaryWaterLevels.GetAccuracy());
+ Assert.AreEqual(2, properties.LowerBoundaryWaterLevels.NumberOfDecimalPlaces);
+ Assert.AreEqual(orientation, properties.Orientation.Value, properties.Orientation.GetAccuracy());
+ Assert.AreEqual(2, properties.Orientation.NumberOfDecimalPlaces);
+ Assert.AreEqual(newStepSize, properties.StepSize);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void PropertyAttributes_ReturnExpectedValues(
+ [Values(true, false)] bool withForeshoreProfile)
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var input = new WaveConditionsInput(WaveConditionsRevetment.StabilityStone);
+ var foreshoreProfile = new ForeshoreProfile(
+ new Point2D(0, 0),
+ Enumerable.Empty(),
+ null,
+ new ForeshoreProfile.ConstructionProperties());
+
+ if (withForeshoreProfile)
+ {
+ input.ForeshoreProfile = foreshoreProfile;
+ }
+
+
+ var failureMechanism = new StabilityStoneCoverFailureMechanism();
+
+ var inputContext = new StabilityStoneCoverWaveConditionsInputContext(input, failureMechanism.ForeshoreProfiles, assessmentSection);
+
+ // Call
+ var properties = new StabilityStoneCoverWaveConditionsInputContextProperties
+ {
+ Data = inputContext
+ };
+
+ // Assert
+ var dynamicPropertyBag = new DynamicPropertyBag(properties);
+ PropertyDescriptorCollection dynamicProperties = dynamicPropertyBag.GetProperties(new Attribute[]
+ {
+ BrowsableAttribute.Yes
+ });
+ Assert.AreEqual(15, dynamicProperties.Count);
+
+ var hydraulicParametersCategory = "Hydraulische gegevens";
+ var schematizationCategory = "Schematisatie";
+
+ PropertyDescriptor hydraulicBoundaryLocationProperty = dynamicProperties[hydraulicBoundaryLocationPropertyIndex];
+ Assert.IsNotNull(hydraulicBoundaryLocationProperty);
+ Assert.IsFalse(hydraulicBoundaryLocationProperty.IsReadOnly);
+ Assert.AreEqual(hydraulicParametersCategory, hydraulicBoundaryLocationProperty.Category);
+ Assert.AreEqual("Locatie met hydraulische randvoorwaarden", hydraulicBoundaryLocationProperty.DisplayName);
+ Assert.AreEqual("De locatie met hydraulische randvoorwaarden.", hydraulicBoundaryLocationProperty.Description);
+
+ PropertyDescriptor assessmentLevelProperty = dynamicProperties[assessmentLevelPropertyIndex];
+ Assert.IsNotNull(assessmentLevelProperty);
+ Assert.IsTrue(assessmentLevelProperty.IsReadOnly);
+ Assert.AreEqual(hydraulicParametersCategory, assessmentLevelProperty.Category);
+ Assert.AreEqual("Toetspeil [m+NAP]", assessmentLevelProperty.DisplayName);
+ Assert.AreEqual("Waterstand met een overschrijdingsfrequentie gelijk aan de trajectnorm.", assessmentLevelProperty.Description);
+
+ PropertyDescriptor upperBoundaryDesignWaterLevelProperty = dynamicProperties[upperBoundaryDesignWaterLevelPropertyIndex];
+ Assert.IsNotNull(upperBoundaryDesignWaterLevelProperty);
+ Assert.IsTrue(upperBoundaryDesignWaterLevelProperty.IsReadOnly);
+ Assert.AreEqual(hydraulicParametersCategory, upperBoundaryDesignWaterLevelProperty.Category);
+ Assert.AreEqual("Bovengrens op basis van toetspeil [m+NAP]", upperBoundaryDesignWaterLevelProperty.DisplayName);
+ Assert.AreEqual("Bovengrens bepaald aan de hand van de waarde van het toetspeil op de geselecteerde hydraulische locatie.", upperBoundaryDesignWaterLevelProperty.Description);
+
+ PropertyDescriptor upperBoundaryRevetmentProperty = dynamicProperties[upperBoundaryRevetmentPropertyIndex];
+ Assert.IsNotNull(upperBoundaryRevetmentProperty);
+ Assert.IsTrue(upperBoundaryDesignWaterLevelProperty.IsReadOnly);
+ Assert.AreEqual(hydraulicParametersCategory, upperBoundaryRevetmentProperty.Category);
+ Assert.AreEqual("Bovengrens bekleding [m+NAP]", upperBoundaryRevetmentProperty.DisplayName);
+ Assert.AreEqual("Bovengrens van de bekleding.", upperBoundaryRevetmentProperty.Description);
+
+ PropertyDescriptor lowerBoundaryRevetmentProperty = dynamicProperties[lowerBoundaryRevetmentPropertyIndex];
+ Assert.IsNotNull(lowerBoundaryRevetmentProperty);
+ Assert.IsFalse(lowerBoundaryRevetmentProperty.IsReadOnly);
+ Assert.AreEqual(hydraulicParametersCategory, lowerBoundaryRevetmentProperty.Category);
+ Assert.AreEqual("Ondergrens bekleding [m+NAP]", lowerBoundaryRevetmentProperty.DisplayName);
+ Assert.AreEqual("Ondergrens van de bekleding.", lowerBoundaryRevetmentProperty.Description);
+
+ PropertyDescriptor upperBoundaryWaterLevelsProperty = dynamicProperties[upperBoundaryWaterLevelsPropertyIndex];
+ Assert.IsNotNull(upperBoundaryWaterLevelsProperty);
+ Assert.IsFalse(upperBoundaryWaterLevelsProperty.IsReadOnly);
+ Assert.AreEqual(hydraulicParametersCategory, upperBoundaryWaterLevelsProperty.Category);
+ Assert.AreEqual("Bovengrens waterstanden [m+NAP]", upperBoundaryWaterLevelsProperty.DisplayName);
+ Assert.AreEqual("Een aangepaste bovengrens voor de waterstanden.", upperBoundaryWaterLevelsProperty.Description);
+
+ PropertyDescriptor lowerBoundaryWaterLevelsProperty = dynamicProperties[lowerBoundaryWaterLevelsPropertyIndex];
+ Assert.IsNotNull(lowerBoundaryWaterLevelsProperty);
+ Assert.IsFalse(lowerBoundaryWaterLevelsProperty.IsReadOnly);
+ Assert.AreEqual(hydraulicParametersCategory, lowerBoundaryWaterLevelsProperty.Category);
+ Assert.AreEqual("Ondergrens waterstanden [m+NAP]", lowerBoundaryWaterLevelsProperty.DisplayName);
+ Assert.AreEqual("Een aangepaste ondergrens voor de waterstanden.", lowerBoundaryWaterLevelsProperty.Description);
+
+ PropertyDescriptor stepSizeProperty = dynamicProperties[stepSizePropertyIndex];
+ Assert.IsNotNull(stepSizeProperty);
+ Assert.IsInstanceOf(stepSizeProperty.Converter);
+ Assert.IsFalse(stepSizeProperty.IsReadOnly);
+ Assert.AreEqual(hydraulicParametersCategory, stepSizeProperty.Category);
+ Assert.AreEqual("Stapgrootte [m]", stepSizeProperty.DisplayName);
+ Assert.AreEqual("Grootte van de stappen waarmee de waterstanden in de berekening worden bepaald.", stepSizeProperty.Description);
+
+ PropertyDescriptor waterLevelsProperty = dynamicProperties[waterLevelsPropertyIndex];
+ Assert.IsNotNull(waterLevelsProperty);
+ Assert.IsInstanceOf(waterLevelsProperty.Converter);
+ Assert.IsTrue(waterLevelsProperty.IsReadOnly);
+ Assert.AreEqual(hydraulicParametersCategory, waterLevelsProperty.Category);
+ Assert.AreEqual("Waterstanden in berekening [m+NAP]", waterLevelsProperty.DisplayName);
+ Assert.AreEqual("De waterstanden waarvoor gerekend moet worden. Deze zijn afgeleid van de opgegeven boven- en ondergrenzen, en van de stapgrootte.", waterLevelsProperty.Description);
+
+ PropertyDescriptor foreshoreProfileProperty = dynamicProperties[foreshoreProfilePropertyIndex];
+ Assert.IsNotNull(foreshoreProfileProperty);
+ Assert.IsFalse(foreshoreProfileProperty.IsReadOnly);
+ Assert.AreEqual(schematizationCategory, foreshoreProfileProperty.Category);
+ Assert.AreEqual("Voorlandprofiel", foreshoreProfileProperty.DisplayName);
+ Assert.AreEqual("De schematisatie van het voorlandprofiel.", foreshoreProfileProperty.Description);
+
+ PropertyDescriptor worldReferencePointProperty = dynamicProperties[worldReferencePointPropertyIndex];
+ Assert.IsNotNull(worldReferencePointProperty);
+ Assert.IsTrue(worldReferencePointProperty.IsReadOnly);
+ Assert.AreEqual(schematizationCategory, worldReferencePointProperty.Category);
+ Assert.AreEqual("Locatie (RD) [m]", worldReferencePointProperty.DisplayName);
+ Assert.AreEqual("De coördinaten van de locatie van het voorlandprofiel in het Rijksdriehoeksstelsel.", worldReferencePointProperty.Description);
+
+ PropertyDescriptor orientationProperty = dynamicProperties[orientationPropertyIndex];
+ Assert.IsNotNull(orientationProperty);
+ Assert.IsFalse(orientationProperty.IsReadOnly);
+ Assert.AreEqual(schematizationCategory, orientationProperty.Category);
+ Assert.AreEqual("Oriëntatie [°]", orientationProperty.DisplayName);
+ Assert.AreEqual("Oriëntatie van de dijknormaal ten opzichte van het noorden.", orientationProperty.Description);
+
+ PropertyDescriptor breakWaterProperty = dynamicProperties[breakWaterPropertyIndex];
+ Assert.IsNotNull(breakWaterProperty);
+ Assert.IsInstanceOf(breakWaterProperty.Converter);
+ Assert.IsTrue(breakWaterProperty.IsReadOnly);
+ Assert.AreEqual(schematizationCategory, breakWaterProperty.Category);
+ Assert.AreEqual("Dam", breakWaterProperty.DisplayName);
+ Assert.AreEqual("Eigenschappen van de dam.", breakWaterProperty.Description);
+
+ PropertyDescriptor foreshoreGeometryProperty = dynamicProperties[foreshoreGeometryPropertyIndex];
+ Assert.IsNotNull(foreshoreGeometryProperty);
+ Assert.IsInstanceOf(foreshoreGeometryProperty.Converter);
+ Assert.IsTrue(foreshoreGeometryProperty.IsReadOnly);
+ Assert.AreEqual(schematizationCategory, foreshoreGeometryProperty.Category);
+ Assert.AreEqual("Voorlandgeometrie", foreshoreGeometryProperty.DisplayName);
+ Assert.AreEqual("Eigenschappen van de voorlandgeometrie.", foreshoreGeometryProperty.Description);
+
+ PropertyDescriptor revetmentTypeProperty = dynamicProperties[revetmentTypePropertyIndex];
+ Assert.IsNotNull(revetmentTypeProperty);
+ Assert.IsTrue(revetmentTypeProperty.IsReadOnly);
+ Assert.AreEqual(schematizationCategory, revetmentTypeProperty.Category);
+ Assert.AreEqual("Type bekleding", revetmentTypeProperty.DisplayName);
+ Assert.AreEqual("Het type van de bekleding waarvoor berekend wordt.", revetmentTypeProperty.Description);
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/Ringtoets.StabilityStoneCover.Forms.Test.csproj
===================================================================
diff -u -r6da94dc5f56cf8edbf991440dd97f5b28856e658 -r172f313c5afd8dafa9756d9d1600c78ea2e9fcf9
--- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/Ringtoets.StabilityStoneCover.Forms.Test.csproj (.../Ringtoets.StabilityStoneCover.Forms.Test.csproj) (revision 6da94dc5f56cf8edbf991440dd97f5b28856e658)
+++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/Ringtoets.StabilityStoneCover.Forms.Test.csproj (.../Ringtoets.StabilityStoneCover.Forms.Test.csproj) (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -73,15 +73,18 @@
+
+
+
Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/TreeNodeInfos/StabilityStoneCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs
===================================================================
diff -u -r86401a913aaf544979e4062d00acfe1fb24e1e4f -r172f313c5afd8dafa9756d9d1600c78ea2e9fcf9
--- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/TreeNodeInfos/StabilityStoneCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs (.../StabilityStoneCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs) (revision 86401a913aaf544979e4062d00acfe1fb24e1e4f)
+++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/TreeNodeInfos/StabilityStoneCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs (.../StabilityStoneCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs) (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -196,7 +196,7 @@
var commentsContext = (CommentContext) children[0];
Assert.AreSame(calculation, commentsContext.WrappedData);
- var inputContext = (WaveConditionsInputContext) children[1];
+ var inputContext = (StabilityStoneCoverWaveConditionsInputContext)children[1];
Assert.AreSame(calculation.InputParameters, inputContext.WrappedData);
CollectionAssert.AreEqual(new[]
{
@@ -257,7 +257,7 @@
var commentsContext = (CommentContext) children[0];
Assert.AreSame(calculation, commentsContext.WrappedData);
- var inputContext = (WaveConditionsInputContext) children[1];
+ var inputContext = (StabilityStoneCoverWaveConditionsInputContext)children[1];
Assert.AreSame(calculation.InputParameters, inputContext.WrappedData);
CollectionAssert.AreEqual(new[]
{
Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/TreeNodeInfos/StabilityStoneCoverWaveConditionsInputContextTreeNodeInfoTest.cs
===================================================================
diff -u
--- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/TreeNodeInfos/StabilityStoneCoverWaveConditionsInputContextTreeNodeInfoTest.cs (revision 0)
+++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/TreeNodeInfos/StabilityStoneCoverWaveConditionsInputContextTreeNodeInfoTest.cs (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -0,0 +1,173 @@
+// 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.Drawing;
+using System.Linq;
+using Core.Common.Controls.TreeView;
+using Core.Common.Gui;
+using Core.Common.Gui.ContextMenu;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Forms.Properties;
+using Ringtoets.Revetment.Data;
+using Ringtoets.StabilityStoneCover.Data;
+using Ringtoets.StabilityStoneCover.Forms.PresentationObjects;
+using Ringtoets.StabilityStoneCover.Plugin;
+
+namespace Ringtoets.StabilityStoneCover.Forms.Test.TreeNodeInfos
+{
+ [TestFixture]
+ public class StabilityStoneCoverWaveConditionsInputContextTreeNodeInfoTest
+ {
+ private MockRepository mocks;
+
+ [SetUp]
+ public void SetUp()
+ {
+ mocks = new MockRepository();
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Setup
+ using (var plugin = new StabilityStoneCoverPlugin())
+ {
+ var info = GetInfo(plugin);
+
+ // Assert
+ Assert.IsNull(info.EnsureVisibleOnCreate);
+ Assert.IsNull(info.CanRename);
+ Assert.IsNull(info.OnNodeRenamed);
+ Assert.IsNull(info.CanRemove);
+ Assert.IsNull(info.OnNodeRemoved);
+ Assert.IsNull(info.CanCheck);
+ Assert.IsNull(info.IsChecked);
+ Assert.IsNull(info.OnNodeChecked);
+ Assert.IsNull(info.CanDrag);
+ Assert.IsNull(info.CanDrop);
+ Assert.IsNull(info.CanInsert);
+ Assert.IsNull(info.OnDrop);
+ Assert.IsNull(info.ChildNodeObjects);
+ Assert.IsNull(info.ForeColor);
+ }
+ }
+
+ [Test]
+ public void Text_Always_ReturnName()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new StabilityStoneCoverFailureMechanism();
+
+ var input = new WaveConditionsInput(WaveConditionsRevetment.StabilityStone);
+ var context = new StabilityStoneCoverWaveConditionsInputContext(input, failureMechanism.ForeshoreProfiles, assessmentSection);
+
+ using (var plugin = new StabilityStoneCoverPlugin())
+ {
+ var info = GetInfo(plugin);
+
+ // Call
+ string nodeText = info.Text(context);
+
+ // Assert
+ Assert.AreEqual("Invoer", nodeText);
+ }
+ }
+
+ [Test]
+ public void Image_Always_ReturnOutputIcon()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new StabilityStoneCoverFailureMechanism();
+
+ var input = new WaveConditionsInput(WaveConditionsRevetment.StabilityStone);
+ var context = new StabilityStoneCoverWaveConditionsInputContext(input, failureMechanism.ForeshoreProfiles, assessmentSection);
+
+ using (var plugin = new StabilityStoneCoverPlugin())
+ {
+ var info = GetInfo(plugin);
+ // Call
+ Image icon = info.Image(context);
+
+ // Assert
+ TestHelper.AssertImagesAreEqual(Resources.GenericInputOutputIcon, icon);
+ }
+ }
+
+ [Test]
+ public void ContextMenuStrip_FailureMechanismIsRelevant_CallsContextMenuBuilderMethods()
+ {
+ // Setup
+ using (var treeViewControl = new TreeViewControl())
+ {
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new StabilityStoneCoverFailureMechanism();
+
+ var input = new WaveConditionsInput(WaveConditionsRevetment.StabilityStone);
+ var context = new StabilityStoneCoverWaveConditionsInputContext(input, failureMechanism.ForeshoreProfiles, assessmentSection);
+
+ var menuBuilder = mocks.StrictMock();
+ menuBuilder.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilder);
+ menuBuilder.Expect(mb => mb.Build()).Return(null);
+
+ var gui = mocks.StrictMock();
+ gui.Expect(cmp => cmp.Get(context, treeViewControl)).Return(menuBuilder);
+ gui.Stub(g => g.ProjectOpened += null).IgnoreArguments();
+ gui.Stub(g => g.ProjectOpened -= null).IgnoreArguments();
+
+ mocks.ReplayAll();
+
+ using (var plugin = new StabilityStoneCoverPlugin())
+ {
+ var info = GetInfo(plugin);
+ plugin.Gui = gui;
+
+ // Call
+ info.ContextMenuStrip(context, null, treeViewControl);
+ }
+ }
+
+ // Assert
+ // Assert expectancies are called in TearDown()
+ }
+
+ private TreeNodeInfo GetInfo(StabilityStoneCoverPlugin plugin)
+ {
+ return plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(StabilityStoneCoverWaveConditionsInputContext));
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/StabilityStoneCoverPluginTest.cs
===================================================================
diff -u -r6da94dc5f56cf8edbf991440dd97f5b28856e658 -r172f313c5afd8dafa9756d9d1600c78ea2e9fcf9
--- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/StabilityStoneCoverPluginTest.cs (.../StabilityStoneCoverPluginTest.cs) (revision 6da94dc5f56cf8edbf991440dd97f5b28856e658)
+++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/StabilityStoneCoverPluginTest.cs (.../StabilityStoneCoverPluginTest.cs) (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -48,14 +48,23 @@
PropertyInfo[] propertyInfos = plugin.GetPropertyInfos().ToArray();
// Assert
- Assert.AreEqual(2, propertyInfos.Length);
+ Assert.AreEqual(3, propertyInfos.Length);
- PluginTestHelper.AssertPropertyInfoDefined<
+ PropertyInfo failureMechanismProperties = PluginTestHelper.AssertPropertyInfoDefined<
StabilityStoneCoverFailureMechanismContext,
StabilityStoneCoverFailureMechanismProperties>(propertyInfos);
- PluginTestHelper.AssertPropertyInfoDefined<
+ Assert.IsNull(failureMechanismProperties.AdditionalDataCheck);
+ Assert.IsNull(failureMechanismProperties.AfterCreate);
+ PropertyInfo waveConditionsOutputProperties = PluginTestHelper.AssertPropertyInfoDefined<
StabilityStoneCoverWaveConditionsOutput,
StabilityStoneCoverWaveConditionsOutputProperties>(propertyInfos);
+ Assert.IsNull(waveConditionsOutputProperties.AdditionalDataCheck);
+ Assert.IsNull(waveConditionsOutputProperties.AfterCreate);
+ PropertyInfo waveConditionsInputContextProperties = PluginTestHelper.AssertPropertyInfoDefined<
+ StabilityStoneCoverWaveConditionsInputContext,
+ StabilityStoneCoverWaveConditionsInputContextProperties>(propertyInfos);
+ Assert.IsNull(waveConditionsInputContextProperties.AdditionalDataCheck);
+ Assert.IsNull(waveConditionsInputContextProperties.AfterCreate);
}
}
@@ -88,13 +97,14 @@
TreeNodeInfo[] treeNodeInfos = plugin.GetTreeNodeInfos().ToArray();
// Assert
- Assert.AreEqual(6, treeNodeInfos.Length);
+ Assert.AreEqual(7, treeNodeInfos.Length);
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(StabilityStoneCoverFailureMechanismContext)));
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(StabilityStoneCoverWaveConditionsCalculationGroupContext)));
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(StabilityStoneCoverWaveConditionsCalculationContext)));
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(EmptyStabilityStoneCoverOutput)));
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(FailureMechanismSectionResultContext)));
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(StabilityStoneCoverWaveConditionsOutput)));
+ Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(StabilityStoneCoverWaveConditionsInputContext)));
}
}
}
Index: Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Forms/PresentationObjects/WaveImpactAsphaltCoverWaveConditionsInputContext.cs
===================================================================
diff -u
--- Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Forms/PresentationObjects/WaveImpactAsphaltCoverWaveConditionsInputContext.cs (revision 0)
+++ Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Forms/PresentationObjects/WaveImpactAsphaltCoverWaveConditionsInputContext.cs (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -0,0 +1,82 @@
+// 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 Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.DikeProfiles;
+using Ringtoets.HydraRing.Data;
+using Ringtoets.Revetment.Data;
+using Ringtoets.Revetment.Forms.PresentationObjects;
+
+namespace Ringtoets.WaveImpactAsphaltCover.Forms.PresentationObjects
+{
+ ///
+ /// Presentation object for for the .
+ ///
+ public class WaveImpactAsphaltCoverWaveConditionsInputContext : WaveConditionsInputContext
+ {
+ private readonly IEnumerable foreshoreProfiles;
+ private readonly IAssessmentSection assessmentSection;
+
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The wrapped .>
+ /// The foreshore profiles of the .
+ /// The assessment section which the context belongs to.
+ /// Thrown when any parameter is null .
+ public WaveImpactAsphaltCoverWaveConditionsInputContext(WaveConditionsInput wrappedData,
+ IEnumerable foreshoreProfiles,
+ IAssessmentSection assessmentSection) : base(wrappedData)
+ {
+ if (foreshoreProfiles == null)
+ {
+ throw new ArgumentNullException("foreshoreProfiles");
+ }
+ if (assessmentSection == null)
+ {
+ throw new ArgumentNullException("assessmentSection");
+ }
+ this.foreshoreProfiles = foreshoreProfiles;
+ this.assessmentSection = assessmentSection;
+ }
+
+ public override IEnumerable HydraulicBoundaryLocations
+ {
+ get
+ {
+ return assessmentSection.HydraulicBoundaryDatabase != null
+ ? assessmentSection.HydraulicBoundaryDatabase.Locations
+ : Enumerable.Empty();
+ }
+ }
+
+ public override IEnumerable ForeshoreProfiles
+ {
+ get
+ {
+ return foreshoreProfiles;
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Forms/PropertyClasses/WaveImpactAsphaltCoverWaveConditionsInputContextProperties.cs
===================================================================
diff -u
--- Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Forms/PropertyClasses/WaveImpactAsphaltCoverWaveConditionsInputContextProperties.cs (revision 0)
+++ Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Forms/PropertyClasses/WaveImpactAsphaltCoverWaveConditionsInputContextProperties.cs (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -0,0 +1,42 @@
+// 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 Ringtoets.Revetment.Data;
+using Ringtoets.Revetment.Forms.PropertyClasses;
+using Ringtoets.WaveImpactAsphaltCover.Forms.PresentationObjects;
+
+namespace Ringtoets.WaveImpactAsphaltCover.Forms.PropertyClasses
+{
+ ///
+ /// Property control the .
+ ///
+ public class WaveImpactAsphaltCoverWaveConditionsInputContextProperties
+ : WaveConditionsInputContextProperties
+ {
+ public override WaveConditionsRevetment RevetmentType
+ {
+ get
+ {
+ return WaveConditionsRevetment.Asphalt;
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Forms/Ringtoets.WaveImpactAsphaltCover.Forms.csproj
===================================================================
diff -u -r0cac40e2a18523361d826eba4374b1508f241fa2 -r172f313c5afd8dafa9756d9d1600c78ea2e9fcf9
--- Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Forms/Ringtoets.WaveImpactAsphaltCover.Forms.csproj (.../Ringtoets.WaveImpactAsphaltCover.Forms.csproj) (revision 0cac40e2a18523361d826eba4374b1508f241fa2)
+++ Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Forms/Ringtoets.WaveImpactAsphaltCover.Forms.csproj (.../Ringtoets.WaveImpactAsphaltCover.Forms.csproj) (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -44,10 +44,12 @@
Properties\GlobalAssembly.cs
+
+
True
Index: Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Plugin/WaveImpactAsphaltCoverPlugin.cs
===================================================================
diff -u -r0cac40e2a18523361d826eba4374b1508f241fa2 -r172f313c5afd8dafa9756d9d1600c78ea2e9fcf9
--- Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Plugin/WaveImpactAsphaltCoverPlugin.cs (.../WaveImpactAsphaltCoverPlugin.cs) (revision 0cac40e2a18523361d826eba4374b1508f241fa2)
+++ Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Plugin/WaveImpactAsphaltCoverPlugin.cs (.../WaveImpactAsphaltCoverPlugin.cs) (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -65,6 +65,7 @@
GetObjectPropertiesData = context => context.WrappedData
};
yield return new PropertyInfo();
+ yield return new PropertyInfo();
}
public override IEnumerable GetViewInfos()
@@ -126,6 +127,15 @@
.AddPropertiesItem()
.Build()
};
+
+ yield return new TreeNodeInfo
+ {
+ Text = context => RingtoetsCommonFormsResources.Calculation_Input,
+ Image = context => RingtoetsCommonFormsResources.GenericInputOutputIcon,
+ ContextMenuStrip = (nodeData, parentData, treeViewControl) => Gui.Get(nodeData, treeViewControl)
+ .AddPropertiesItem()
+ .Build()
+ };
}
public override IEnumerable GetExportInfos()
@@ -467,9 +477,9 @@
var childNodes = new List
{
new CommentContext(context.WrappedData),
- new WaveConditionsInputContext(context.WrappedData.InputParameters,
- context.FailureMechanism.ForeshoreProfiles,
- context.AssessmentSection)
+ new WaveImpactAsphaltCoverWaveConditionsInputContext(context.WrappedData.InputParameters,
+ context.FailureMechanism.ForeshoreProfiles,
+ context.AssessmentSection)
};
if (context.WrappedData.HasOutput)
Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/PresentationObjects/WaveImpactAsphaltCoverWaveConditionsInputContextTest.cs
===================================================================
diff -u
--- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/PresentationObjects/WaveImpactAsphaltCoverWaveConditionsInputContextTest.cs (revision 0)
+++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/PresentationObjects/WaveImpactAsphaltCoverWaveConditionsInputContextTest.cs (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -0,0 +1,165 @@
+// 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.Geometry;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.DikeProfiles;
+using Ringtoets.HydraRing.Data;
+using Ringtoets.Revetment.Data;
+using Ringtoets.Revetment.Forms.PresentationObjects;
+using Ringtoets.WaveImpactAsphaltCover.Data;
+using Ringtoets.WaveImpactAsphaltCover.Forms.PresentationObjects;
+
+namespace Ringtoets.WaveImpactAsphaltCover.Forms.Test.PresentationObjects
+{
+ [TestFixture]
+ public class WaveImpactAsphaltCoverWaveConditionsInputContextTest
+ {
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Setup
+ var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, string.Empty, 0, 0);
+ var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase()
+ {
+ Locations =
+ {
+ hydraulicBoundaryLocation
+ }
+ };
+
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ assessmentSection.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase;
+ mocks.ReplayAll();
+
+ var foreshoreProfile = new ForeshoreProfile(new Point2D(0, 0), Enumerable.Empty(),
+ null, new ForeshoreProfile.ConstructionProperties());
+
+ var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism
+ {
+ ForeshoreProfiles =
+ {
+ foreshoreProfile
+ }
+ };
+
+ var input = new WaveConditionsInput(WaveConditionsRevetment.Asphalt);
+
+ // Call
+ var context = new WaveImpactAsphaltCoverWaveConditionsInputContext(input,
+ failureMechanism.ForeshoreProfiles,
+ assessmentSection);
+
+ // Assert
+ Assert.IsInstanceOf(context);
+ Assert.AreEqual(input, context.WrappedData);
+ CollectionAssert.AreEqual(failureMechanism.ForeshoreProfiles, context.ForeshoreProfiles);
+ CollectionAssert.AreEqual(hydraulicBoundaryDatabase.Locations, context.HydraulicBoundaryLocations);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Constructor_InputNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
+
+ // Call
+ TestDelegate test = () => new WaveImpactAsphaltCoverWaveConditionsInputContext(null,
+ failureMechanism.ForeshoreProfiles,
+ assessmentSection);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("wrappedData", exception.ParamName);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Constructor_ForeshoreProfilesNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var input = new WaveConditionsInput(WaveConditionsRevetment.Asphalt);
+
+ // Call
+ TestDelegate test = () => new WaveImpactAsphaltCoverWaveConditionsInputContext(input,
+ null,
+ assessmentSection);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("foreshoreProfiles", exception.ParamName);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Constructor_AssessmentSectionNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var input = new WaveConditionsInput(WaveConditionsRevetment.Asphalt);
+ var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
+
+ // Call
+ TestDelegate test = () => new WaveImpactAsphaltCoverWaveConditionsInputContext(input,
+ failureMechanism.ForeshoreProfiles,
+ null);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("assessmentSection", exception.ParamName);
+ }
+
+ [Test]
+ public void HydraulicBoundaryLocations_HydraulicBoundaryDatabaseNull_ReturnEmptyCollection()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var input = new WaveConditionsInput(WaveConditionsRevetment.Asphalt);
+ var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
+
+ var context = new WaveImpactAsphaltCoverWaveConditionsInputContext(input, failureMechanism.ForeshoreProfiles, assessmentSection);
+
+ // Call
+ IEnumerable locations = context.HydraulicBoundaryLocations;
+
+ // Assert
+ CollectionAssert.IsEmpty(locations);
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/PropertyClasses/StabilityStoneCoverWaveConditionsInputContextPropertiesTest.cs
===================================================================
diff -u
--- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/PropertyClasses/StabilityStoneCoverWaveConditionsInputContextPropertiesTest.cs (revision 0)
+++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/PropertyClasses/StabilityStoneCoverWaveConditionsInputContextPropertiesTest.cs (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -0,0 +1,440 @@
+// 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.ComponentModel;
+using System.Linq;
+using Core.Common.Base;
+using Core.Common.Base.Data;
+using Core.Common.Base.Geometry;
+using Core.Common.Gui.Converters;
+using Core.Common.Gui.PropertyBag;
+using Core.Common.Utils;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.DikeProfiles;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.HydraRing.Data;
+using Ringtoets.Revetment.Data;
+using Ringtoets.Revetment.Forms.PropertyClasses;
+using Ringtoets.WaveImpactAsphaltCover.Data;
+using Ringtoets.WaveImpactAsphaltCover.Forms.PresentationObjects;
+using Ringtoets.WaveImpactAsphaltCover.Forms.PropertyClasses;
+
+namespace Ringtoets.WaveImpactAsphaltCover.Forms.Test.PropertyClasses
+{
+ [TestFixture]
+ public class WaveImpactAsphaltCoverWaveConditionsInputContextPropertiesTest
+ {
+ private const int hydraulicBoundaryLocationPropertyIndex = 0;
+ private const int assessmentLevelPropertyIndex = 1;
+ private const int upperBoundaryDesignWaterLevelPropertyIndex = 2;
+ private const int upperBoundaryRevetmentPropertyIndex = 3;
+ private const int lowerBoundaryRevetmentPropertyIndex = 4;
+ private const int upperBoundaryWaterLevelsPropertyIndex = 5;
+ private const int lowerBoundaryWaterLevelsPropertyIndex = 6;
+ private const int stepSizePropertyIndex = 7;
+ private const int waterLevelsPropertyIndex = 8;
+
+ private const int foreshoreProfilePropertyIndex = 9;
+ private const int worldReferencePointPropertyIndex = 10;
+ private const int orientationPropertyIndex = 11;
+ private const int breakWaterPropertyIndex = 12;
+ private const int foreshoreGeometryPropertyIndex = 13;
+ private const int revetmentTypePropertyIndex = 14;
+
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Call
+ var properties = new WaveImpactAsphaltCoverWaveConditionsInputContextProperties();
+
+ // Assert
+ Assert.IsInstanceOf>(properties);
+ Assert.IsNull(properties.Data);
+ }
+
+ [Test]
+ public void Data_SetDefaultInputContextInstance_ReturnCorrectPropertyValues()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var input = new WaveConditionsInput(WaveConditionsRevetment.Asphalt);
+ var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
+ var inputContext = new WaveImpactAsphaltCoverWaveConditionsInputContext(input,
+ failureMechanism.ForeshoreProfiles,
+ assessmentSection);
+
+ // Call
+ var properties = new WaveImpactAsphaltCoverWaveConditionsInputContextProperties
+ {
+ Data = inputContext
+ };
+
+ // Assert
+ Assert.IsNaN(properties.AssessmentLevel.Value);
+ Assert.IsNaN(properties.UpperBoundaryDesignWaterLevel.Value);
+ Assert.AreEqual(2, properties.UpperBoundaryDesignWaterLevel.NumberOfDecimalPlaces);
+ Assert.IsNaN(properties.UpperBoundaryRevetment.Value);
+ Assert.AreEqual(2, properties.UpperBoundaryRevetment.NumberOfDecimalPlaces);
+ Assert.IsNaN(properties.LowerBoundaryRevetment.Value);
+ Assert.AreEqual(2, properties.LowerBoundaryRevetment.NumberOfDecimalPlaces);
+ Assert.IsNaN(properties.UpperBoundaryWaterLevels.Value);
+ Assert.AreEqual(2, properties.UpperBoundaryWaterLevels.NumberOfDecimalPlaces);
+ Assert.IsNaN(properties.LowerBoundaryWaterLevels.Value);
+ Assert.AreEqual(2, properties.LowerBoundaryWaterLevels.NumberOfDecimalPlaces);
+ Assert.AreEqual(0.5, properties.StepSize.AsValue());
+ CollectionAssert.AreEqual(input.WaterLevels, properties.WaterLevels);
+
+ Assert.IsNull(properties.ForeshoreProfile);
+ Assert.IsNull(properties.WorldReferencePoint);
+ Assert.AreEqual(2, properties.Orientation.NumberOfDecimalPlaces);
+ Assert.AreEqual(0, properties.Orientation.Value);
+ Assert.AreSame(input, properties.BreakWater.Data);
+ Assert.AreSame(input, properties.ForeshoreGeometry.Data);
+ Assert.AreEqual(input.RevetmentType, properties.RevetmentType);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Data_SetNewInputContextInstanceWithForeshoreProfile_ReturnCorrectPropertyValues()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var random = new Random(21);
+ var assessmentLevel = (RoundedDouble)random.NextDouble();
+ var lowerBoundaryRevetment = (RoundedDouble)random.NextDouble();
+ var lowerBoundaryWaterLevels = (RoundedDouble)random.NextDouble();
+ var upperBoundaryRevetment = lowerBoundaryRevetment + (RoundedDouble)random.NextDouble();
+ var upperBoundaryWaterLevels = lowerBoundaryWaterLevels + (RoundedDouble)random.NextDouble();
+ var stepSize = WaveConditionsInputStepSize.Half;
+
+ var worldX = (RoundedDouble)random.NextDouble();
+ var worldY = (RoundedDouble)random.NextDouble();
+ var damHeight = (RoundedDouble)random.NextDouble();
+ var foreshoreProfileOrientation = (RoundedDouble)random.NextDouble();
+
+ var foreshoreProfile = new ForeshoreProfile(
+ new Point2D(worldX, worldY),
+ Enumerable.Empty(),
+ new BreakWater(BreakWaterType.Dam, damHeight),
+ new ForeshoreProfile.ConstructionProperties
+ {
+ Name = string.Empty,
+ Orientation = foreshoreProfileOrientation,
+ X0 = -3
+ });
+ var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, string.Empty, 0, 0)
+ {
+ DesignWaterLevel = assessmentLevel
+ };
+ assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase
+ {
+ Locations =
+ {
+ hydraulicBoundaryLocation
+ }
+ };
+
+ var input = new WaveConditionsInput(WaveConditionsRevetment.Asphalt)
+ {
+ ForeshoreProfile = foreshoreProfile,
+ HydraulicBoundaryLocation = hydraulicBoundaryLocation,
+ UpperBoundaryRevetment = upperBoundaryRevetment,
+ LowerBoundaryRevetment = lowerBoundaryRevetment,
+ UpperBoundaryWaterLevels = upperBoundaryWaterLevels,
+ LowerBoundaryWaterLevels = lowerBoundaryWaterLevels,
+ StepSize = stepSize
+ };
+
+ var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
+ failureMechanism.ForeshoreProfiles.Add(foreshoreProfile);
+
+ var inputContext = new WaveImpactAsphaltCoverWaveConditionsInputContext(input,
+ failureMechanism.ForeshoreProfiles,
+ assessmentSection);
+
+ // Call
+ var properties = new WaveImpactAsphaltCoverWaveConditionsInputContextProperties
+ {
+ Data = inputContext
+ };
+
+ // Assert
+ Assert.AreSame(hydraulicBoundaryLocation, properties.HydraulicBoundaryLocation);
+ Assert.AreEqual(assessmentLevel.Value, properties.AssessmentLevel.Value, properties.AssessmentLevel.GetAccuracy());
+ Assert.AreSame(foreshoreProfile, properties.ForeshoreProfile);
+ Assert.AreEqual(worldX, properties.WorldReferencePoint.X, 0.5);
+ Assert.AreEqual(worldY, properties.WorldReferencePoint.Y, 0.5);
+ Assert.AreEqual(2, properties.Orientation.NumberOfDecimalPlaces);
+ Assert.AreEqual(foreshoreProfileOrientation, properties.Orientation.Value, properties.Orientation.GetAccuracy());
+ Assert.AreEqual(BreakWaterType.Dam, properties.BreakWater.BreakWaterType);
+ Assert.AreEqual(damHeight, properties.BreakWater.BreakWaterHeight.Value, properties.BreakWater.BreakWaterHeight.GetAccuracy());
+ Assert.IsEmpty(properties.ForeshoreGeometry.Coordinates);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void SetProperties_IndividualProperties_UpdateDataAndNotifyObservers()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var observerMock = mocks.StrictMock();
+ const int numberProperties = 8;
+ observerMock.Expect(o => o.UpdateObserver()).Repeat.Times(numberProperties);
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var random = new Random(21);
+ var orientation = (RoundedDouble)random.NextDouble();
+ var assessmentLevel = (RoundedDouble)random.NextDouble();
+ var newLowerBoundaryRevetment = (RoundedDouble)random.NextDouble();
+ var newLowerBoundaryWaterLevels = (RoundedDouble)random.NextDouble();
+ var newUpperBoundaryRevetment = newLowerBoundaryRevetment + (RoundedDouble)random.NextDouble();
+ var newUpperBoundaryWaterLevels = newLowerBoundaryWaterLevels + (RoundedDouble)random.NextDouble();
+ var newStepSize = WaveConditionsInputStepSize.Half;
+
+ var newHydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, "name", 0.0, 1.1)
+ {
+ DesignWaterLevel = assessmentLevel
+ };
+
+ assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase
+ {
+ Locations =
+ {
+ newHydraulicBoundaryLocation
+ }
+ };
+
+ var input = new WaveConditionsInput(WaveConditionsRevetment.Asphalt);
+ input.Attach(observerMock);
+
+ var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
+
+ var inputContext = new WaveImpactAsphaltCoverWaveConditionsInputContext(input,
+ failureMechanism.ForeshoreProfiles,
+ assessmentSection);
+
+ var newForeshoreProfile = new ForeshoreProfile(
+ new Point2D(
+ (RoundedDouble)random.NextDouble(),
+ (RoundedDouble)random.NextDouble()),
+ Enumerable.Empty(),
+ new BreakWater(BreakWaterType.Dam, (RoundedDouble)random.NextDouble()),
+ new ForeshoreProfile.ConstructionProperties());
+
+ var properties = new WaveImpactAsphaltCoverWaveConditionsInputContextProperties
+ {
+ Data = inputContext
+ };
+
+ // Call
+ properties.ForeshoreProfile = newForeshoreProfile;
+ properties.UpperBoundaryRevetment = newUpperBoundaryRevetment;
+ properties.LowerBoundaryRevetment = newLowerBoundaryRevetment;
+ properties.UpperBoundaryWaterLevels = newUpperBoundaryWaterLevels;
+ properties.LowerBoundaryWaterLevels = newLowerBoundaryWaterLevels;
+ properties.StepSize = newStepSize;
+ properties.HydraulicBoundaryLocation = newHydraulicBoundaryLocation;
+ properties.Orientation = orientation;
+
+ // Assert
+ Assert.AreSame(input.HydraulicBoundaryLocation, properties.HydraulicBoundaryLocation);
+ Assert.AreEqual(input.HydraulicBoundaryLocation.DesignWaterLevel.Value, properties.AssessmentLevel.Value);
+ Assert.AreEqual(assessmentLevel - 0.01, properties.UpperBoundaryDesignWaterLevel.Value, properties.UpperBoundaryDesignWaterLevel.GetAccuracy());
+ Assert.AreEqual(2, properties.UpperBoundaryDesignWaterLevel.NumberOfDecimalPlaces);
+ Assert.AreEqual(newUpperBoundaryRevetment.Value, properties.UpperBoundaryRevetment.Value, properties.UpperBoundaryRevetment.GetAccuracy());
+ Assert.AreEqual(2, properties.UpperBoundaryRevetment.NumberOfDecimalPlaces);
+ Assert.AreEqual(newLowerBoundaryRevetment.Value, properties.LowerBoundaryRevetment.Value, properties.LowerBoundaryRevetment.GetAccuracy());
+ Assert.AreEqual(2, properties.LowerBoundaryRevetment.NumberOfDecimalPlaces);
+ Assert.AreEqual(newUpperBoundaryWaterLevels.Value, properties.UpperBoundaryWaterLevels.Value, properties.UpperBoundaryWaterLevels.GetAccuracy());
+ Assert.AreEqual(2, properties.UpperBoundaryWaterLevels.NumberOfDecimalPlaces);
+ Assert.AreEqual(newLowerBoundaryWaterLevels.Value, properties.LowerBoundaryWaterLevels.Value, properties.LowerBoundaryWaterLevels.GetAccuracy());
+ Assert.AreEqual(2, properties.LowerBoundaryWaterLevels.NumberOfDecimalPlaces);
+ Assert.AreEqual(orientation, properties.Orientation.Value, properties.Orientation.GetAccuracy());
+ Assert.AreEqual(2, properties.Orientation.NumberOfDecimalPlaces);
+ Assert.AreEqual(newStepSize, properties.StepSize);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void PropertyAttributes_ReturnExpectedValues(
+ [Values(true, false)] bool withForeshoreProfile)
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var input = new WaveConditionsInput(WaveConditionsRevetment.Asphalt);
+ var foreshoreProfile = new ForeshoreProfile(
+ new Point2D(0, 0),
+ Enumerable.Empty(),
+ null,
+ new ForeshoreProfile.ConstructionProperties());
+
+ if (withForeshoreProfile)
+ {
+ input.ForeshoreProfile = foreshoreProfile;
+ }
+
+
+ var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
+
+ var inputContext = new WaveImpactAsphaltCoverWaveConditionsInputContext(input, failureMechanism.ForeshoreProfiles, assessmentSection);
+
+ // Call
+ var properties = new WaveImpactAsphaltCoverWaveConditionsInputContextProperties
+ {
+ Data = inputContext
+ };
+
+ // Assert
+ var dynamicPropertyBag = new DynamicPropertyBag(properties);
+ PropertyDescriptorCollection dynamicProperties = dynamicPropertyBag.GetProperties(new Attribute[]
+ {
+ BrowsableAttribute.Yes
+ });
+ Assert.AreEqual(15, dynamicProperties.Count);
+
+ var hydraulicParametersCategory = "Hydraulische gegevens";
+ var schematizationCategory = "Schematisatie";
+
+ PropertyDescriptor hydraulicBoundaryLocationProperty = dynamicProperties[hydraulicBoundaryLocationPropertyIndex];
+ Assert.IsNotNull(hydraulicBoundaryLocationProperty);
+ Assert.IsFalse(hydraulicBoundaryLocationProperty.IsReadOnly);
+ Assert.AreEqual(hydraulicParametersCategory, hydraulicBoundaryLocationProperty.Category);
+ Assert.AreEqual("Locatie met hydraulische randvoorwaarden", hydraulicBoundaryLocationProperty.DisplayName);
+ Assert.AreEqual("De locatie met hydraulische randvoorwaarden.", hydraulicBoundaryLocationProperty.Description);
+
+ PropertyDescriptor assessmentLevelProperty = dynamicProperties[assessmentLevelPropertyIndex];
+ Assert.IsNotNull(assessmentLevelProperty);
+ Assert.IsTrue(assessmentLevelProperty.IsReadOnly);
+ Assert.AreEqual(hydraulicParametersCategory, assessmentLevelProperty.Category);
+ Assert.AreEqual("Toetspeil [m+NAP]", assessmentLevelProperty.DisplayName);
+ Assert.AreEqual("Waterstand met een overschrijdingsfrequentie gelijk aan de trajectnorm.", assessmentLevelProperty.Description);
+
+ PropertyDescriptor upperBoundaryDesignWaterLevelProperty = dynamicProperties[upperBoundaryDesignWaterLevelPropertyIndex];
+ Assert.IsNotNull(upperBoundaryDesignWaterLevelProperty);
+ Assert.IsTrue(upperBoundaryDesignWaterLevelProperty.IsReadOnly);
+ Assert.AreEqual(hydraulicParametersCategory, upperBoundaryDesignWaterLevelProperty.Category);
+ Assert.AreEqual("Bovengrens op basis van toetspeil [m+NAP]", upperBoundaryDesignWaterLevelProperty.DisplayName);
+ Assert.AreEqual("Bovengrens bepaald aan de hand van de waarde van het toetspeil op de geselecteerde hydraulische locatie.", upperBoundaryDesignWaterLevelProperty.Description);
+
+ PropertyDescriptor upperBoundaryRevetmentProperty = dynamicProperties[upperBoundaryRevetmentPropertyIndex];
+ Assert.IsNotNull(upperBoundaryRevetmentProperty);
+ Assert.IsTrue(upperBoundaryDesignWaterLevelProperty.IsReadOnly);
+ Assert.AreEqual(hydraulicParametersCategory, upperBoundaryRevetmentProperty.Category);
+ Assert.AreEqual("Bovengrens bekleding [m+NAP]", upperBoundaryRevetmentProperty.DisplayName);
+ Assert.AreEqual("Bovengrens van de bekleding.", upperBoundaryRevetmentProperty.Description);
+
+ PropertyDescriptor lowerBoundaryRevetmentProperty = dynamicProperties[lowerBoundaryRevetmentPropertyIndex];
+ Assert.IsNotNull(lowerBoundaryRevetmentProperty);
+ Assert.IsFalse(lowerBoundaryRevetmentProperty.IsReadOnly);
+ Assert.AreEqual(hydraulicParametersCategory, lowerBoundaryRevetmentProperty.Category);
+ Assert.AreEqual("Ondergrens bekleding [m+NAP]", lowerBoundaryRevetmentProperty.DisplayName);
+ Assert.AreEqual("Ondergrens van de bekleding.", lowerBoundaryRevetmentProperty.Description);
+
+ PropertyDescriptor upperBoundaryWaterLevelsProperty = dynamicProperties[upperBoundaryWaterLevelsPropertyIndex];
+ Assert.IsNotNull(upperBoundaryWaterLevelsProperty);
+ Assert.IsFalse(upperBoundaryWaterLevelsProperty.IsReadOnly);
+ Assert.AreEqual(hydraulicParametersCategory, upperBoundaryWaterLevelsProperty.Category);
+ Assert.AreEqual("Bovengrens waterstanden [m+NAP]", upperBoundaryWaterLevelsProperty.DisplayName);
+ Assert.AreEqual("Een aangepaste bovengrens voor de waterstanden.", upperBoundaryWaterLevelsProperty.Description);
+
+ PropertyDescriptor lowerBoundaryWaterLevelsProperty = dynamicProperties[lowerBoundaryWaterLevelsPropertyIndex];
+ Assert.IsNotNull(lowerBoundaryWaterLevelsProperty);
+ Assert.IsFalse(lowerBoundaryWaterLevelsProperty.IsReadOnly);
+ Assert.AreEqual(hydraulicParametersCategory, lowerBoundaryWaterLevelsProperty.Category);
+ Assert.AreEqual("Ondergrens waterstanden [m+NAP]", lowerBoundaryWaterLevelsProperty.DisplayName);
+ Assert.AreEqual("Een aangepaste ondergrens voor de waterstanden.", lowerBoundaryWaterLevelsProperty.Description);
+
+ PropertyDescriptor stepSizeProperty = dynamicProperties[stepSizePropertyIndex];
+ Assert.IsNotNull(stepSizeProperty);
+ Assert.IsInstanceOf(stepSizeProperty.Converter);
+ Assert.IsFalse(stepSizeProperty.IsReadOnly);
+ Assert.AreEqual(hydraulicParametersCategory, stepSizeProperty.Category);
+ Assert.AreEqual("Stapgrootte [m]", stepSizeProperty.DisplayName);
+ Assert.AreEqual("Grootte van de stappen waarmee de waterstanden in de berekening worden bepaald.", stepSizeProperty.Description);
+
+ PropertyDescriptor waterLevelsProperty = dynamicProperties[waterLevelsPropertyIndex];
+ Assert.IsNotNull(waterLevelsProperty);
+ Assert.IsInstanceOf(waterLevelsProperty.Converter);
+ Assert.IsTrue(waterLevelsProperty.IsReadOnly);
+ Assert.AreEqual(hydraulicParametersCategory, waterLevelsProperty.Category);
+ Assert.AreEqual("Waterstanden in berekening [m+NAP]", waterLevelsProperty.DisplayName);
+ Assert.AreEqual("De waterstanden waarvoor gerekend moet worden. Deze zijn afgeleid van de opgegeven boven- en ondergrenzen, en van de stapgrootte.", waterLevelsProperty.Description);
+
+ PropertyDescriptor foreshoreProfileProperty = dynamicProperties[foreshoreProfilePropertyIndex];
+ Assert.IsNotNull(foreshoreProfileProperty);
+ Assert.IsFalse(foreshoreProfileProperty.IsReadOnly);
+ Assert.AreEqual(schematizationCategory, foreshoreProfileProperty.Category);
+ Assert.AreEqual("Voorlandprofiel", foreshoreProfileProperty.DisplayName);
+ Assert.AreEqual("De schematisatie van het voorlandprofiel.", foreshoreProfileProperty.Description);
+
+ PropertyDescriptor worldReferencePointProperty = dynamicProperties[worldReferencePointPropertyIndex];
+ Assert.IsNotNull(worldReferencePointProperty);
+ Assert.IsTrue(worldReferencePointProperty.IsReadOnly);
+ Assert.AreEqual(schematizationCategory, worldReferencePointProperty.Category);
+ Assert.AreEqual("Locatie (RD) [m]", worldReferencePointProperty.DisplayName);
+ Assert.AreEqual("De coördinaten van de locatie van het voorlandprofiel in het Rijksdriehoeksstelsel.", worldReferencePointProperty.Description);
+
+ PropertyDescriptor orientationProperty = dynamicProperties[orientationPropertyIndex];
+ Assert.IsNotNull(orientationProperty);
+ Assert.IsFalse(orientationProperty.IsReadOnly);
+ Assert.AreEqual(schematizationCategory, orientationProperty.Category);
+ Assert.AreEqual("Oriëntatie [°]", orientationProperty.DisplayName);
+ Assert.AreEqual("Oriëntatie van de dijknormaal ten opzichte van het noorden.", orientationProperty.Description);
+
+ PropertyDescriptor breakWaterProperty = dynamicProperties[breakWaterPropertyIndex];
+ Assert.IsNotNull(breakWaterProperty);
+ Assert.IsInstanceOf(breakWaterProperty.Converter);
+ Assert.IsTrue(breakWaterProperty.IsReadOnly);
+ Assert.AreEqual(schematizationCategory, breakWaterProperty.Category);
+ Assert.AreEqual("Dam", breakWaterProperty.DisplayName);
+ Assert.AreEqual("Eigenschappen van de dam.", breakWaterProperty.Description);
+
+ PropertyDescriptor foreshoreGeometryProperty = dynamicProperties[foreshoreGeometryPropertyIndex];
+ Assert.IsNotNull(foreshoreGeometryProperty);
+ Assert.IsInstanceOf(foreshoreGeometryProperty.Converter);
+ Assert.IsTrue(foreshoreGeometryProperty.IsReadOnly);
+ Assert.AreEqual(schematizationCategory, foreshoreGeometryProperty.Category);
+ Assert.AreEqual("Voorlandgeometrie", foreshoreGeometryProperty.DisplayName);
+ Assert.AreEqual("Eigenschappen van de voorlandgeometrie.", foreshoreGeometryProperty.Description);
+
+ PropertyDescriptor revetmentTypeProperty = dynamicProperties[revetmentTypePropertyIndex];
+ Assert.IsNotNull(revetmentTypeProperty);
+ Assert.IsTrue(revetmentTypeProperty.IsReadOnly);
+ Assert.AreEqual(schematizationCategory, revetmentTypeProperty.Category);
+ Assert.AreEqual("Type bekleding", revetmentTypeProperty.DisplayName);
+ Assert.AreEqual("Het type van de bekleding waarvoor berekend wordt.", revetmentTypeProperty.Description);
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/Ringtoets.WaveImpactAsphaltCover.Forms.Test.csproj
===================================================================
diff -u -r0cac40e2a18523361d826eba4374b1508f241fa2 -r172f313c5afd8dafa9756d9d1600c78ea2e9fcf9
--- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/Ringtoets.WaveImpactAsphaltCover.Forms.Test.csproj (.../Ringtoets.WaveImpactAsphaltCover.Forms.Test.csproj) (revision 0cac40e2a18523361d826eba4374b1508f241fa2)
+++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/Ringtoets.WaveImpactAsphaltCover.Forms.Test.csproj (.../Ringtoets.WaveImpactAsphaltCover.Forms.Test.csproj) (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -60,14 +60,17 @@
Properties\GlobalAssembly.cs
+
+
+
Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/TreeNodeInfos/WaveImpactAsphaltCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs
===================================================================
diff -u -r68579356ae04086051adec7a13109406a2e0614d -r172f313c5afd8dafa9756d9d1600c78ea2e9fcf9
--- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/TreeNodeInfos/WaveImpactAsphaltCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs) (revision 68579356ae04086051adec7a13109406a2e0614d)
+++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/TreeNodeInfos/WaveImpactAsphaltCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs) (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -196,7 +196,7 @@
var commentsContext = (CommentContext) children[0];
Assert.AreSame(calculation, commentsContext.WrappedData);
- var inputContext = (WaveConditionsInputContext)children[1];
+ var inputContext = (WaveImpactAsphaltCoverWaveConditionsInputContext)children[1];
Assert.AreSame(calculation.InputParameters, inputContext.WrappedData);
CollectionAssert.AreEqual(new[]
{
@@ -255,7 +255,7 @@
var commentsContext = (CommentContext) children[0];
Assert.AreSame(calculation, commentsContext.WrappedData);
- var inputContext = (WaveConditionsInputContext)children[1];
+ var inputContext = (WaveImpactAsphaltCoverWaveConditionsInputContext)children[1];
Assert.AreSame(calculation.InputParameters, inputContext.WrappedData);
CollectionAssert.AreEqual(new[]
{
Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/TreeNodeInfos/WaveImpactAsphaltCoverWaveConditionsInputContextTreeNodeInfoTest.cs
===================================================================
diff -u
--- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/TreeNodeInfos/WaveImpactAsphaltCoverWaveConditionsInputContextTreeNodeInfoTest.cs (revision 0)
+++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/TreeNodeInfos/WaveImpactAsphaltCoverWaveConditionsInputContextTreeNodeInfoTest.cs (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -0,0 +1,173 @@
+// 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.Drawing;
+using System.Linq;
+using Core.Common.Controls.TreeView;
+using Core.Common.Gui;
+using Core.Common.Gui.ContextMenu;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Forms.Properties;
+using Ringtoets.Revetment.Data;
+using Ringtoets.WaveImpactAsphaltCover.Data;
+using Ringtoets.WaveImpactAsphaltCover.Forms.PresentationObjects;
+using Ringtoets.WaveImpactAsphaltCover.Plugin;
+
+namespace Ringtoets.WaveImpactAsphaltCover.Forms.Test.TreeNodeInfos
+{
+ [TestFixture]
+ public class WaveImpactAsphaltCoverWaveConditionsInputContextTreeNodeInfoTest
+ {
+ private MockRepository mocks;
+
+ [SetUp]
+ public void SetUp()
+ {
+ mocks = new MockRepository();
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Setup
+ using (var plugin = new WaveImpactAsphaltCoverPlugin())
+ {
+ var info = GetInfo(plugin);
+
+ // Assert
+ Assert.IsNull(info.EnsureVisibleOnCreate);
+ Assert.IsNull(info.CanRename);
+ Assert.IsNull(info.OnNodeRenamed);
+ Assert.IsNull(info.CanRemove);
+ Assert.IsNull(info.OnNodeRemoved);
+ Assert.IsNull(info.CanCheck);
+ Assert.IsNull(info.IsChecked);
+ Assert.IsNull(info.OnNodeChecked);
+ Assert.IsNull(info.CanDrag);
+ Assert.IsNull(info.CanDrop);
+ Assert.IsNull(info.CanInsert);
+ Assert.IsNull(info.OnDrop);
+ Assert.IsNull(info.ChildNodeObjects);
+ Assert.IsNull(info.ForeColor);
+ }
+ }
+
+ [Test]
+ public void Text_Always_ReturnName()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
+
+ var input = new WaveConditionsInput(WaveConditionsRevetment.Asphalt);
+ var context = new WaveImpactAsphaltCoverWaveConditionsInputContext(input, failureMechanism.ForeshoreProfiles, assessmentSection);
+
+ using (var plugin = new WaveImpactAsphaltCoverPlugin())
+ {
+ var info = GetInfo(plugin);
+
+ // Call
+ string nodeText = info.Text(context);
+
+ // Assert
+ Assert.AreEqual("Invoer", nodeText);
+ }
+ }
+
+ [Test]
+ public void Image_Always_ReturnOutputIcon()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
+
+ var input = new WaveConditionsInput(WaveConditionsRevetment.Asphalt);
+ var context = new WaveImpactAsphaltCoverWaveConditionsInputContext(input, failureMechanism.ForeshoreProfiles, assessmentSection);
+
+ using (var plugin = new WaveImpactAsphaltCoverPlugin())
+ {
+ var info = GetInfo(plugin);
+ // Call
+ Image icon = info.Image(context);
+
+ // Assert
+ TestHelper.AssertImagesAreEqual(Resources.GenericInputOutputIcon, icon);
+ }
+ }
+
+ [Test]
+ public void ContextMenuStrip_FailureMechanismIsRelevant_CallsContextMenuBuilderMethods()
+ {
+ // Setup
+ using (var treeViewControl = new TreeViewControl())
+ {
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
+
+ var input = new WaveConditionsInput(WaveConditionsRevetment.Asphalt);
+ var context = new WaveImpactAsphaltCoverWaveConditionsInputContext(input, failureMechanism.ForeshoreProfiles, assessmentSection);
+
+ var menuBuilder = mocks.StrictMock();
+ menuBuilder.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilder);
+ menuBuilder.Expect(mb => mb.Build()).Return(null);
+
+ var gui = mocks.StrictMock();
+ gui.Expect(cmp => cmp.Get(context, treeViewControl)).Return(menuBuilder);
+ gui.Stub(g => g.ProjectOpened += null).IgnoreArguments();
+ gui.Stub(g => g.ProjectOpened -= null).IgnoreArguments();
+
+ mocks.ReplayAll();
+
+ using (var plugin = new WaveImpactAsphaltCoverPlugin())
+ {
+ var info = GetInfo(plugin);
+ plugin.Gui = gui;
+
+ // Call
+ info.ContextMenuStrip(context, null, treeViewControl);
+ }
+ }
+
+ // Assert
+ // Assert expectancies are called in TearDown()
+ }
+
+ private TreeNodeInfo GetInfo(WaveImpactAsphaltCoverPlugin plugin)
+ {
+ return plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(WaveImpactAsphaltCoverWaveConditionsInputContext));
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/WaveImpactAsphaltCoverPluginTest.cs
===================================================================
diff -u -r0cac40e2a18523361d826eba4374b1508f241fa2 -r172f313c5afd8dafa9756d9d1600c78ea2e9fcf9
--- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/WaveImpactAsphaltCoverPluginTest.cs (.../WaveImpactAsphaltCoverPluginTest.cs) (revision 0cac40e2a18523361d826eba4374b1508f241fa2)
+++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/WaveImpactAsphaltCoverPluginTest.cs (.../WaveImpactAsphaltCoverPluginTest.cs) (revision 172f313c5afd8dafa9756d9d1600c78ea2e9fcf9)
@@ -59,7 +59,7 @@
PropertyInfo[] propertyInfos = plugin.GetPropertyInfos().ToArray();
// Assert
- Assert.AreEqual(2, propertyInfos.Length);
+ Assert.AreEqual(3, propertyInfos.Length);
PropertyInfo failureMechanismContextProperties = PluginTestHelper.AssertPropertyInfoDefined
(propertyInfos);
@@ -72,6 +72,13 @@
Assert.IsNull(waveImpactAsphaltCoverWaveConditionsOutputProperties.AdditionalDataCheck);
Assert.IsNull(waveImpactAsphaltCoverWaveConditionsOutputProperties.GetObjectPropertiesData);
Assert.IsNull(waveImpactAsphaltCoverWaveConditionsOutputProperties.AfterCreate);
+
+ PropertyInfo waveConditionsInputContextProperties = PluginTestHelper.AssertPropertyInfoDefined<
+ WaveImpactAsphaltCoverWaveConditionsInputContext,
+ WaveImpactAsphaltCoverWaveConditionsInputContextProperties>(propertyInfos);
+ Assert.IsNull(waveConditionsInputContextProperties.AdditionalDataCheck);
+ Assert.IsNull(waveConditionsInputContextProperties.GetObjectPropertiesData);
+ Assert.IsNull(waveConditionsInputContextProperties.AfterCreate);
}
}
@@ -104,13 +111,14 @@
TreeNodeInfo[] treeNodeInfos = plugin.GetTreeNodeInfos().ToArray();
// Assert
- Assert.AreEqual(6, treeNodeInfos.Length);
+ Assert.AreEqual(7, treeNodeInfos.Length);
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(WaveImpactAsphaltCoverFailureMechanismContext)));
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(FailureMechanismSectionResultContext)));
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext)));
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(WaveImpactAsphaltCoverWaveConditionsCalculationContext)));
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(EmptyWaveImpactAsphaltCoverOutput)));
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(WaveImpactAsphaltCoverWaveConditionsOutput)));
+ Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(WaveImpactAsphaltCoverWaveConditionsInputContext)));
}
}