Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PresentationObjects/GrassCoverErosionInwardsOutputContext.cs
===================================================================
diff -u -rc85c8d0d58146580a66d18b02f4004a033550b55 -ra6d909b9368f5596488c9852e16a9779e01dc0a7
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PresentationObjects/GrassCoverErosionInwardsOutputContext.cs (.../GrassCoverErosionInwardsOutputContext.cs) (revision c85c8d0d58146580a66d18b02f4004a033550b55)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PresentationObjects/GrassCoverErosionInwardsOutputContext.cs (.../GrassCoverErosionInwardsOutputContext.cs) (revision a6d909b9368f5596488c9852e16a9779e01dc0a7)
@@ -19,7 +19,9 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System;
using Core.Common.Controls.PresentationObjects;
+using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.GrassCoverErosionInwards.Data;
namespace Ringtoets.GrassCoverErosionInwards.Forms.PresentationObjects
@@ -33,6 +35,36 @@
/// Creates a new instance of .
///
/// The grass cover erosion inwards calculation wrapped by the context object.
- public GrassCoverErosionInwardsOutputContext(GrassCoverErosionInwardsCalculation wrappedData) : base(wrappedData) {}
+ /// The failure mechanism the calculation belongs to.
+ /// The assessment section the calculation belongs to.
+ /// Thrown when any parameter is null.
+ public GrassCoverErosionInwardsOutputContext(GrassCoverErosionInwardsCalculation wrappedData,
+ GrassCoverErosionInwardsFailureMechanism failureMechanism,
+ IAssessmentSection assessmentSection)
+ : base(wrappedData)
+ {
+ if (failureMechanism == null)
+ {
+ throw new ArgumentNullException(nameof(failureMechanism));
+ }
+
+ if (assessmentSection == null)
+ {
+ throw new ArgumentNullException(nameof(assessmentSection));
+ }
+
+ FailureMechanism = failureMechanism;
+ AssessmentSection = assessmentSection;
+ }
+
+ ///
+ /// Gets the failure mechanism.
+ ///
+ public GrassCoverErosionInwardsFailureMechanism FailureMechanism { get; }
+
+ ///
+ /// Gets the assessment section.
+ ///
+ public IAssessmentSection AssessmentSection { get; }
}
}
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsOutputProperties.cs
===================================================================
diff -u -rac96d7c315129af851634ed5a4a6800b59ede718 -ra6d909b9368f5596488c9852e16a9779e01dc0a7
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsOutputProperties.cs (.../GrassCoverErosionInwardsOutputProperties.cs) (revision ac96d7c315129af851634ed5a4a6800b59ede718)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsOutputProperties.cs (.../GrassCoverErosionInwardsOutputProperties.cs) (revision a6d909b9368f5596488c9852e16a9779e01dc0a7)
@@ -26,9 +26,12 @@
using Core.Common.Gui.PropertyBag;
using Core.Common.Util;
using Core.Common.Util.Attributes;
+using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.Data.Hydraulics;
+using Ringtoets.Common.Data.Probability;
using Ringtoets.Common.Forms.Helpers;
using Ringtoets.Common.Forms.TypeConverters;
+using Ringtoets.Common.Service;
using Ringtoets.GrassCoverErosionInwards.Data;
using Ringtoets.GrassCoverErosionInwards.Forms.Properties;
using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
@@ -40,19 +43,40 @@
///
public class GrassCoverErosionInwardsOutputProperties : ObjectProperties
{
+ private readonly ProbabilityAssessmentOutput derivedOvertoppingOutput;
+
///
/// Creates a new instance of .
///
/// The grass cover erosion inwards output to create the object properties for.
- /// Thrown when is null.
- public GrassCoverErosionInwardsOutputProperties(GrassCoverErosionInwardsOutput grassCoverErosionInwardsOutput)
+ /// The failure mechanism the output belongs to.
+ /// The assessment section the output belongs to.
+ /// Thrown when any parameter is null.
+ public GrassCoverErosionInwardsOutputProperties(GrassCoverErosionInwardsOutput grassCoverErosionInwardsOutput,
+ GrassCoverErosionInwardsFailureMechanism failureMechanism,
+ IAssessmentSection assessmentSection)
{
if (grassCoverErosionInwardsOutput == null)
{
throw new ArgumentNullException(nameof(grassCoverErosionInwardsOutput));
}
+ if (failureMechanism == null)
+ {
+ throw new ArgumentNullException(nameof(failureMechanism));
+ }
+
+ if (assessmentSection == null)
+ {
+ throw new ArgumentNullException(nameof(assessmentSection));
+ }
+
Data = grassCoverErosionInwardsOutput;
+
+ derivedOvertoppingOutput = ProbabilityAssessmentService.Calculate(assessmentSection.FailureMechanismContribution.Norm,
+ failureMechanism.Contribution,
+ failureMechanism.GeneralInput.N,
+ grassCoverErosionInwardsOutput.OvertoppingOutput.Reliability);
}
[DynamicVisibleValidationMethod]
@@ -73,7 +97,7 @@
{
get
{
- return ProbabilityFormattingHelper.Format(data.OvertoppingOutput.ProbabilityAssessmentOutput.RequiredProbability);
+ return ProbabilityFormattingHelper.Format(derivedOvertoppingOutput.RequiredProbability);
}
}
@@ -85,7 +109,7 @@
{
get
{
- return data.OvertoppingOutput.ProbabilityAssessmentOutput.RequiredReliability;
+ return derivedOvertoppingOutput.RequiredReliability;
}
}
@@ -97,7 +121,7 @@
{
get
{
- return ProbabilityFormattingHelper.Format(data.OvertoppingOutput.ProbabilityAssessmentOutput.Probability);
+ return ProbabilityFormattingHelper.Format(derivedOvertoppingOutput.Probability);
}
}
@@ -109,7 +133,7 @@
{
get
{
- return data.OvertoppingOutput.ProbabilityAssessmentOutput.Reliability;
+ return derivedOvertoppingOutput.Reliability;
}
}
@@ -121,7 +145,7 @@
{
get
{
- return data.OvertoppingOutput.ProbabilityAssessmentOutput.FactorOfSafety;
+ return derivedOvertoppingOutput.FactorOfSafety;
}
}
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Ringtoets.GrassCoverErosionInwards.Forms.csproj
===================================================================
diff -u -rfcad48d7beb394e1ac15cfe4289a7381e05aa883 -ra6d909b9368f5596488c9852e16a9779e01dc0a7
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Ringtoets.GrassCoverErosionInwards.Forms.csproj (.../Ringtoets.GrassCoverErosionInwards.Forms.csproj) (revision fcad48d7beb394e1ac15cfe4289a7381e05aa883)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Ringtoets.GrassCoverErosionInwards.Forms.csproj (.../Ringtoets.GrassCoverErosionInwards.Forms.csproj) (revision a6d909b9368f5596488c9852e16a9779e01dc0a7)
@@ -142,6 +142,11 @@
Ringtoets.Common.Forms
False
+
+ {D951D6DA-FE83-4920-9FDB-63BF96480B54}
+ Ringtoets.Common.Service
+ False
+
{90DE728E-48EF-4665-AB38-3D88E41D9F4D}
Ringtoets.GrassCoverErosionInwards.Data
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsPlugin.cs
===================================================================
diff -u -r3c832ffce74b527eb1d588aa722840f0a80330b7 -ra6d909b9368f5596488c9852e16a9779e01dc0a7
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsPlugin.cs (.../GrassCoverErosionInwardsPlugin.cs) (revision 3c832ffce74b527eb1d588aa722840f0a80330b7)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsPlugin.cs (.../GrassCoverErosionInwardsPlugin.cs) (revision a6d909b9368f5596488c9852e16a9779e01dc0a7)
@@ -87,7 +87,9 @@
};
yield return new PropertyInfo
{
- CreateInstance = context => new GrassCoverErosionInwardsOutputProperties(context.WrappedData.Output)
+ CreateInstance = context => new GrassCoverErosionInwardsOutputProperties(context.WrappedData.Output,
+ context.FailureMechanism,
+ context.AssessmentSection)
};
yield return new PropertyInfo
{
@@ -865,7 +867,9 @@
calculation,
context.FailureMechanism,
context.AssessmentSection),
- new GrassCoverErosionInwardsOutputContext(calculation)
+ new GrassCoverErosionInwardsOutputContext(calculation,
+ context.FailureMechanism,
+ context.AssessmentSection)
};
}
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PresentationObjects/GrassCoverErosionInwardsOutputContextTest.cs
===================================================================
diff -u -rc85c8d0d58146580a66d18b02f4004a033550b55 -ra6d909b9368f5596488c9852e16a9779e01dc0a7
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PresentationObjects/GrassCoverErosionInwardsOutputContextTest.cs (.../GrassCoverErosionInwardsOutputContextTest.cs) (revision c85c8d0d58146580a66d18b02f4004a033550b55)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PresentationObjects/GrassCoverErosionInwardsOutputContextTest.cs (.../GrassCoverErosionInwardsOutputContextTest.cs) (revision a6d909b9368f5596488c9852e16a9779e01dc0a7)
@@ -19,8 +19,11 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System;
using Core.Common.Controls.PresentationObjects;
using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.GrassCoverErosionInwards.Data;
using Ringtoets.GrassCoverErosionInwards.Forms.PresentationObjects;
@@ -30,17 +33,55 @@
public class GrassCoverErosionInwardsOutputContextTest
{
[Test]
- public void ParameteredConstructor_ExpectedValues()
+ public void Constructor_ExpectedValues()
{
// Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
var calculation = new GrassCoverErosionInwardsCalculation();
// Call
- var grassCoverErosionInwardsOutputContext = new GrassCoverErosionInwardsOutputContext(calculation);
+ var grassCoverErosionInwardsOutputContext = new GrassCoverErosionInwardsOutputContext(calculation, failureMechanism, assessmentSection);
// Assert
Assert.IsInstanceOf>(grassCoverErosionInwardsOutputContext);
Assert.AreSame(calculation, grassCoverErosionInwardsOutputContext.WrappedData);
+ Assert.AreSame(failureMechanism, grassCoverErosionInwardsOutputContext.FailureMechanism);
+ Assert.AreSame(assessmentSection, grassCoverErosionInwardsOutputContext.AssessmentSection);
+ mocks.VerifyAll();
}
+
+ [Test]
+ public void Constructror_FailureMechanismNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ // Call
+ TestDelegate call = () => new GrassCoverErosionInwardsOutputContext(new GrassCoverErosionInwardsCalculation(), null, assessmentSection);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("failureMechanism", exception.ParamName);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Constructor_AssessmentSectionNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => new GrassCoverErosionInwardsOutputContext(new GrassCoverErosionInwardsCalculation(),
+ new GrassCoverErosionInwardsFailureMechanism(),
+ null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("assessmentSection", exception.ParamName);
+ }
}
}
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsOutputPropertiesTest.cs
===================================================================
diff -u -r6306f61e82936c6bb6db70c4a185243cb07f00af -ra6d909b9368f5596488c9852e16a9779e01dc0a7
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsOutputPropertiesTest.cs (.../GrassCoverErosionInwardsOutputPropertiesTest.cs) (revision 6306f61e82936c6bb6db70c4a185243cb07f00af)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsOutputPropertiesTest.cs (.../GrassCoverErosionInwardsOutputPropertiesTest.cs) (revision a6d909b9368f5596488c9852e16a9779e01dc0a7)
@@ -25,6 +25,8 @@
using Core.Common.TestUtil;
using Core.Common.Util;
using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.Data.Hydraulics;
using Ringtoets.Common.Data.Probability;
using Ringtoets.Common.Data.TestUtil;
@@ -51,35 +53,82 @@
private const int secondHydraulicLoadsOutputIndex = 13;
[Test]
- public void Constructor_GrassCoverErosionInwardsOutput_ExpectedValues()
+ public void Constructor_ExpectedValues()
{
// Setup
+ var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
+
+ var mocks = new MockRepository();
+ IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
+
var grassCoverErosionInwardsOutput = new TestGrassCoverErosionInwardsOutput();
// Call
- var properties = new GrassCoverErosionInwardsOutputProperties(grassCoverErosionInwardsOutput);
+ var properties = new GrassCoverErosionInwardsOutputProperties(grassCoverErosionInwardsOutput, failureMechanism, assessmentSection);
// Assert
Assert.IsInstanceOf>(properties);
Assert.AreSame(grassCoverErosionInwardsOutput, properties.Data);
+ mocks.VerifyAll();
}
[Test]
public void Constructor_GrassCoverErosionInwardsOutputNull_ThrowsArgumentNullException()
{
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
// Call
- TestDelegate test = () => new GrassCoverErosionInwardsOutputProperties(null);
+ TestDelegate test = () => new GrassCoverErosionInwardsOutputProperties(null, new GrassCoverErosionInwardsFailureMechanism(), assessmentSection);
// Assert
var exception = Assert.Throws(test);
Assert.AreEqual("grassCoverErosionInwardsOutput", exception.ParamName);
+ mocks.VerifyAll();
}
[Test]
- public void Data_SetNewInputContextInstance_ReturnCorrectPropertyValues()
+ public void Constructor_FailureMechanismNull_ThrowsArgumentNullException()
{
// Setup
- var random = new Random();
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ // Call
+ TestDelegate test = () => new GrassCoverErosionInwardsOutputProperties(new TestGrassCoverErosionInwardsOutput(), null, assessmentSection);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("failureMechanism", exception.ParamName);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Constructor_AssessmentSectionNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate test = () => new GrassCoverErosionInwardsOutputProperties(new TestGrassCoverErosionInwardsOutput(),
+ new GrassCoverErosionInwardsFailureMechanism(),
+ null);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("assessmentSection", exception.ParamName);
+ }
+
+ [Test]
+ public void GetProperties_WithData_ReturnExpectedValues()
+ {
+ // Setup
+ var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
+
+ var mocks = new MockRepository();
+ IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
+
+ var random = new Random(39);
double waveHeight = random.NextDouble();
bool isOvertoppingDominant = Convert.ToBoolean(random.Next(0, 2));
double requiredProbability = random.NextDouble();
@@ -127,18 +176,18 @@
var output = new GrassCoverErosionInwardsOutput(resultOutput, dikeHeightOutput, overtoppingRateOutput);
// Call
- var properties = new GrassCoverErosionInwardsOutputProperties(output);
+ var properties = new GrassCoverErosionInwardsOutputProperties(output, failureMechanism, assessmentSection);
// Assert
Assert.AreEqual(2, properties.WaveHeight.NumberOfDecimalPlaces);
Assert.AreEqual(waveHeight, properties.WaveHeight, properties.WaveHeight.GetAccuracy());
Assert.AreEqual(reliability, properties.Reliability, properties.Reliability.GetAccuracy());
- Assert.AreEqual(requiredReliability, properties.RequiredReliability, properties.RequiredReliability.GetAccuracy());
+ Assert.AreEqual(double.PositiveInfinity, properties.RequiredReliability, properties.RequiredReliability.GetAccuracy());
Assert.AreEqual(3, properties.FactorOfSafety.NumberOfDecimalPlaces);
- Assert.AreEqual(factorOfSafety, properties.FactorOfSafety, properties.FactorOfSafety.GetAccuracy());
+ Assert.AreEqual(0, properties.FactorOfSafety, properties.FactorOfSafety.GetAccuracy());
- Assert.AreEqual(ProbabilityFormattingHelper.Format(requiredProbability), properties.RequiredProbability);
- Assert.AreEqual(ProbabilityFormattingHelper.Format(probability), properties.Probability);
+ Assert.AreEqual(ProbabilityFormattingHelper.Format(0), properties.RequiredProbability);
+ Assert.AreEqual(ProbabilityFormattingHelper.Format(0.25), properties.Probability);
Assert.AreEqual(isOvertoppingDominant, properties.IsOvertoppingDominant);
@@ -177,12 +226,19 @@
string overtoppingRateConvergenceValue = new EnumDisplayWrapper(overtoppingRateConvergence).DisplayName;
Assert.AreEqual(overtoppingRateConvergenceValue, properties.OvertoppingRateConvergence);
+ mocks.VerifyAll();
}
[Test]
public void PropertyAttributes_WithDikeHeightAndOvertoppingRateCalculated_ReturnExpectedValues()
{
// Setup
+ var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
+
+ var mocks = new MockRepository();
+ IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
+ mocks.ReplayAll();
+
var probabilityAssessmentOutput = new TestProbabilityAssessmentOutput();
var resultOutput = new OvertoppingOutput(10,
true,
@@ -197,7 +253,7 @@
overtoppingRateOutput);
// Call
- var properties = new GrassCoverErosionInwardsOutputProperties(output);
+ var properties = new GrassCoverErosionInwardsOutputProperties(output, failureMechanism, assessmentSection);
// Assert
PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);
@@ -206,6 +262,7 @@
AssertResultOutputProperties(dynamicProperties);
AssertDikeHeightOutputProperties(dynamicProperties, firstHydraulicLoadsOutputIndex);
AssertOvertoppingRateOutputProperties(dynamicProperties, secondHydraulicLoadsOutputIndex);
+ mocks.VerifyAll();
}
[Test]
@@ -215,6 +272,12 @@
bool overtoppingRateCalculated)
{
// Setup
+ var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
+
+ var mocks = new MockRepository();
+ IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
+ mocks.ReplayAll();
+
var probabilityAssessmentOutput = new TestProbabilityAssessmentOutput();
DikeHeightOutput dikeHeightOutput = null;
OvertoppingRateOutput overtoppingRateOutput = null;
@@ -240,7 +303,7 @@
overtoppingRateOutput);
// Call
- var properties = new GrassCoverErosionInwardsOutputProperties(output);
+ var properties = new GrassCoverErosionInwardsOutputProperties(output, failureMechanism, assessmentSection);
// Assert
PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);
@@ -257,6 +320,7 @@
{
AssertOvertoppingRateOutputProperties(dynamicProperties, firstHydraulicLoadsOutputIndex);
}
+ mocks.VerifyAll();
}
[Test]
@@ -265,6 +329,12 @@
public void PropertyAttributes_WithoutDikeHeightAndOvertoppingRateCalculated_ReturnExpectedValues(double waveHeight)
{
// Setup
+ var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
+
+ var mocks = new MockRepository();
+ IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
+ mocks.ReplayAll();
+
var probabilityAssessmentOutput = new TestProbabilityAssessmentOutput();
var resultOutput = new OvertoppingOutput(waveHeight,
true,
@@ -275,7 +345,7 @@
var output = new GrassCoverErosionInwardsOutput(resultOutput, null, null);
// Call
- var properties = new GrassCoverErosionInwardsOutputProperties(output);
+ var properties = new GrassCoverErosionInwardsOutputProperties(output, failureMechanism, assessmentSection);
// Assert
int propertiesCount = double.IsNaN(waveHeight) ? 6 : 7;
@@ -284,6 +354,7 @@
Assert.AreEqual(propertiesCount, dynamicProperties.Count);
AssertResultOutputProperties(dynamicProperties, !double.IsNaN(waveHeight));
+ mocks.VerifyAll();
}
private static void AssertResultOutputProperties(PropertyDescriptorCollection dynamicProperties, bool waveHeightCalculated = true)
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/PropertyInfos/GrassCoverErosionInwardsOutputContextPropertyInfoTest.cs
===================================================================
diff -u -r30713c4473d8e1815ac69cb6e84dc448abffee40 -ra6d909b9368f5596488c9852e16a9779e01dc0a7
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/PropertyInfos/GrassCoverErosionInwardsOutputContextPropertyInfoTest.cs (.../GrassCoverErosionInwardsOutputContextPropertyInfoTest.cs) (revision 30713c4473d8e1815ac69cb6e84dc448abffee40)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/PropertyInfos/GrassCoverErosionInwardsOutputContextPropertyInfoTest.cs (.../GrassCoverErosionInwardsOutputContextPropertyInfoTest.cs) (revision a6d909b9368f5596488c9852e16a9779e01dc0a7)
@@ -23,6 +23,9 @@
using Core.Common.Gui.Plugin;
using Core.Common.Gui.PropertyBag;
using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.TestUtil;
using Ringtoets.GrassCoverErosionInwards.Data;
using Ringtoets.GrassCoverErosionInwards.Data.TestUtil;
using Ringtoets.GrassCoverErosionInwards.Forms.PresentationObjects;
@@ -61,18 +64,24 @@
public void CreateInstance_Always_NewPropertiesWithData()
{
// Setup
+ var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
+
+ var mocks = new MockRepository();
+ IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
+
var output = new TestGrassCoverErosionInwardsOutput();
var calculation = new GrassCoverErosionInwardsCalculation
{
Output = output
};
// Call
- IObjectProperties objectProperties = info.CreateInstance(new GrassCoverErosionInwardsOutputContext(calculation));
+ IObjectProperties objectProperties = info.CreateInstance(new GrassCoverErosionInwardsOutputContext(calculation, failureMechanism, assessmentSection));
// Assert
Assert.IsInstanceOf(objectProperties);
Assert.AreSame(output, objectProperties.Data);
+ mocks.VerifyAll();
}
}
}
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionInwardsOutputContextTreeNodeInfoTest.cs
===================================================================
diff -u -r3178e116f5e59e03078d465efeb303c5e232c7bf -ra6d909b9368f5596488c9852e16a9779e01dc0a7
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionInwardsOutputContextTreeNodeInfoTest.cs (.../GrassCoverErosionInwardsOutputContextTreeNodeInfoTest.cs) (revision 3178e116f5e59e03078d465efeb303c5e232c7bf)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionInwardsOutputContextTreeNodeInfoTest.cs (.../GrassCoverErosionInwardsOutputContextTreeNodeInfoTest.cs) (revision a6d909b9368f5596488c9852e16a9779e01dc0a7)
@@ -27,6 +27,7 @@
using Core.Common.TestUtil;
using NUnit.Framework;
using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.GrassCoverErosionInwards.Data;
using Ringtoets.GrassCoverErosionInwards.Data.TestUtil;
using Ringtoets.GrassCoverErosionInwards.Forms.PresentationObjects;
@@ -90,24 +91,42 @@
[Test]
public void ForeColor_HasNoOutput_ReturnGrayText()
{
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
+
// Call
- Color color = info.ForeColor(new GrassCoverErosionInwardsOutputContext(new GrassCoverErosionInwardsCalculation()));
+ Color color = info.ForeColor(new GrassCoverErosionInwardsOutputContext(new GrassCoverErosionInwardsCalculation(),
+ failureMechanism,
+ assessmentSection));
// Assert
Assert.AreEqual(Color.FromKnownColor(KnownColor.GrayText), color);
+ mocks.VerifyAll();
}
[Test]
public void ForeColor_HasOutput_ReturnControlText()
{
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
+
// Call
Color color = info.ForeColor(new GrassCoverErosionInwardsOutputContext(new GrassCoverErosionInwardsCalculation
{
Output = new TestGrassCoverErosionInwardsOutput()
- }));
+ }, failureMechanism, assessmentSection));
// Assert
Assert.AreEqual(Color.FromKnownColor(KnownColor.ControlText), color);
+ mocks.VerifyAll();
}
[Test]
@@ -126,11 +145,19 @@
public void ChildNodeObjects_Always_ReturnsCollectionWithOutputObjects(bool hasOutput)
{
// Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
+
var grassCoverErosionInwardsCalculation = new GrassCoverErosionInwardsCalculation
{
Output = hasOutput ? new TestGrassCoverErosionInwardsOutput() : null
};
- var grassCoverErosionInwardsOutputContext = new GrassCoverErosionInwardsOutputContext(grassCoverErosionInwardsCalculation);
+ var grassCoverErosionInwardsOutputContext = new GrassCoverErosionInwardsOutputContext(grassCoverErosionInwardsCalculation,
+ failureMechanism,
+ assessmentSection);
// Call
object[] children = info.ChildNodeObjects(grassCoverErosionInwardsOutputContext).ToArray();
@@ -149,6 +176,7 @@
var overtoppingRateOutputContext = children[2] as OvertoppingRateOutputContext;
Assert.IsNotNull(overtoppingRateOutputContext);
Assert.AreSame(grassCoverErosionInwardsCalculation, overtoppingRateOutputContext.WrappedData);
+ mocks.VerifyAll();
}
[Test]