Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/StructuresInputBaseProperties.cs
===================================================================
diff -u -rac582bc093c8a275cd9b5dc2148af313b5242062 -rbb80820ff4a4e09793da242cb7b36ca2bce59c32
--- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/StructuresInputBaseProperties.cs (.../StructuresInputBaseProperties.cs) (revision ac582bc093c8a275cd9b5dc2148af313b5242062)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/StructuresInputBaseProperties.cs (.../StructuresInputBaseProperties.cs) (revision bb80820ff4a4e09793da242cb7b36ca2bce59c32)
@@ -478,8 +478,8 @@
get
{
return data.WrappedData.ForeshoreProfile == null ?
- new UseBreakWaterProperties(null) :
- new UseBreakWaterProperties(data.WrappedData);
+ new UseBreakWaterProperties() :
+ new UseBreakWaterProperties(data.WrappedData, data.Calculation);
}
}
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/UseBreakWaterProperties.cs
===================================================================
diff -u -r9fb229f4fc4fe2c11e79e344c76ceb220f2dc96a -rbb80820ff4a4e09793da242cb7b36ca2bce59c32
--- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/UseBreakWaterProperties.cs (.../UseBreakWaterProperties.cs) (revision 9fb229f4fc4fe2c11e79e344c76ceb220f2dc96a)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/UseBreakWaterProperties.cs (.../UseBreakWaterProperties.cs) (revision bb80820ff4a4e09793da242cb7b36ca2bce59c32)
@@ -19,12 +19,14 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System;
using System.ComponentModel;
using Core.Common.Base.Data;
using Core.Common.Gui.Attributes;
using Core.Common.Utils;
using Core.Common.Utils.Attributes;
using Core.Common.Utils.Reflection;
+using Ringtoets.Common.Data.Calculation;
using Ringtoets.Common.Data.DikeProfiles;
using Ringtoets.Common.Forms.Properties;
using Ringtoets.Common.Forms.TypeConverters;
@@ -40,16 +42,33 @@
private const int breakWaterTypePropertyIndex = 2;
private const int breakWaterHeightPropertyIndex = 3;
private readonly IUseBreakWater data;
+ private ICalculation calculationToUpdate;
///
- /// Creates a new instance of .
+ /// Creates a new instance of , in which
+ /// all the properties are read only.
///
+ public UseBreakWaterProperties() { }
+
+ ///
+ /// Creates a new instance of in which the
+ /// properties are editable.
+ ///
/// The data to use for the properties.
- /// If is null, all properties
- /// will be set to .
- public UseBreakWaterProperties(IUseBreakWater useBreakWaterData)
+ /// The calculationToUpdate that needs to be updated due to a property change.
+ /// Thrown when any input parameter is null.
+ public UseBreakWaterProperties(IUseBreakWater useBreakWaterData, ICalculation calculation)
{
+ if (useBreakWaterData == null)
+ {
+ throw new ArgumentNullException("useBreakWaterData");
+ }
+ if (calculation == null)
+ {
+ throw new ArgumentNullException("calculation");
+ }
data = useBreakWaterData;
+ calculationToUpdate = calculation;
}
[DynamicReadOnly]
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/FailureMechanismPropertyChangeHandlerTest.cs
===================================================================
diff -u -r782c3e6bb64a0a674b33d6251b745dd71dade7bb -rbb80820ff4a4e09793da242cb7b36ca2bce59c32
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/FailureMechanismPropertyChangeHandlerTest.cs (.../FailureMechanismPropertyChangeHandlerTest.cs) (revision 782c3e6bb64a0a674b33d6251b745dd71dade7bb)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/FailureMechanismPropertyChangeHandlerTest.cs (.../FailureMechanismPropertyChangeHandlerTest.cs) (revision bb80820ff4a4e09793da242cb7b36ca2bce59c32)
@@ -5,10 +5,9 @@
using Core.Common.Base;
using NUnit.Extensions.Forms;
using NUnit.Framework;
-using Ringtoets.Common.Data;
-using Ringtoets.Common.Data.Calculation;
using Ringtoets.Common.Data.FailureMechanism;
using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.Forms.TestUtil;
namespace Ringtoets.Common.Forms.Test
{
@@ -127,38 +126,38 @@
{
CreateCalculationWithOutput()
})
- ).SetName("Single calculation with output");
+ ).SetName("ChangeComposition Single calculation with output");
yield return new TestCaseData(
new ChangeCompositionTestCase(new[]
{
CreateCalculationWithoutOutput()
})
- ).SetName("Single calculation without output");
+ ).SetName("ChangeComposition Single calculation without output");
yield return new TestCaseData(
new ChangeCompositionTestCase(new[]
{
CreateCalculationWithoutOutput(),
CreateCalculationWithoutOutput()
})
- ).SetName("Two calculations without output");
+ ).SetName("ChangeComposition Two calculations without output");
yield return new TestCaseData(
new ChangeCompositionTestCase(new[]
{
CreateCalculationWithOutput(),
CreateCalculationWithoutOutput()
})
- ).SetName("Calculation without and calculation with output");
+ ).SetName("ChangeComposition Calculation without and calculation with output");
yield return new TestCaseData(
new ChangeCompositionTestCase(new[]
{
CreateCalculationWithOutput(),
CreateCalculationWithOutput()
})
- ).SetName("Two calculations with output");
+ ).SetName("ChangeComposition Two calculations with output");
yield return new TestCaseData(
new ChangeCompositionTestCase(new[]
@@ -167,7 +166,7 @@
CreateCalculationWithOutput(),
CreateCalculationWithoutOutput()
})
- ).SetName("Two calculations with and one calculation without output");
+ ).SetName("ChangeComposition Two calculations with and one calculation without output");
}
private static TestCalculation CreateCalculationWithoutOutput()
@@ -182,38 +181,6 @@
Output = new object()
};
}
-
- #region Test classes
-
- public class TestCalculation : Observable, ICalculation
- {
- ///
- /// Gets or sets an object that represents some output of this calculation.
- ///
- public object Output { get; set; }
-
- public bool HasOutput
- {
- get
- {
- return Output != null;
- }
- }
-
- public void ClearOutput()
- {
- Output = null;
- }
-
- #region Irrelevant for test
-
- public string Name { get; set; }
- public Comment Comments { get; }
-
- #endregion
- }
-
- #endregion
}
}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/UseBreakWaterPropertiesTest.cs
===================================================================
diff -u -r41a37c93cb0b3e36ff7023c9f42b4e6225598b55 -rbb80820ff4a4e09793da242cb7b36ca2bce59c32
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/UseBreakWaterPropertiesTest.cs (.../UseBreakWaterPropertiesTest.cs) (revision 41a37c93cb0b3e36ff7023c9f42b4e6225598b55)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/UseBreakWaterPropertiesTest.cs (.../UseBreakWaterPropertiesTest.cs) (revision bb80820ff4a4e09793da242cb7b36ca2bce59c32)
@@ -31,6 +31,7 @@
using Ringtoets.Common.Data.DikeProfiles;
using Ringtoets.Common.Data.TestUtil;
using Ringtoets.Common.Forms.PropertyClasses;
+using Ringtoets.Common.Forms.TestUtil;
using Ringtoets.Common.Forms.TypeConverters;
namespace Ringtoets.Common.Forms.Test.PropertyClasses
@@ -39,10 +40,10 @@
public class UseBreakWaterPropertiesTest
{
[Test]
- public void Constructor_IBreakWaterNull_ExpectedValues()
+ public void DefaultConstructor_ExpectedValues()
{
// Call
- var properties = new UseBreakWaterProperties(null);
+ var properties = new UseBreakWaterProperties();
// Assert
Assert.IsFalse(properties.UseBreakWater);
@@ -52,6 +53,28 @@
}
[Test]
+ public void Constructor_UseBreakWaterDataNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate test = () => new UseBreakWaterProperties(null, new TestCalculation());
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("useBreakWaterData", paramName);
+ }
+
+ [Test]
+ public void Constructor_CalculationNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate test = () => new UseBreakWaterProperties(new TestUseBreakWater(), null);
+
+ // Assert
+ var paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("calculation", paramName);
+ }
+
+ [Test]
public void Constructor_ValidData_ExpectedValues()
{
// Setup
@@ -62,7 +85,7 @@
};
// Call
- var properties = new UseBreakWaterProperties(useBreakWaterData);
+ var properties = new UseBreakWaterProperties(useBreakWaterData, new TestCalculation());
// Assert
Assert.IsTrue(properties.UseBreakWater);
@@ -85,7 +108,7 @@
{
BreakWater = breakWater
};
- var properties = new UseBreakWaterProperties(testUseBreakWater);
+ var properties = new UseBreakWaterProperties(testUseBreakWater, new TestCalculation());
testUseBreakWater.Attach(observerMock);
@@ -103,20 +126,56 @@
}
[Test]
- [TestCase(true, true)]
- [TestCase(true, false)]
- [TestCase(false, true)]
- [TestCase(false, false)]
- public void PropertyAttributes_UseBreakWater_ReturnExpectedValues(bool useBreakWater, bool useBreakWaterEnabled)
+ public void DefaultConstructor_Always_ReadOnlyProperties()
{
+ // Call
+ var properties = new UseBreakWaterProperties();
+
+ // Assert
+ var dynamicPropertyBag = new DynamicPropertyBag(properties);
+ PropertyDescriptorCollection dynamicProperties = dynamicPropertyBag.GetProperties(new Attribute[]
+ {
+ new BrowsableAttribute(true)
+ });
+ Assert.AreEqual(3, dynamicProperties.Count);
+
+ PropertyDescriptor useBreakWaterProperty = dynamicProperties[0];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(useBreakWaterProperty,
+ "Misc",
+ "Gebruik",
+ "Moet de dam worden gebruikt tijdens de berekening?",
+ true);
+
+ PropertyDescriptor breakWaterTypeProperty = dynamicProperties[1];
+ Assert.IsInstanceOf(breakWaterTypeProperty.Converter);
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(breakWaterTypeProperty,
+ "Misc",
+ "Type",
+ "Het type van de dam.",
+ true);
+
+ PropertyDescriptor breakWaterHeightProperty = dynamicProperties[2];
+ Assert.IsInstanceOf(breakWaterHeightProperty.Converter);
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(breakWaterHeightProperty,
+ "Misc",
+ "Hoogte [m+NAP]",
+ "De hoogte van de dam.",
+ true);
+ }
+
+ [Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void Constructor_WithBreakWaterAndCalculationUseBreakWater_ReturnExpectedProperties(bool useBreakWater)
+ {
// Setup
- TestUseBreakWater testUseBreakWater = useBreakWaterEnabled ? new TestUseBreakWater
+ TestUseBreakWater testUseBreakWater = new TestUseBreakWater
{
UseBreakWater = useBreakWater
- } : null;
+ };
// Call
- var properties = new UseBreakWaterProperties(testUseBreakWater);
+ var properties = new UseBreakWaterProperties(testUseBreakWater, new TestCalculation());
// Assert
var dynamicPropertyBag = new DynamicPropertyBag(properties);
@@ -130,24 +189,23 @@
PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(useBreakWaterProperty,
"Misc",
"Gebruik",
- "Moet de dam worden gebruikt tijdens de berekening?",
- !useBreakWaterEnabled);
+ "Moet de dam worden gebruikt tijdens de berekening?");
PropertyDescriptor breakWaterTypeProperty = dynamicProperties[1];
Assert.IsInstanceOf(breakWaterTypeProperty.Converter);
PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(breakWaterTypeProperty,
"Misc",
"Type",
"Het type van de dam.",
- !useBreakWaterEnabled || !useBreakWater);
+ !useBreakWater);
PropertyDescriptor breakWaterHeightProperty = dynamicProperties[2];
Assert.IsInstanceOf(breakWaterHeightProperty.Converter);
PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(breakWaterHeightProperty,
"Misc",
"Hoogte [m+NAP]",
"De hoogte van de dam.",
- !useBreakWaterEnabled || !useBreakWater);
+ !useBreakWater);
}
private class TestUseBreakWater : Observable, IUseBreakWater
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil.Test/Ringtoets.Common.Forms.TestUtil.Test.csproj
===================================================================
diff -u -r23d1e296e2da4364fbfe346e68d582dfcf966bb0 -rbb80820ff4a4e09793da242cb7b36ca2bce59c32
--- Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil.Test/Ringtoets.Common.Forms.TestUtil.Test.csproj (.../Ringtoets.Common.Forms.TestUtil.Test.csproj) (revision 23d1e296e2da4364fbfe346e68d582dfcf966bb0)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil.Test/Ringtoets.Common.Forms.TestUtil.Test.csproj (.../Ringtoets.Common.Forms.TestUtil.Test.csproj) (revision bb80820ff4a4e09793da242cb7b36ca2bce59c32)
@@ -54,6 +54,7 @@
+
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil.Test/TestCalculationTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil.Test/TestCalculationTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil.Test/TestCalculationTest.cs (revision bb80820ff4a4e09793da242cb7b36ca2bce59c32)
@@ -0,0 +1,24 @@
+using Core.Common.Base;
+using NUnit.Framework;
+using Ringtoets.Common.Data.Calculation;
+
+namespace Ringtoets.Common.Forms.TestUtil.Test
+{
+ [TestFixture]
+ public class TestCalculationTest
+ {
+
+ [Test]
+ public void DefaultConstructor_PropertiesSet()
+ {
+ // Call
+ var result = new TestCalculation();
+
+ // Assert
+ Assert.IsInstanceOf(result);
+ Assert.IsInstanceOf(result);
+ Assert.IsNull(result.Output);
+ Assert.IsFalse(result.HasOutput);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil/Ringtoets.Common.Forms.TestUtil.csproj
===================================================================
diff -u -r23d1e296e2da4364fbfe346e68d582dfcf966bb0 -rbb80820ff4a4e09793da242cb7b36ca2bce59c32
--- Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil/Ringtoets.Common.Forms.TestUtil.csproj (.../Ringtoets.Common.Forms.TestUtil.csproj) (revision 23d1e296e2da4364fbfe346e68d582dfcf966bb0)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil/Ringtoets.Common.Forms.TestUtil.csproj (.../Ringtoets.Common.Forms.TestUtil.csproj) (revision bb80820ff4a4e09793da242cb7b36ca2bce59c32)
@@ -54,6 +54,7 @@
+
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil/TestCalculation.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil/TestCalculation.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil/TestCalculation.cs (revision bb80820ff4a4e09793da242cb7b36ca2bce59c32)
@@ -0,0 +1,38 @@
+using Core.Common.Base;
+using Ringtoets.Common.Data;
+using Ringtoets.Common.Data.Calculation;
+
+namespace Ringtoets.Common.Forms.TestUtil
+{
+ ///
+ /// Creates a simple implementation, which
+ /// can have an object set as output.
+ ///
+ public class TestCalculation : Observable, ICalculation
+ {
+ ///
+ /// Gets or sets an object that represents some output of this calculation.
+ ///
+ public object Output { get; set; }
+
+ public bool HasOutput
+ {
+ get
+ {
+ return Output != null;
+ }
+ }
+
+ public void ClearOutput()
+ {
+ Output = null;
+ }
+
+ #region Irrelevant for test
+
+ public string Name { get; set; }
+ public Comment Comments { get; }
+
+ #endregion
+ }
+}
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsInputContextProperties.cs
===================================================================
diff -u -rac582bc093c8a275cd9b5dc2148af313b5242062 -rbb80820ff4a4e09793da242cb7b36ca2bce59c32
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsInputContextProperties.cs (.../GrassCoverErosionInwardsInputContextProperties.cs) (revision ac582bc093c8a275cd9b5dc2148af313b5242062)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsInputContextProperties.cs (.../GrassCoverErosionInwardsInputContextProperties.cs) (revision bb80820ff4a4e09793da242cb7b36ca2bce59c32)
@@ -22,6 +22,7 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing.Design;
+using Core.Common.Base;
using Core.Common.Base.Data;
using Core.Common.Base.Geometry;
using Core.Common.Gui.Attributes;
@@ -33,6 +34,7 @@
using Ringtoets.Common.Forms.PresentationObjects;
using Ringtoets.Common.Forms.PropertyClasses;
using Ringtoets.Common.Forms.UITypeEditors;
+using Ringtoets.Common.Service;
using Ringtoets.GrassCoverErosionInwards.Data;
using Ringtoets.GrassCoverErosionInwards.Forms.PresentationObjects;
using Ringtoets.GrassCoverErosionInwards.Forms.Properties;
@@ -74,7 +76,7 @@
{
data.WrappedData.DikeProfile = value;
GrassCoverErosionInwardsHelper.Update(data.FailureMechanism.SectionResults, data.Calculation);
- data.WrappedData.NotifyObservers();
+ NotifyPropertyChanged();
}
}
@@ -107,7 +109,7 @@
set
{
data.WrappedData.Orientation = value;
- data.WrappedData.NotifyObservers();
+ NotifyPropertyChanged();
}
}
@@ -121,8 +123,8 @@
get
{
return data.WrappedData.DikeProfile == null ?
- new UseBreakWaterProperties(null) :
- new UseBreakWaterProperties(data.WrappedData);
+ new UseBreakWaterProperties() :
+ new UseBreakWaterProperties(data.WrappedData, data.Calculation);
}
}
@@ -169,7 +171,7 @@
set
{
data.WrappedData.DikeHeight = value;
- data.WrappedData.NotifyObservers();
+ NotifyPropertyChanged();
}
}
@@ -187,7 +189,7 @@
set
{
data.WrappedData.DikeHeightCalculationType = value;
- data.WrappedData.NotifyObservers();
+ NotifyPropertyChanged();
}
}
@@ -223,7 +225,7 @@
set
{
data.WrappedData.HydraulicBoundaryLocation = value.HydraulicBoundaryLocation;
- data.WrappedData.NotifyObservers();
+ NotifyPropertyChanged();
}
}
@@ -249,5 +251,15 @@
return SelectableHydraulicBoundaryLocationHelper.GetSortedSelectableHydraulicBoundaryLocations(
data.AvailableHydraulicBoundaryLocations, calculationLocation);
}
+
+ private void NotifyPropertyChanged()
+ {
+ IEnumerable affectedCalculation = RingtoetsCommonDataSynchronizationService.ClearCalculationOutput(data.Calculation);
+ foreach (var calculation in affectedCalculation)
+ {
+ calculation.NotifyObservers();
+ }
+ data.WrappedData.NotifyObservers();
+ }
}
}
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Ringtoets.GrassCoverErosionInwards.Forms.csproj
===================================================================
diff -u -r23d1e296e2da4364fbfe346e68d582dfcf966bb0 -rbb80820ff4a4e09793da242cb7b36ca2bce59c32
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Ringtoets.GrassCoverErosionInwards.Forms.csproj (.../Ringtoets.GrassCoverErosionInwards.Forms.csproj) (revision 23d1e296e2da4364fbfe346e68d582dfcf966bb0)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Ringtoets.GrassCoverErosionInwards.Forms.csproj (.../Ringtoets.GrassCoverErosionInwards.Forms.csproj) (revision bb80820ff4a4e09793da242cb7b36ca2bce59c32)
@@ -158,6 +158,10 @@
Ringtoets.Common.Forms
False
+
+ {D951D6DA-FE83-4920-9FDB-63BF96480B54}
+ Ringtoets.Common.Service
+
{90DE728E-48EF-4665-AB38-3D88E41D9F4D}
Ringtoets.GrassCoverErosionInwards.Data
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsCalculationTest.cs
===================================================================
diff -u -rd56bec747401ad6676fac64af5eef6d5fd89c47c -rbb80820ff4a4e09793da242cb7b36ca2bce59c32
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsCalculationTest.cs (.../GrassCoverErosionInwardsCalculationTest.cs) (revision d56bec747401ad6676fac64af5eef6d5fd89c47c)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsCalculationTest.cs (.../GrassCoverErosionInwardsCalculationTest.cs) (revision bb80820ff4a4e09793da242cb7b36ca2bce59c32)
@@ -22,7 +22,6 @@
using Core.Common.Base;
using NUnit.Framework;
using Ringtoets.Common.Data.Calculation;
-using Ringtoets.Common.Data.Probability;
using Ringtoets.GrassCoverErosionInwards.Data.TestUtil;
namespace Ringtoets.GrassCoverErosionInwards.Data.Test
@@ -127,11 +126,5 @@
// Assert
Assert.IsTrue(calculationHasOutput);
}
-
- private class TestGrassCoverErosionInwardsOutput : GrassCoverErosionInwardsOutput
- {
- public TestGrassCoverErosionInwardsOutput() : base(0.0, true, new ProbabilityAssessmentOutput(0, 0, 0, 0, 0),
- new TestDikeHeightAssessmentOutput(0)) {}
- }
}
}
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.TestUtil.Test/Ringtoets.GrassCoverErosionInwards.Data.TestUtil.Test.csproj
===================================================================
diff -u -r23d1e296e2da4364fbfe346e68d582dfcf966bb0 -rbb80820ff4a4e09793da242cb7b36ca2bce59c32
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.TestUtil.Test/Ringtoets.GrassCoverErosionInwards.Data.TestUtil.Test.csproj (.../Ringtoets.GrassCoverErosionInwards.Data.TestUtil.Test.csproj) (revision 23d1e296e2da4364fbfe346e68d582dfcf966bb0)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.TestUtil.Test/Ringtoets.GrassCoverErosionInwards.Data.TestUtil.Test.csproj (.../Ringtoets.GrassCoverErosionInwards.Data.TestUtil.Test.csproj) (revision bb80820ff4a4e09793da242cb7b36ca2bce59c32)
@@ -52,6 +52,7 @@
+
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.TestUtil.Test/TestGrassCoverErosionInwardsOutputTest.cs
===================================================================
diff -u
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.TestUtil.Test/TestGrassCoverErosionInwardsOutputTest.cs (revision 0)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.TestUtil.Test/TestGrassCoverErosionInwardsOutputTest.cs (revision bb80820ff4a4e09793da242cb7b36ca2bce59c32)
@@ -0,0 +1,23 @@
+using NUnit.Framework;
+using Ringtoets.Common.Data.Probability;
+
+namespace Ringtoets.GrassCoverErosionInwards.Data.TestUtil.Test
+{
+ [TestFixture]
+ public class TestGrassCoverErosionInwardsOutputTest
+ {
+
+ [Test]
+ public void DefaultConstructor_PropertiesSet()
+ {
+ // Call
+ var result = new TestGrassCoverErosionInwardsOutput();
+
+ // Assert
+ Assert.AreEqual(0.0, result.WaveHeight.Value);
+ Assert.IsTrue(result.IsOvertoppingDominant);
+ Assert.IsInstanceOf(result.ProbabilityAssessmentOutput);
+ Assert.IsInstanceOf(result.DikeHeightAssessmentOutput);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.TestUtil/Ringtoets.GrassCoverErosionInwards.Data.TestUtil.csproj
===================================================================
diff -u -r23d1e296e2da4364fbfe346e68d582dfcf966bb0 -rbb80820ff4a4e09793da242cb7b36ca2bce59c32
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.TestUtil/Ringtoets.GrassCoverErosionInwards.Data.TestUtil.csproj (.../Ringtoets.GrassCoverErosionInwards.Data.TestUtil.csproj) (revision 23d1e296e2da4364fbfe346e68d582dfcf966bb0)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.TestUtil/Ringtoets.GrassCoverErosionInwards.Data.TestUtil.csproj (.../Ringtoets.GrassCoverErosionInwards.Data.TestUtil.csproj) (revision bb80820ff4a4e09793da242cb7b36ca2bce59c32)
@@ -48,8 +48,13 @@
+
+
+ {3BBFD65B-B277-4E50-AE6D-BD24C3434609}
+ Core.Common.Base
+
{d4200f43-3f72-4f42-af0a-8ced416a38ec}
Ringtoets.Common.Data
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.TestUtil/TestGrassCoverErosionInwardsOutput.cs
===================================================================
diff -u
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.TestUtil/TestGrassCoverErosionInwardsOutput.cs (revision 0)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.TestUtil/TestGrassCoverErosionInwardsOutput.cs (revision bb80820ff4a4e09793da242cb7b36ca2bce59c32)
@@ -0,0 +1,14 @@
+using Ringtoets.Common.Data.Probability;
+
+namespace Ringtoets.GrassCoverErosionInwards.Data.TestUtil
+{
+ ///
+ /// Simple implementation of a , which can be
+ /// used in tests where actual output values are not important.
+ ///
+ public class TestGrassCoverErosionInwardsOutput : GrassCoverErosionInwardsOutput
+ {
+ public TestGrassCoverErosionInwardsOutput() : base(0.0, true, new ProbabilityAssessmentOutput(0, 0, 0, 0, 0),
+ new TestDikeHeightAssessmentOutput(0)) {}
+ }
+}
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsInputContextPropertiesTest.cs
===================================================================
diff -u -rac582bc093c8a275cd9b5dc2148af313b5242062 -rbb80820ff4a4e09793da242cb7b36ca2bce59c32
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsInputContextPropertiesTest.cs (.../GrassCoverErosionInwardsInputContextPropertiesTest.cs) (revision ac582bc093c8a275cd9b5dc2148af313b5242062)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsInputContextPropertiesTest.cs (.../GrassCoverErosionInwardsInputContextPropertiesTest.cs) (revision bb80820ff4a4e09793da242cb7b36ca2bce59c32)
@@ -19,6 +19,7 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
@@ -39,6 +40,7 @@
using Ringtoets.Common.Forms.PropertyClasses;
using Ringtoets.Common.Forms.UITypeEditors;
using Ringtoets.GrassCoverErosionInwards.Data;
+using Ringtoets.GrassCoverErosionInwards.Data.TestUtil;
using Ringtoets.GrassCoverErosionInwards.Forms.PresentationObjects;
using Ringtoets.GrassCoverErosionInwards.Forms.PropertyClasses;
@@ -160,19 +162,17 @@
public void SetProperties_IndividualProperties_UpdateDataAndNotifyObservers()
{
// Setup
- var observerMock = mockRepository.StrictMock();
- const int numberOfChangedProperties = 5;
- observerMock.Expect(o => o.UpdateObserver()).Repeat.Times(numberOfChangedProperties);
var assessmentSectionMock = mockRepository.StrictMock();
- var failureMechanismMock = mockRepository.StrictMock();
- var calculationMock = mockRepository.StrictMock();
mockRepository.ReplayAll();
var input = new GrassCoverErosionInwardsInput();
- input.Attach(observerMock);
var properties = new GrassCoverErosionInwardsInputContextProperties
{
- Data = new GrassCoverErosionInwardsInputContext(input, calculationMock, failureMechanismMock, assessmentSectionMock)
+ Data = new GrassCoverErosionInwardsInputContext(
+ input,
+ new GrassCoverErosionInwardsCalculation(),
+ new GrassCoverErosionInwardsFailureMechanism(),
+ assessmentSectionMock)
};
DikeProfile newDikeProfile = new TestDikeProfile();
@@ -199,6 +199,91 @@
}
[Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void Orientation_WithOrWithoutOutput_HasOutputFalseInputNotifiedAndCalculationNotifiedWhenHadOutput(bool hasOutput)
+ {
+ SetPropertyAndVerifyNotifcationsAndOutput(hasOutput, properties => properties.Orientation = new Random(21).NextRoundedDouble());
+ }
+
+ [Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void DikeHeight_WithOrWithoutOutput_HasOutputFalseInputNotifiedAndCalculationNotifiedWhenHadOutput(bool hasOutput)
+ {
+ SetPropertyAndVerifyNotifcationsAndOutput(hasOutput, properties => properties.DikeHeight = new Random(21).NextRoundedDouble());
+ }
+
+ [Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void DikeHeightCalculationType_WithOrWithoutOutput_HasOutputFalseInputNotifiedAndCalculationNotifiedWhenHadOutput(bool hasOutput)
+ {
+ SetPropertyAndVerifyNotifcationsAndOutput(hasOutput, properties => properties.DikeHeightCalculationType = new Random(21).NextEnumValue());
+ }
+
+ [Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void DikeProfile_WithOrWithoutOutput_HasOutputFalseInputNotifiedAndCalculationNotifiedWhenHadOutput(bool hasOutput)
+ {
+ SetPropertyAndVerifyNotifcationsAndOutput(hasOutput, properties => properties.DikeProfile = new TestDikeProfile());
+ }
+
+ [Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void SelectedHydraulicBoundaryLocation_WithOrWithoutOutput_HasOutputFalseInputNotifiedAndCalculationNotifiedWhenHadOutput(bool hasOutput)
+ {
+ SetPropertyAndVerifyNotifcationsAndOutput(
+ hasOutput,
+ properties => properties.SelectedHydraulicBoundaryLocation =
+ new SelectableHydraulicBoundaryLocation(new TestHydraulicBoundaryLocation(), new Point2D(0,0)));
+ }
+
+ private void SetPropertyAndVerifyNotifcationsAndOutput(
+ bool hasOutput,
+ Action setProperty)
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ var calculationObserver = mocks.StrictMock();
+ var inputObserver = mocks.StrictMock();
+ int numberOfChangedProperties = hasOutput ? 1 : 0;
+ calculationObserver.Expect(o => o.UpdateObserver()).Repeat.Times(numberOfChangedProperties);
+ inputObserver.Expect(o => o.UpdateObserver());
+ mocks.ReplayAll();
+
+ var calculation = new GrassCoverErosionInwardsCalculation();
+ if (hasOutput)
+ {
+ calculation.Output = new TestGrassCoverErosionInwardsOutput();
+ }
+ var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
+
+ GrassCoverErosionInwardsInput inputParameters = calculation.InputParameters;
+ calculation.Attach(calculationObserver);
+ inputParameters.Attach(inputObserver);
+
+ var properties = new GrassCoverErosionInwardsInputContextProperties
+ {
+ Data = new GrassCoverErosionInwardsInputContext(inputParameters,
+ calculation,
+ failureMechanism,
+ assessmentSection)
+ };
+
+ // Call
+ setProperty(properties);
+
+ // Assert
+ Assert.IsFalse(calculation.HasOutput);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
public void SelectedHydraulicBoundaryLocation_InputNoLocation_ReturnsNull()
{
// Setup
Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PresentationObjects/GrassCoverErosionOutwardsWaveConditionsInputContext.cs
===================================================================
diff -u -re182f6f394aa75e739467a77e7bcacd9a8b25429 -rbb80820ff4a4e09793da242cb7b36ca2bce59c32
--- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PresentationObjects/GrassCoverErosionOutwardsWaveConditionsInputContext.cs (.../GrassCoverErosionOutwardsWaveConditionsInputContext.cs) (revision e182f6f394aa75e739467a77e7bcacd9a8b25429)
+++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PresentationObjects/GrassCoverErosionOutwardsWaveConditionsInputContext.cs (.../GrassCoverErosionOutwardsWaveConditionsInputContext.cs) (revision bb80820ff4a4e09793da242cb7b36ca2bce59c32)
@@ -21,6 +21,7 @@
using System;
using System.Collections.Generic;
+using Ringtoets.Common.Data.Calculation;
using Ringtoets.Common.Data.DikeProfiles;
using Ringtoets.Common.Data.Hydraulics;
using Ringtoets.GrassCoverErosionOutwards.Data;
@@ -40,12 +41,14 @@
/// Creates a new instance of .
///
/// The wrapped .
+ /// The calculation having as input.
/// The
/// the context belongs to.
/// Thrown when any parameter is null.
public GrassCoverErosionOutwardsWaveConditionsInputContext(WaveConditionsInput wrappedData,
+ ICalculation calculation,
GrassCoverErosionOutwardsFailureMechanism failureMechanism)
- : base(wrappedData)
+ : base(wrappedData, calculation)
{
if (failureMechanism == null)
{
Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs
===================================================================
diff -u -r2fb856472ed92ee1b51ff65cdb57e1ac751b85a5 -rbb80820ff4a4e09793da242cb7b36ca2bce59c32
--- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs (.../GrassCoverErosionOutwardsPlugin.cs) (revision 2fb856472ed92ee1b51ff65cdb57e1ac751b85a5)
+++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs (.../GrassCoverErosionOutwardsPlugin.cs) (revision bb80820ff4a4e09793da242cb7b36ca2bce59c32)
@@ -806,6 +806,7 @@
{
context.WrappedData.Comments,
new GrassCoverErosionOutwardsWaveConditionsInputContext(context.WrappedData.InputParameters,
+ context.WrappedData,
context.FailureMechanism)
};
Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PresentationObjects/GrassCoverErosionOutwardsWaveConditionsInputContextTest.cs
===================================================================
diff -u -re182f6f394aa75e739467a77e7bcacd9a8b25429 -rbb80820ff4a4e09793da242cb7b36ca2bce59c32
--- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PresentationObjects/GrassCoverErosionOutwardsWaveConditionsInputContextTest.cs (.../GrassCoverErosionOutwardsWaveConditionsInputContextTest.cs) (revision e182f6f394aa75e739467a77e7bcacd9a8b25429)
+++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PresentationObjects/GrassCoverErosionOutwardsWaveConditionsInputContextTest.cs (.../GrassCoverErosionOutwardsWaveConditionsInputContextTest.cs) (revision bb80820ff4a4e09793da242cb7b36ca2bce59c32)
@@ -26,6 +26,7 @@
using NUnit.Framework;
using Ringtoets.Common.Data.DikeProfiles;
using Ringtoets.Common.Data.Hydraulics;
+using Ringtoets.Common.Forms.TestUtil;
using Ringtoets.GrassCoverErosionOutwards.Data;
using Ringtoets.GrassCoverErosionOutwards.Forms.PresentationObjects;
using Ringtoets.Revetment.Data;
@@ -50,10 +51,14 @@
failureMechanism.ForeshoreProfiles.Add(foreshoreProfile);
failureMechanism.HydraulicBoundaryLocations.Add(hydraulicBoundaryLocation);
- var input = new WaveConditionsInput();
+ var calculation = new GrassCoverErosionOutwardsWaveConditionsCalculation();
+ var input = calculation.InputParameters;
// Call
- var context = new GrassCoverErosionOutwardsWaveConditionsInputContext(input, failureMechanism);
+ var context = new GrassCoverErosionOutwardsWaveConditionsInputContext(
+ input,
+ calculation,
+ failureMechanism);
// Assert
Assert.IsInstanceOf>(context);
@@ -75,21 +80,45 @@
var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism();
// Call
- TestDelegate test = () => new GrassCoverErosionOutwardsWaveConditionsInputContext(null, failureMechanism);
+ TestDelegate test = () => new GrassCoverErosionOutwardsWaveConditionsInputContext(
+ null,
+ new TestCalculation(),
+ failureMechanism);
// Assert
var exception = Assert.Throws(test);
Assert.AreEqual("wrappedData", exception.ParamName);
}
[Test]
+ public void Constructor_CalculationNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var input = new WaveConditionsInput();
+ var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism();
+
+ // Call
+ TestDelegate test = () => new GrassCoverErosionOutwardsWaveConditionsInputContext(
+ input,
+ null,
+ failureMechanism);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("calculation", exception.ParamName);
+ }
+
+ [Test]
public void Constructor_FailureMechanismNull_ThrowsArgumentNullException()
{
// Setup
var input = new WaveConditionsInput();
// Call
- TestDelegate test = () => new GrassCoverErosionOutwardsWaveConditionsInputContext(input, null);
+ TestDelegate test = () => new GrassCoverErosionOutwardsWaveConditionsInputContext(
+ input,
+ new TestCalculation(),
+ null);
// Assert
var exception = Assert.Throws(test);
Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PropertyClasses/GrassCoverErosionOutwardsWaveConditionsInputContextPropertiesTest.cs
===================================================================
diff -u -rac582bc093c8a275cd9b5dc2148af313b5242062 -rbb80820ff4a4e09793da242cb7b36ca2bce59c32
--- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PropertyClasses/GrassCoverErosionOutwardsWaveConditionsInputContextPropertiesTest.cs (.../GrassCoverErosionOutwardsWaveConditionsInputContextPropertiesTest.cs) (revision ac582bc093c8a275cd9b5dc2148af313b5242062)
+++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PropertyClasses/GrassCoverErosionOutwardsWaveConditionsInputContextPropertiesTest.cs (.../GrassCoverErosionOutwardsWaveConditionsInputContextPropertiesTest.cs) (revision bb80820ff4a4e09793da242cb7b36ca2bce59c32)
@@ -77,9 +77,13 @@
public void Data_SetDefaultInputContextInstance_ReturnCorrectPropertyValues()
{
// Setup
- var input = new WaveConditionsInput();
+ var calculation = new GrassCoverErosionOutwardsWaveConditionsCalculation();
+ var input = calculation.InputParameters;
var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism();
- var inputContext = new GrassCoverErosionOutwardsWaveConditionsInputContext(input, failureMechanism);
+ var inputContext = new GrassCoverErosionOutwardsWaveConditionsInputContext(
+ input,
+ calculation,
+ failureMechanism);
// Call
var properties = new GrassCoverErosionOutwardsWaveConditionsInputContextProperties
@@ -139,22 +143,25 @@
X0 = -3
});
var hydraulicBoundaryLocation = TestHydraulicBoundaryLocation.CreateDesignWaterLevelCalculated(assessmentLevel);
- var input = new WaveConditionsInput()
- {
- ForeshoreProfile = foreshoreProfile,
- HydraulicBoundaryLocation = hydraulicBoundaryLocation,
- UpperBoundaryRevetment = upperBoundaryRevetment,
- LowerBoundaryRevetment = lowerBoundaryRevetment,
- UpperBoundaryWaterLevels = upperBoundaryWaterLevels,
- LowerBoundaryWaterLevels = lowerBoundaryWaterLevels,
- StepSize = stepSize
- };
+ var calculation = new GrassCoverErosionOutwardsWaveConditionsCalculation();
+ var input = calculation.InputParameters;
+ input.ForeshoreProfile = foreshoreProfile;
+ input.HydraulicBoundaryLocation = hydraulicBoundaryLocation;
+ input.UpperBoundaryRevetment = upperBoundaryRevetment;
+ input.LowerBoundaryRevetment = lowerBoundaryRevetment;
+ input.UpperBoundaryWaterLevels = upperBoundaryWaterLevels;
+ input.LowerBoundaryWaterLevels = lowerBoundaryWaterLevels;
+ input.StepSize = stepSize;
+
var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism();
failureMechanism.HydraulicBoundaryLocations.Add(hydraulicBoundaryLocation);
failureMechanism.ForeshoreProfiles.Add(foreshoreProfile);
- var inputContext = new GrassCoverErosionOutwardsWaveConditionsInputContext(input, failureMechanism);
+ var inputContext = new GrassCoverErosionOutwardsWaveConditionsInputContext(
+ input,
+ calculation,
+ failureMechanism);
// Call
var properties = new GrassCoverErosionOutwardsWaveConditionsInputContextProperties
@@ -197,12 +204,16 @@
var newHydraulicBoundaryLocation = TestHydraulicBoundaryLocation.CreateDesignWaterLevelCalculated(assessmentLevel);
var newSelectableHydraulicBoundaryLocation = new SelectableHydraulicBoundaryLocation(newHydraulicBoundaryLocation, null);
- var input = new WaveConditionsInput();
+ var calculation = new GrassCoverErosionOutwardsWaveConditionsCalculation();
+ var input = calculation.InputParameters;
input.Attach(observerMock);
var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism();
- var inputContext = new GrassCoverErosionOutwardsWaveConditionsInputContext(input, failureMechanism);
+ var inputContext = new GrassCoverErosionOutwardsWaveConditionsInputContext(
+ input,
+ calculation,
+ failureMechanism);
var newForeshoreProfile = new ForeshoreProfile(
new Point2D((RoundedDouble) random.NextDouble(),
@@ -250,7 +261,8 @@
[Values(true, false)] bool withForeshoreProfile)
{
// Setup
- var input = new WaveConditionsInput();
+ var calculation = new GrassCoverErosionOutwardsWaveConditionsCalculation();
+ var input = calculation.InputParameters;
var foreshoreProfile = new ForeshoreProfile(
new Point2D(0, 0),
Enumerable.Empty(),
@@ -263,7 +275,10 @@
}
var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism();
- var inputContext = new GrassCoverErosionOutwardsWaveConditionsInputContext(input, failureMechanism);
+ var inputContext = new GrassCoverErosionOutwardsWaveConditionsInputContext(
+ input,
+ calculation,
+ failureMechanism);
// Call
var properties = new GrassCoverErosionOutwardsWaveConditionsInputContextProperties
Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionOutwardsWaveConditionsInputContextTreeNodeInfoTest.cs
===================================================================
diff -u -r2d006ceaaef282af15090fe5505ffeca58a291e0 -rbb80820ff4a4e09793da242cb7b36ca2bce59c32
--- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionOutwardsWaveConditionsInputContextTreeNodeInfoTest.cs (.../GrassCoverErosionOutwardsWaveConditionsInputContextTreeNodeInfoTest.cs) (revision 2d006ceaaef282af15090fe5505ffeca58a291e0)
+++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionOutwardsWaveConditionsInputContextTreeNodeInfoTest.cs (.../GrassCoverErosionOutwardsWaveConditionsInputContextTreeNodeInfoTest.cs) (revision bb80820ff4a4e09793da242cb7b36ca2bce59c32)
@@ -68,10 +68,12 @@
{
// Setup
var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism();
+ var calculation = new GrassCoverErosionOutwardsWaveConditionsCalculation();
+ var context = new GrassCoverErosionOutwardsWaveConditionsInputContext(
+ calculation.InputParameters,
+ calculation,
+ failureMechanism);
- var input = new WaveConditionsInput();
- var context = new GrassCoverErosionOutwardsWaveConditionsInputContext(input, failureMechanism);
-
using (var plugin = new GrassCoverErosionOutwardsPlugin())
{
var info = GetInfo(plugin);
@@ -89,10 +91,12 @@
{
// Setup
var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism();
+ var calculation = new GrassCoverErosionOutwardsWaveConditionsCalculation();
+ var context = new GrassCoverErosionOutwardsWaveConditionsInputContext(
+ calculation.InputParameters,
+ calculation,
+ failureMechanism);
- var input = new WaveConditionsInput();
- var context = new GrassCoverErosionOutwardsWaveConditionsInputContext(input, failureMechanism);
-
using (var plugin = new GrassCoverErosionOutwardsPlugin())
{
var info = GetInfo(plugin);
@@ -112,10 +116,12 @@
using (var treeViewControl = new TreeViewControl())
{
var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism();
+ var calculation = new GrassCoverErosionOutwardsWaveConditionsCalculation();
+ var context = new GrassCoverErosionOutwardsWaveConditionsInputContext(
+ calculation.InputParameters,
+ calculation,
+ failureMechanism);
- var input = new WaveConditionsInput();
- var context = new GrassCoverErosionOutwardsWaveConditionsInputContext(input, failureMechanism);
-
var menuBuilder = mocks.StrictMock();
menuBuilder.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilder);
menuBuilder.Expect(mb => mb.Build()).Return(null);
Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingInputContextPropertiesTest.cs
===================================================================
diff -u -re1758a6faea9f8010bc12cbe9df8fba3797d03ea -rbb80820ff4a4e09793da242cb7b36ca2bce59c32
--- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingInputContextPropertiesTest.cs (.../PipingInputContextPropertiesTest.cs) (revision e1758a6faea9f8010bc12cbe9df8fba3797d03ea)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingInputContextPropertiesTest.cs (.../PipingInputContextPropertiesTest.cs) (revision bb80820ff4a4e09793da242cb7b36ca2bce59c32)
@@ -469,6 +469,7 @@
Assert.AreSame(soilProfile, inputParameters.StochasticSoilProfile);
DistributionAssert.AreEqual(dampingFactorExit.Distribution, inputParameters.DampingFactorExit);
DistributionAssert.AreEqual(phreaticLevelExit.Distribution, inputParameters.PhreaticLevelExit);
+ mocks.VerifyAll();
}
[Test]
@@ -1752,22 +1753,21 @@
calculationObserver.Expect(o => o.UpdateObserver()).Repeat.Times(numberOfChangedProperties);
inputObserver.Expect(o => o.UpdateObserver());
mocks.ReplayAll();
-
- PipingCalculationScenario calculationItem = calculation;
+
if (hasOutput)
{
- calculationItem.Output = new TestPipingOutput();
+ calculation.Output = new TestPipingOutput();
}
- PipingFailureMechanism failureMechanism = new PipingFailureMechanism();
+ var failureMechanism = new PipingFailureMechanism();
- PipingInput inputParameters = calculationItem.InputParameters;
- calculationItem.Attach(calculationObserver);
+ PipingInput inputParameters = calculation.InputParameters;
+ calculation.Attach(calculationObserver);
inputParameters.Attach(inputObserver);
- PipingInputContextProperties properties = new PipingInputContextProperties
+ var properties = new PipingInputContextProperties
{
Data = new PipingInputContext(inputParameters,
- calculationItem,
+ calculation,
Enumerable.Empty(),
Enumerable.Empty(),
failureMechanism,
@@ -1778,7 +1778,7 @@
setProperty(properties);
// Assert
- Assert.IsFalse(calculationItem.HasOutput);
+ Assert.IsFalse(calculation.HasOutput);
mocks.VerifyAll();
}
Index: Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/PresentationObjects/WaveConditionsInputContext.cs
===================================================================
diff -u -re182f6f394aa75e739467a77e7bcacd9a8b25429 -rbb80820ff4a4e09793da242cb7b36ca2bce59c32
--- Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/PresentationObjects/WaveConditionsInputContext.cs (.../WaveConditionsInputContext.cs) (revision e182f6f394aa75e739467a77e7bcacd9a8b25429)
+++ Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/PresentationObjects/WaveConditionsInputContext.cs (.../WaveConditionsInputContext.cs) (revision bb80820ff4a4e09793da242cb7b36ca2bce59c32)
@@ -22,6 +22,7 @@
using System;
using System.Collections.Generic;
using Core.Common.Controls.PresentationObjects;
+using Ringtoets.Common.Data.Calculation;
using Ringtoets.Common.Data.DikeProfiles;
using Ringtoets.Common.Data.Hydraulics;
using Ringtoets.Revetment.Data;
@@ -37,10 +38,20 @@
/// Initializes a new instance of the class.
///
/// The wrapped .
+ /// The calculation having as input.
/// Thrown when any input argument is null.
- protected WaveConditionsInputContext(WaveConditionsInput wrappedData)
- : base(wrappedData) {}
+ protected WaveConditionsInputContext(WaveConditionsInput wrappedData, ICalculation calculation)
+ : base(wrappedData)
+ {
+ if (calculation == null)
+ {
+ throw new ArgumentNullException("calculation");
+ }
+ Calculation = calculation;
+ }
+ public ICalculation Calculation { get; private set; }
+
///
/// Gets the hydraulic boundary locations.
///
Index: Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/PropertyClasses/WaveConditionsInputContextProperties.cs
===================================================================
diff -u -rac582bc093c8a275cd9b5dc2148af313b5242062 -rbb80820ff4a4e09793da242cb7b36ca2bce59c32
--- Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/PropertyClasses/WaveConditionsInputContextProperties.cs (.../WaveConditionsInputContextProperties.cs) (revision ac582bc093c8a275cd9b5dc2148af313b5242062)
+++ Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/PropertyClasses/WaveConditionsInputContextProperties.cs (.../WaveConditionsInputContextProperties.cs) (revision bb80820ff4a4e09793da242cb7b36ca2bce59c32)
@@ -232,8 +232,8 @@
get
{
return data.WrappedData.ForeshoreProfile == null ?
- new UseBreakWaterProperties(null) :
- new UseBreakWaterProperties(data.WrappedData);
+ new UseBreakWaterProperties() :
+ new UseBreakWaterProperties(data.WrappedData, data.Calculation);
}
}
Index: Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/PresentationObjects/WaveConditionsInputContextTest.cs
===================================================================
diff -u -re182f6f394aa75e739467a77e7bcacd9a8b25429 -rbb80820ff4a4e09793da242cb7b36ca2bce59c32
--- Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/PresentationObjects/WaveConditionsInputContextTest.cs (.../WaveConditionsInputContextTest.cs) (revision e182f6f394aa75e739467a77e7bcacd9a8b25429)
+++ Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/PresentationObjects/WaveConditionsInputContextTest.cs (.../WaveConditionsInputContextTest.cs) (revision bb80820ff4a4e09793da242cb7b36ca2bce59c32)
@@ -25,6 +25,7 @@
using NUnit.Framework;
using Ringtoets.Common.Data.DikeProfiles;
using Ringtoets.Common.Data.Hydraulics;
+using Ringtoets.Common.Forms.TestUtil;
using Ringtoets.Revetment.Data;
using Ringtoets.Revetment.Forms.PresentationObjects;
@@ -61,7 +62,7 @@
private class TestWaveConditionsInputContext : WaveConditionsInputContext
{
- public TestWaveConditionsInputContext(WaveConditionsInput wrappedData) : base(wrappedData) {}
+ public TestWaveConditionsInputContext(WaveConditionsInput wrappedData) : base(wrappedData, new TestCalculation()) {}
public override IEnumerable HydraulicBoundaryLocations
{
Index: Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/PropertyClasses/WaveConditionsInputContextPropertiesTest.cs
===================================================================
diff -u -rac582bc093c8a275cd9b5dc2148af313b5242062 -rbb80820ff4a4e09793da242cb7b36ca2bce59c32
--- Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/PropertyClasses/WaveConditionsInputContextPropertiesTest.cs (.../WaveConditionsInputContextPropertiesTest.cs) (revision ac582bc093c8a275cd9b5dc2148af313b5242062)
+++ Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/PropertyClasses/WaveConditionsInputContextPropertiesTest.cs (.../WaveConditionsInputContextPropertiesTest.cs) (revision bb80820ff4a4e09793da242cb7b36ca2bce59c32)
@@ -36,6 +36,7 @@
using Ringtoets.Common.Data.TestUtil;
using Ringtoets.Common.Forms.PresentationObjects;
using Ringtoets.Common.Forms.PropertyClasses;
+using Ringtoets.Common.Forms.TestUtil;
using Ringtoets.Common.Forms.UITypeEditors;
using Ringtoets.Revetment.Data;
using Ringtoets.Revetment.Forms.PresentationObjects;
@@ -557,7 +558,8 @@
public TestWaveConditionsInputContext(WaveConditionsInput wrappedData,
IEnumerable foreshoreProfiles,
- IEnumerable locations) : base(wrappedData)
+ IEnumerable locations)
+ : base(wrappedData, new TestCalculation())
{
this.foreshoreProfiles = foreshoreProfiles;
this.locations = locations;
Index: Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/Ringtoets.Revetment.Forms.Test.csproj
===================================================================
diff -u -r23d1e296e2da4364fbfe346e68d582dfcf966bb0 -rbb80820ff4a4e09793da242cb7b36ca2bce59c32
--- Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/Ringtoets.Revetment.Forms.Test.csproj (.../Ringtoets.Revetment.Forms.Test.csproj) (revision 23d1e296e2da4364fbfe346e68d582dfcf966bb0)
+++ Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/Ringtoets.Revetment.Forms.Test.csproj (.../Ringtoets.Revetment.Forms.Test.csproj) (revision bb80820ff4a4e09793da242cb7b36ca2bce59c32)
@@ -102,6 +102,10 @@
Ringtoets.Common.Data.TestUtil
True
+
+ {D24FA2F7-28A7-413B-AFD3-EE10E985630B}
+ Ringtoets.Common.Forms.TestUtil
+
{87C2C553-C0BC-40BF-B1EA-B83BFF357F27}
Ringtoets.Revetment.Data
Index: Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Forms/PresentationObjects/StabilityStoneCoverWaveConditionsInputContext.cs
===================================================================
diff -u -re182f6f394aa75e739467a77e7bcacd9a8b25429 -rbb80820ff4a4e09793da242cb7b36ca2bce59c32
--- Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Forms/PresentationObjects/StabilityStoneCoverWaveConditionsInputContext.cs (.../StabilityStoneCoverWaveConditionsInputContext.cs) (revision e182f6f394aa75e739467a77e7bcacd9a8b25429)
+++ Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Forms/PresentationObjects/StabilityStoneCoverWaveConditionsInputContext.cs (.../StabilityStoneCoverWaveConditionsInputContext.cs) (revision bb80820ff4a4e09793da242cb7b36ca2bce59c32)
@@ -23,6 +23,7 @@
using System.Collections.Generic;
using System.Linq;
using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.Calculation;
using Ringtoets.Common.Data.DikeProfiles;
using Ringtoets.Common.Data.Hydraulics;
using Ringtoets.Revetment.Data;
@@ -43,12 +44,14 @@
/// Creates a new instance of .
///
/// The wrapped .>
+ /// The calculation having as input.
/// The foreshore profiles of the .
/// The assessment section which the context belongs to.
/// Thrown when any parameter is null.
public StabilityStoneCoverWaveConditionsInputContext(WaveConditionsInput wrappedData,
+ ICalculation calculation,
IEnumerable foreshoreProfiles,
- IAssessmentSection assessmentSection) : base(wrappedData)
+ IAssessmentSection assessmentSection) : base(wrappedData, calculation)
{
if (foreshoreProfiles == null)
{
Index: Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Plugin/StabilityStoneCoverPlugin.cs
===================================================================
diff -u -r776a298963156bcb675a4f1dab0140ca8d34578e -rbb80820ff4a4e09793da242cb7b36ca2bce59c32
--- Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Plugin/StabilityStoneCoverPlugin.cs (.../StabilityStoneCoverPlugin.cs) (revision 776a298963156bcb675a4f1dab0140ca8d34578e)
+++ Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Plugin/StabilityStoneCoverPlugin.cs (.../StabilityStoneCoverPlugin.cs) (revision bb80820ff4a4e09793da242cb7b36ca2bce59c32)
@@ -494,6 +494,7 @@
{
context.WrappedData.Comments,
new StabilityStoneCoverWaveConditionsInputContext(context.WrappedData.InputParameters,
+ context.WrappedData,
context.FailureMechanism.ForeshoreProfiles,
context.AssessmentSection)
};
Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/PresentationObjects/StabilityStoneCoverWaveConditionsInputContextTest.cs
===================================================================
diff -u -re182f6f394aa75e739467a77e7bcacd9a8b25429 -rbb80820ff4a4e09793da242cb7b36ca2bce59c32
--- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/PresentationObjects/StabilityStoneCoverWaveConditionsInputContextTest.cs (.../StabilityStoneCoverWaveConditionsInputContextTest.cs) (revision e182f6f394aa75e739467a77e7bcacd9a8b25429)
+++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/PresentationObjects/StabilityStoneCoverWaveConditionsInputContextTest.cs (.../StabilityStoneCoverWaveConditionsInputContextTest.cs) (revision bb80820ff4a4e09793da242cb7b36ca2bce59c32)
@@ -28,6 +28,7 @@
using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.Data.DikeProfiles;
using Ringtoets.Common.Data.Hydraulics;
+using Ringtoets.Common.Forms.TestUtil;
using Ringtoets.Revetment.Data;
using Ringtoets.Revetment.Forms.PresentationObjects;
using Ringtoets.StabilityStoneCover.Data;
@@ -67,16 +68,18 @@
}
};
- var input = new WaveConditionsInput();
+ var calculation = new StabilityStoneCoverWaveConditionsCalculation();
// Call
- var context = new StabilityStoneCoverWaveConditionsInputContext(input,
- failureMechanism.ForeshoreProfiles,
- assessmentSection);
+ var context = new StabilityStoneCoverWaveConditionsInputContext(
+ calculation.InputParameters,
+ calculation,
+ failureMechanism.ForeshoreProfiles,
+ assessmentSection);
// Assert
Assert.IsInstanceOf(context);
- Assert.AreEqual(input, context.WrappedData);
+ Assert.AreEqual(calculation.InputParameters, context.WrappedData);
CollectionAssert.AreEqual(failureMechanism.ForeshoreProfiles, context.ForeshoreProfiles);
CollectionAssert.AreEqual(hydraulicBoundaryDatabase.Locations, context.HydraulicBoundaryLocations);
mocks.VerifyAll();
@@ -93,9 +96,11 @@
var failureMechanism = new StabilityStoneCoverFailureMechanism();
// Call
- TestDelegate test = () => new StabilityStoneCoverWaveConditionsInputContext(null,
- failureMechanism.ForeshoreProfiles,
- assessmentSection);
+ TestDelegate test = () => new StabilityStoneCoverWaveConditionsInputContext(
+ null,
+ null,
+ failureMechanism.ForeshoreProfiles,
+ assessmentSection);
// Assert
var exception = Assert.Throws(test);
@@ -114,9 +119,11 @@
var input = new WaveConditionsInput();
// Call
- TestDelegate test = () => new StabilityStoneCoverWaveConditionsInputContext(input,
- null,
- assessmentSection);
+ TestDelegate test = () => new StabilityStoneCoverWaveConditionsInputContext(
+ input,
+ new TestCalculation(),
+ null,
+ assessmentSection);
// Assert
var exception = Assert.Throws(test);
@@ -125,17 +132,45 @@
}
[Test]
+ public void Constructor_CalculationNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var input = new WaveConditionsInput();
+ var failureMechanism = new StabilityStoneCoverFailureMechanism();
+
+ // Call
+
+ TestDelegate test = () => new StabilityStoneCoverWaveConditionsInputContext(
+ input,
+ null,
+ failureMechanism.ForeshoreProfiles,
+ assessmentSection);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("calculation", exception.ParamName);
+ mocks.VerifyAll();
+ }
+
+ [Test]
public void Constructor_AssessmentSectionNull_ThrowsArgumentNullException()
{
// Setup
var input = new WaveConditionsInput();
var failureMechanism = new StabilityStoneCoverFailureMechanism();
// Call
- TestDelegate test = () => new StabilityStoneCoverWaveConditionsInputContext(input,
- failureMechanism.ForeshoreProfiles,
- null);
+ TestDelegate test = () => new StabilityStoneCoverWaveConditionsInputContext(
+ input,
+ new TestCalculation(),
+ failureMechanism.ForeshoreProfiles,
+ null);
+
// Assert
var exception = Assert.Throws(test);
Assert.AreEqual("assessmentSection", exception.ParamName);
@@ -152,7 +187,11 @@
var input = new WaveConditionsInput();
var failureMechanism = new StabilityStoneCoverFailureMechanism();
- var context = new StabilityStoneCoverWaveConditionsInputContext(input, failureMechanism.ForeshoreProfiles, assessmentSection);
+ var context = new StabilityStoneCoverWaveConditionsInputContext(
+ input,
+ new TestCalculation(),
+ failureMechanism.ForeshoreProfiles,
+ assessmentSection);
// Call
IEnumerable locations = context.HydraulicBoundaryLocations;
Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/PropertyClasses/StabilityStoneCoverWaveConditionsInputContextPropertiesTest.cs
===================================================================
diff -u -rac582bc093c8a275cd9b5dc2148af313b5242062 -rbb80820ff4a4e09793da242cb7b36ca2bce59c32
--- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/PropertyClasses/StabilityStoneCoverWaveConditionsInputContextPropertiesTest.cs (.../StabilityStoneCoverWaveConditionsInputContextPropertiesTest.cs) (revision ac582bc093c8a275cd9b5dc2148af313b5242062)
+++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/PropertyClasses/StabilityStoneCoverWaveConditionsInputContextPropertiesTest.cs (.../StabilityStoneCoverWaveConditionsInputContextPropertiesTest.cs) (revision bb80820ff4a4e09793da242cb7b36ca2bce59c32)
@@ -83,11 +83,13 @@
var assessmentSection = mocks.Stub();
mocks.ReplayAll();
- var input = new WaveConditionsInput();
var failureMechanism = new StabilityStoneCoverFailureMechanism();
- var inputContext = new StabilityStoneCoverWaveConditionsInputContext(input,
- failureMechanism.ForeshoreProfiles,
- assessmentSection);
+ var calculation = new StabilityStoneCoverWaveConditionsCalculation();
+ var inputContext = new StabilityStoneCoverWaveConditionsInputContext(
+ calculation.InputParameters,
+ calculation,
+ failureMechanism.ForeshoreProfiles,
+ assessmentSection);
// Call
var properties = new StabilityStoneCoverWaveConditionsInputContextProperties
@@ -108,7 +110,7 @@
Assert.IsNaN(properties.LowerBoundaryWaterLevels.Value);
Assert.AreEqual(2, properties.LowerBoundaryWaterLevels.NumberOfDecimalPlaces);
Assert.AreEqual(0.5, properties.StepSize.AsValue());
- CollectionAssert.AreEqual(input.WaterLevels, properties.WaterLevels);
+ CollectionAssert.AreEqual(calculation.InputParameters.WaterLevels, properties.WaterLevels);
Assert.IsNull(properties.ForeshoreProfile);
Assert.IsNull(properties.WorldReferencePoint);
@@ -163,23 +165,24 @@
}
};
- var input = new WaveConditionsInput()
- {
- ForeshoreProfile = foreshoreProfile,
- HydraulicBoundaryLocation = hydraulicBoundaryLocation,
- UpperBoundaryRevetment = upperBoundaryRevetment,
- LowerBoundaryRevetment = lowerBoundaryRevetment,
- UpperBoundaryWaterLevels = upperBoundaryWaterLevels,
- LowerBoundaryWaterLevels = lowerBoundaryWaterLevels,
- StepSize = stepSize
- };
+ var calculation = new StabilityStoneCoverWaveConditionsCalculation();
+ var input = calculation.InputParameters;
+ input.ForeshoreProfile = foreshoreProfile;
+ input.HydraulicBoundaryLocation = hydraulicBoundaryLocation;
+ input.UpperBoundaryRevetment = upperBoundaryRevetment;
+ input.LowerBoundaryRevetment = lowerBoundaryRevetment;
+ input.UpperBoundaryWaterLevels = upperBoundaryWaterLevels;
+ input.LowerBoundaryWaterLevels = lowerBoundaryWaterLevels;
+ input.StepSize = stepSize;
var failureMechanism = new StabilityStoneCoverFailureMechanism();
failureMechanism.ForeshoreProfiles.Add(foreshoreProfile);
- var inputContext = new StabilityStoneCoverWaveConditionsInputContext(input,
- failureMechanism.ForeshoreProfiles,
- assessmentSection);
+ var inputContext = new StabilityStoneCoverWaveConditionsInputContext(
+ calculation.InputParameters,
+ calculation,
+ failureMechanism.ForeshoreProfiles,
+ assessmentSection);
// Call
var properties = new StabilityStoneCoverWaveConditionsInputContextProperties
@@ -235,14 +238,17 @@
}
};
- var input = new WaveConditionsInput();
+ var calculation = new StabilityStoneCoverWaveConditionsCalculation();
+ var input = calculation.InputParameters;
input.Attach(observerMock);
var failureMechanism = new StabilityStoneCoverFailureMechanism();
- var inputContext = new StabilityStoneCoverWaveConditionsInputContext(input,
- failureMechanism.ForeshoreProfiles,
- assessmentSection);
+ var inputContext = new StabilityStoneCoverWaveConditionsInputContext(
+ input,
+ calculation,
+ failureMechanism.ForeshoreProfiles,
+ assessmentSection);
var newForeshoreProfile = new ForeshoreProfile(
new Point2D(
@@ -295,7 +301,8 @@
var assessmentSection = mocks.Stub();
mocks.ReplayAll();
- var input = new WaveConditionsInput();
+ var calculation = new StabilityStoneCoverWaveConditionsCalculation();
+ var input = calculation.InputParameters;
var foreshoreProfile = new ForeshoreProfile(
new Point2D(0, 0),
Enumerable.Empty(),
@@ -309,7 +316,11 @@
var failureMechanism = new StabilityStoneCoverFailureMechanism();
- var inputContext = new StabilityStoneCoverWaveConditionsInputContext(input, failureMechanism.ForeshoreProfiles, assessmentSection);
+ var inputContext = new StabilityStoneCoverWaveConditionsInputContext(
+ input,
+ calculation,
+ failureMechanism.ForeshoreProfiles,
+ assessmentSection);
// Call
var properties = new StabilityStoneCoverWaveConditionsInputContextProperties
Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/TreeNodeInfos/StabilityStoneCoverWaveConditionsInputContextTreeNodeInfoTest.cs
===================================================================
diff -u -r2d006ceaaef282af15090fe5505ffeca58a291e0 -rbb80820ff4a4e09793da242cb7b36ca2bce59c32
--- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/TreeNodeInfos/StabilityStoneCoverWaveConditionsInputContextTreeNodeInfoTest.cs (.../StabilityStoneCoverWaveConditionsInputContextTreeNodeInfoTest.cs) (revision 2d006ceaaef282af15090fe5505ffeca58a291e0)
+++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/TreeNodeInfos/StabilityStoneCoverWaveConditionsInputContextTreeNodeInfoTest.cs (.../StabilityStoneCoverWaveConditionsInputContextTreeNodeInfoTest.cs) (revision bb80820ff4a4e09793da242cb7b36ca2bce59c32)
@@ -87,8 +87,12 @@
var failureMechanism = new StabilityStoneCoverFailureMechanism();
- var input = new WaveConditionsInput();
- var context = new StabilityStoneCoverWaveConditionsInputContext(input, failureMechanism.ForeshoreProfiles, assessmentSection);
+ var calculation = new StabilityStoneCoverWaveConditionsCalculation();
+ var context = new StabilityStoneCoverWaveConditionsInputContext(
+ calculation.InputParameters,
+ calculation,
+ failureMechanism.ForeshoreProfiles,
+ assessmentSection);
using (var plugin = new StabilityStoneCoverPlugin())
{
@@ -111,8 +115,12 @@
var failureMechanism = new StabilityStoneCoverFailureMechanism();
- var input = new WaveConditionsInput();
- var context = new StabilityStoneCoverWaveConditionsInputContext(input, failureMechanism.ForeshoreProfiles, assessmentSection);
+ var calculation = new StabilityStoneCoverWaveConditionsCalculation();
+ var context = new StabilityStoneCoverWaveConditionsInputContext(
+ calculation.InputParameters,
+ calculation,
+ failureMechanism.ForeshoreProfiles,
+ assessmentSection);
using (var plugin = new StabilityStoneCoverPlugin())
{
@@ -136,8 +144,12 @@
var failureMechanism = new StabilityStoneCoverFailureMechanism();
- var input = new WaveConditionsInput();
- var context = new StabilityStoneCoverWaveConditionsInputContext(input, failureMechanism.ForeshoreProfiles, assessmentSection);
+ var calculation = new StabilityStoneCoverWaveConditionsCalculation();
+ var context = new StabilityStoneCoverWaveConditionsInputContext(
+ calculation.InputParameters,
+ calculation,
+ failureMechanism.ForeshoreProfiles,
+ assessmentSection);
var menuBuilder = mocks.StrictMock();
menuBuilder.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilder);
Index: Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Forms/PresentationObjects/WaveImpactAsphaltCoverWaveConditionsInputContext.cs
===================================================================
diff -u -re182f6f394aa75e739467a77e7bcacd9a8b25429 -rbb80820ff4a4e09793da242cb7b36ca2bce59c32
--- Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Forms/PresentationObjects/WaveImpactAsphaltCoverWaveConditionsInputContext.cs (.../WaveImpactAsphaltCoverWaveConditionsInputContext.cs) (revision e182f6f394aa75e739467a77e7bcacd9a8b25429)
+++ Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Forms/PresentationObjects/WaveImpactAsphaltCoverWaveConditionsInputContext.cs (.../WaveImpactAsphaltCoverWaveConditionsInputContext.cs) (revision bb80820ff4a4e09793da242cb7b36ca2bce59c32)
@@ -23,6 +23,7 @@
using System.Collections.Generic;
using System.Linq;
using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.Calculation;
using Ringtoets.Common.Data.DikeProfiles;
using Ringtoets.Common.Data.Hydraulics;
using Ringtoets.Revetment.Data;
@@ -41,14 +42,16 @@
///
/// Creates a new instance of .
///
- /// The wrapped .>
+ /// The wrapped .
+ /// The calculation having as input.
/// The foreshore profiles of the .
/// The assessment section which the context belongs to.
/// Thrown when any parameter is null.
public WaveImpactAsphaltCoverWaveConditionsInputContext(WaveConditionsInput wrappedData,
+ ICalculation calculation,
IEnumerable foreshoreProfiles,
IAssessmentSection assessmentSection)
- : base(wrappedData)
+ : base(wrappedData, calculation)
{
if (foreshoreProfiles == null)
{
Index: Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Plugin/WaveImpactAsphaltCoverPlugin.cs
===================================================================
diff -u -r3b65372a8a5857f063459b759650cb5c76dca16b -rbb80820ff4a4e09793da242cb7b36ca2bce59c32
--- Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Plugin/WaveImpactAsphaltCoverPlugin.cs (.../WaveImpactAsphaltCoverPlugin.cs) (revision 3b65372a8a5857f063459b759650cb5c76dca16b)
+++ Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Plugin/WaveImpactAsphaltCoverPlugin.cs (.../WaveImpactAsphaltCoverPlugin.cs) (revision bb80820ff4a4e09793da242cb7b36ca2bce59c32)
@@ -502,6 +502,7 @@
{
context.WrappedData.Comments,
new WaveImpactAsphaltCoverWaveConditionsInputContext(context.WrappedData.InputParameters,
+ context.WrappedData,
context.FailureMechanism.ForeshoreProfiles,
context.AssessmentSection)
};
Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/PresentationObjects/WaveImpactAsphaltCoverWaveConditionsInputContextTest.cs
===================================================================
diff -u -re182f6f394aa75e739467a77e7bcacd9a8b25429 -rbb80820ff4a4e09793da242cb7b36ca2bce59c32
--- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/PresentationObjects/WaveImpactAsphaltCoverWaveConditionsInputContextTest.cs (.../WaveImpactAsphaltCoverWaveConditionsInputContextTest.cs) (revision e182f6f394aa75e739467a77e7bcacd9a8b25429)
+++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/PresentationObjects/WaveImpactAsphaltCoverWaveConditionsInputContextTest.cs (.../WaveImpactAsphaltCoverWaveConditionsInputContextTest.cs) (revision bb80820ff4a4e09793da242cb7b36ca2bce59c32)
@@ -28,6 +28,7 @@
using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.Data.DikeProfiles;
using Ringtoets.Common.Data.Hydraulics;
+using Ringtoets.Common.Forms.TestUtil;
using Ringtoets.Revetment.Data;
using Ringtoets.Revetment.Forms.PresentationObjects;
using Ringtoets.WaveImpactAsphaltCover.Data;
@@ -67,16 +68,18 @@
}
};
- var input = new WaveConditionsInput();
+ var calculation = new WaveImpactAsphaltCoverWaveConditionsCalculation();
// Call
- var context = new WaveImpactAsphaltCoverWaveConditionsInputContext(input,
- failureMechanism.ForeshoreProfiles,
- assessmentSection);
+ var context = new WaveImpactAsphaltCoverWaveConditionsInputContext(
+ calculation.InputParameters,
+ calculation,
+ failureMechanism.ForeshoreProfiles,
+ assessmentSection);
// Assert
Assert.IsInstanceOf(context);
- Assert.AreEqual(input, context.WrappedData);
+ Assert.AreEqual(calculation.InputParameters, context.WrappedData);
CollectionAssert.AreEqual(failureMechanism.ForeshoreProfiles, context.ForeshoreProfiles);
CollectionAssert.AreEqual(hydraulicBoundaryDatabase.Locations, context.HydraulicBoundaryLocations);
mocks.VerifyAll();
@@ -93,9 +96,11 @@
var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
// Call
- TestDelegate test = () => new WaveImpactAsphaltCoverWaveConditionsInputContext(null,
- failureMechanism.ForeshoreProfiles,
- assessmentSection);
+ TestDelegate test = () => new WaveImpactAsphaltCoverWaveConditionsInputContext(
+ null,
+ new TestCalculation(),
+ failureMechanism.ForeshoreProfiles,
+ assessmentSection);
// Assert
var exception = Assert.Throws(test);
@@ -104,6 +109,28 @@
}
[Test]
+ public void HydraulicBoundaryLocations_CalculationNull_ReturnEmptyCollection()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var input = new WaveConditionsInput();
+ var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
+
+ TestDelegate test = () => new WaveImpactAsphaltCoverWaveConditionsInputContext(
+ input,
+ null,
+ failureMechanism.ForeshoreProfiles,
+ assessmentSection);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("calculation", exception.ParamName);
+ }
+
+ [Test]
public void Constructor_ForeshoreProfilesNull_ThrowsArgumentNullException()
{
// Setup
@@ -114,9 +141,11 @@
var input = new WaveConditionsInput();
// Call
- TestDelegate test = () => new WaveImpactAsphaltCoverWaveConditionsInputContext(input,
- null,
- assessmentSection);
+ TestDelegate test = () => new WaveImpactAsphaltCoverWaveConditionsInputContext(
+ input,
+ new TestCalculation(),
+ null,
+ assessmentSection);
// Assert
var exception = Assert.Throws(test);
@@ -132,9 +161,11 @@
var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
// Call
- TestDelegate test = () => new WaveImpactAsphaltCoverWaveConditionsInputContext(input,
- failureMechanism.ForeshoreProfiles,
- null);
+ TestDelegate test = () => new WaveImpactAsphaltCoverWaveConditionsInputContext(
+ input,
+ new TestCalculation(),
+ failureMechanism.ForeshoreProfiles,
+ null);
// Assert
var exception = Assert.Throws(test);
@@ -152,7 +183,11 @@
var input = new WaveConditionsInput();
var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
- var context = new WaveImpactAsphaltCoverWaveConditionsInputContext(input, failureMechanism.ForeshoreProfiles, assessmentSection);
+ var context = new WaveImpactAsphaltCoverWaveConditionsInputContext(
+ input,
+ new TestCalculation(),
+ failureMechanism.ForeshoreProfiles,
+ assessmentSection);
// Call
IEnumerable locations = context.HydraulicBoundaryLocations;
Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/PropertyClasses/WaveImpactAsphaltCoverWaveConditionsInputContextPropertiesTest.cs
===================================================================
diff -u -rac582bc093c8a275cd9b5dc2148af313b5242062 -rbb80820ff4a4e09793da242cb7b36ca2bce59c32
--- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/PropertyClasses/WaveImpactAsphaltCoverWaveConditionsInputContextPropertiesTest.cs (.../WaveImpactAsphaltCoverWaveConditionsInputContextPropertiesTest.cs) (revision ac582bc093c8a275cd9b5dc2148af313b5242062)
+++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/PropertyClasses/WaveImpactAsphaltCoverWaveConditionsInputContextPropertiesTest.cs (.../WaveImpactAsphaltCoverWaveConditionsInputContextPropertiesTest.cs) (revision bb80820ff4a4e09793da242cb7b36ca2bce59c32)
@@ -83,11 +83,13 @@
var assessmentSection = mocks.Stub();
mocks.ReplayAll();
- var input = new WaveConditionsInput();
var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
- var inputContext = new WaveImpactAsphaltCoverWaveConditionsInputContext(input,
- failureMechanism.ForeshoreProfiles,
- assessmentSection);
+ var calculation = new WaveImpactAsphaltCoverWaveConditionsCalculation();
+ var inputContext = new WaveImpactAsphaltCoverWaveConditionsInputContext(
+ calculation.InputParameters,
+ calculation,
+ failureMechanism.ForeshoreProfiles,
+ assessmentSection);
// Call
var properties = new WaveImpactAsphaltCoverWaveConditionsInputContextProperties
@@ -108,7 +110,7 @@
Assert.IsNaN(properties.LowerBoundaryWaterLevels.Value);
Assert.AreEqual(2, properties.LowerBoundaryWaterLevels.NumberOfDecimalPlaces);
Assert.AreEqual(0.5, properties.StepSize.AsValue());
- CollectionAssert.AreEqual(input.WaterLevels, properties.WaterLevels);
+ CollectionAssert.AreEqual(calculation.InputParameters.WaterLevels, properties.WaterLevels);
Assert.IsNull(properties.ForeshoreProfile);
Assert.IsNull(properties.WorldReferencePoint);
@@ -161,24 +163,26 @@
}
};
- var input = new WaveConditionsInput()
- {
- 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);
+ var calculation = new WaveImpactAsphaltCoverWaveConditionsCalculation();
+ var input = calculation.InputParameters;
+ input.ForeshoreProfile = foreshoreProfile;
+ input.HydraulicBoundaryLocation = hydraulicBoundaryLocation;
+ input.UpperBoundaryRevetment = upperBoundaryRevetment;
+ input.LowerBoundaryRevetment = lowerBoundaryRevetment;
+ input.UpperBoundaryWaterLevels = upperBoundaryWaterLevels;
+ input.LowerBoundaryWaterLevels = lowerBoundaryWaterLevels;
+ input.StepSize = stepSize;
+ var inputContext = new WaveImpactAsphaltCoverWaveConditionsInputContext(
+ calculation.InputParameters,
+ calculation,
+ failureMechanism.ForeshoreProfiles,
+ assessmentSection);
+
// Call
var properties = new WaveImpactAsphaltCoverWaveConditionsInputContextProperties
{
@@ -231,14 +235,17 @@
}
};
- var input = new WaveConditionsInput();
+ var calculation = new WaveImpactAsphaltCoverWaveConditionsCalculation();
+ var input = calculation.InputParameters;
input.Attach(observerMock);
var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
- var inputContext = new WaveImpactAsphaltCoverWaveConditionsInputContext(input,
- failureMechanism.ForeshoreProfiles,
- assessmentSection);
+ var inputContext = new WaveImpactAsphaltCoverWaveConditionsInputContext(
+ calculation.InputParameters,
+ calculation,
+ failureMechanism.ForeshoreProfiles,
+ assessmentSection);
var newForeshoreProfile = new ForeshoreProfile(
new Point2D(
@@ -305,7 +312,12 @@
var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
- var inputContext = new WaveImpactAsphaltCoverWaveConditionsInputContext(input, failureMechanism.ForeshoreProfiles, assessmentSection);
+ var calculation = new WaveImpactAsphaltCoverWaveConditionsCalculation();
+ var inputContext = new WaveImpactAsphaltCoverWaveConditionsInputContext(
+ calculation.InputParameters,
+ calculation,
+ failureMechanism.ForeshoreProfiles,
+ assessmentSection);
// Call
var properties = new WaveImpactAsphaltCoverWaveConditionsInputContextProperties
Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/TreeNodeInfos/WaveImpactAsphaltCoverWaveConditionsInputContextTreeNodeInfoTest.cs
===================================================================
diff -u -r2d006ceaaef282af15090fe5505ffeca58a291e0 -rbb80820ff4a4e09793da242cb7b36ca2bce59c32
--- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/TreeNodeInfos/WaveImpactAsphaltCoverWaveConditionsInputContextTreeNodeInfoTest.cs (.../WaveImpactAsphaltCoverWaveConditionsInputContextTreeNodeInfoTest.cs) (revision 2d006ceaaef282af15090fe5505ffeca58a291e0)
+++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/TreeNodeInfos/WaveImpactAsphaltCoverWaveConditionsInputContextTreeNodeInfoTest.cs (.../WaveImpactAsphaltCoverWaveConditionsInputContextTreeNodeInfoTest.cs) (revision bb80820ff4a4e09793da242cb7b36ca2bce59c32)
@@ -87,8 +87,12 @@
var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
- var input = new WaveConditionsInput();
- var context = new WaveImpactAsphaltCoverWaveConditionsInputContext(input, failureMechanism.ForeshoreProfiles, assessmentSection);
+ var calculation = new WaveImpactAsphaltCoverWaveConditionsCalculation();
+ var context = new WaveImpactAsphaltCoverWaveConditionsInputContext(
+ calculation.InputParameters,
+ calculation,
+ failureMechanism.ForeshoreProfiles,
+ assessmentSection);
using (var plugin = new WaveImpactAsphaltCoverPlugin())
{
@@ -110,10 +114,14 @@
mocks.ReplayAll();
var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
+
+ var calculation = new WaveImpactAsphaltCoverWaveConditionsCalculation();
+ var context = new WaveImpactAsphaltCoverWaveConditionsInputContext(
+ calculation.InputParameters,
+ calculation,
+ failureMechanism.ForeshoreProfiles,
+ assessmentSection);
- var input = new WaveConditionsInput();
- var context = new WaveImpactAsphaltCoverWaveConditionsInputContext(input, failureMechanism.ForeshoreProfiles, assessmentSection);
-
using (var plugin = new WaveImpactAsphaltCoverPlugin())
{
var info = GetInfo(plugin);
@@ -136,8 +144,12 @@
var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
- var input = new WaveConditionsInput();
- var context = new WaveImpactAsphaltCoverWaveConditionsInputContext(input, failureMechanism.ForeshoreProfiles, assessmentSection);
+ var calculation = new WaveImpactAsphaltCoverWaveConditionsCalculation();
+ var context = new WaveImpactAsphaltCoverWaveConditionsInputContext(
+ calculation.InputParameters,
+ calculation,
+ failureMechanism.ForeshoreProfiles,
+ assessmentSection);
var menuBuilder = mocks.StrictMock();
menuBuilder.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilder);