Index: Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/PresentationObjects/GrassCoverErosionInwardsScenariosContext.cs
===================================================================
diff -u -r1f76045f08612f7b8259c460771c7cdbdb5447a7 -r9b642748438acbabb3f67559e289ec49525aaf4b
--- Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/PresentationObjects/GrassCoverErosionInwardsScenariosContext.cs (.../GrassCoverErosionInwardsScenariosContext.cs) (revision 1f76045f08612f7b8259c460771c7cdbdb5447a7)
+++ Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/PresentationObjects/GrassCoverErosionInwardsScenariosContext.cs (.../GrassCoverErosionInwardsScenariosContext.cs) (revision 9b642748438acbabb3f67559e289ec49525aaf4b)
@@ -21,6 +21,7 @@
using System;
using Core.Common.Controls.PresentationObjects;
+using Riskeer.Common.Data.AssessmentSection;
using Riskeer.Common.Data.Calculation;
using Riskeer.GrassCoverErosionInwards.Data;
@@ -36,22 +37,36 @@
/// Creates a new instance of .
///
/// The wrapped .
- /// A forming the context.
+ /// A forming the context.
+ /// The the belongs to.
+ /// Thrown when any parameter is null.
public GrassCoverErosionInwardsScenariosContext(CalculationGroup wrappedData,
- GrassCoverErosionInwardsFailureMechanism failureMechanism)
+ GrassCoverErosionInwardsFailureMechanism failureMechanism,
+ IAssessmentSection assessmentSection)
: base(wrappedData)
{
if (failureMechanism == null)
{
throw new ArgumentNullException(nameof(failureMechanism));
}
+ if (assessmentSection == null)
+ {
+ throw new ArgumentNullException(nameof(assessmentSection));
+ }
+
ParentFailureMechanism = failureMechanism;
+ AssessmentSection = assessmentSection;
}
///
/// Gets the parent failure mechanism of the calculation group.
///
public GrassCoverErosionInwardsFailureMechanism ParentFailureMechanism { get; }
+
+ ///
+ /// Gets the of the calculation group.
+ ///
+ public IAssessmentSection AssessmentSection { get; }
}
}
\ No newline at end of file
Index: Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsScenarioRow.cs
===================================================================
diff -u -r86f7f85e5485e3566223ebf44e46625503f511b3 -r9b642748438acbabb3f67559e289ec49525aaf4b
--- Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsScenarioRow.cs (.../GrassCoverErosionInwardsScenarioRow.cs) (revision 86f7f85e5485e3566223ebf44e46625503f511b3)
+++ Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsScenarioRow.cs (.../GrassCoverErosionInwardsScenarioRow.cs) (revision 9b642748438acbabb3f67559e289ec49525aaf4b)
@@ -20,6 +20,8 @@
// All rights reserved.
using System;
+using Riskeer.Common.Data.AssessmentSection;
+using Riskeer.Common.Data.Probability;
using Riskeer.Common.Forms.Views;
using Riskeer.GrassCoverErosionInwards.Data;
@@ -31,30 +33,51 @@
///
public class GrassCoverErosionInwardsScenarioRow : ScenarioRow
{
+ private readonly GrassCoverErosionInwardsFailureMechanism failureMechanism;
+ private readonly IAssessmentSection assessmentSection;
+ private ProbabilityAssessmentOutput probabilityAssessmentOutput;
+
///
/// Creates a new instance of .
///
/// The this row contains.
- /// Thrown when is null.
- internal GrassCoverErosionInwardsScenarioRow(GrassCoverErosionInwardsCalculationScenario calculationScenario)
- : base(calculationScenario) {}
-
- public override double FailureProbability
+ /// The failure mechanism that the calculation belongs to.
+ /// The assessment section that the calculation belongs to.
+ /// Thrown when any parameter is null.
+ internal GrassCoverErosionInwardsScenarioRow(GrassCoverErosionInwardsCalculationScenario calculationScenario,
+ GrassCoverErosionInwardsFailureMechanism failureMechanism,
+ IAssessmentSection assessmentSection)
+ : base(calculationScenario)
{
- get
+ if (failureMechanism == null)
{
- if (CalculationScenario.HasOutput)
- {
- return CalculationScenario.Output.OvertoppingOutput.Reliability;
- }
+ throw new ArgumentNullException(nameof(failureMechanism));
+ }
- return double.NaN;
+ if (assessmentSection == null)
+ {
+ throw new ArgumentNullException(nameof(assessmentSection));
}
+
+ this.failureMechanism = failureMechanism;
+ this.assessmentSection = assessmentSection;
+
+ CreateProbabilityAssessmentOutput();
}
+ public override double FailureProbability => probabilityAssessmentOutput?.Probability ?? double.NaN;
+
public override void Update()
{
-
+ CreateProbabilityAssessmentOutput();
}
+
+ private void CreateProbabilityAssessmentOutput()
+ {
+ probabilityAssessmentOutput = CalculationScenario.HasOutput
+ ? GrassCoverErosionInwardsProbabilityAssessmentOutputFactory.Create(
+ CalculationScenario.Output.OvertoppingOutput, failureMechanism, assessmentSection)
+ : null;
+ }
}
}
\ No newline at end of file
Index: Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsScenariosView.cs
===================================================================
diff -u -r86f7f85e5485e3566223ebf44e46625503f511b3 -r9b642748438acbabb3f67559e289ec49525aaf4b
--- Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsScenariosView.cs (.../GrassCoverErosionInwardsScenariosView.cs) (revision 86f7f85e5485e3566223ebf44e46625503f511b3)
+++ Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsScenariosView.cs (.../GrassCoverErosionInwardsScenariosView.cs) (revision 9b642748438acbabb3f67559e289ec49525aaf4b)
@@ -23,6 +23,7 @@
using System.Collections.Generic;
using System.Linq;
using Core.Common.Base.Geometry;
+using Riskeer.Common.Data.AssessmentSection;
using Riskeer.Common.Data.Calculation;
using Riskeer.Common.Data.FailureMechanism;
using Riskeer.Common.Forms.Views;
@@ -35,17 +36,28 @@
///
public partial class GrassCoverErosionInwardsScenariosView : ScenariosView
{
+ private readonly IAssessmentSection assessmentSection;
+
///
/// Creates a new instance of .
///
/// The data to show in this view.
/// The
/// the belongs to.
+ /// The assessment section the scenarios belong to.
/// Thrown when any parameter
/// is null.
- public GrassCoverErosionInwardsScenariosView(CalculationGroup calculationGroup, GrassCoverErosionInwardsFailureMechanism failureMechanism)
- : base(calculationGroup, failureMechanism) {}
+ public GrassCoverErosionInwardsScenariosView(CalculationGroup calculationGroup, GrassCoverErosionInwardsFailureMechanism failureMechanism, IAssessmentSection assessmentSection)
+ : base(calculationGroup, failureMechanism)
+ {
+ if (assessmentSection == null)
+ {
+ throw new ArgumentNullException(nameof(assessmentSection));
+ }
+ this.assessmentSection = assessmentSection;
+ }
+
protected override GrassCoverErosionInwardsInput GetCalculationInput(GrassCoverErosionInwardsCalculationScenario calculationScenario)
{
return calculationScenario.InputParameters;
@@ -57,7 +69,7 @@
IEnumerable calculations = CalculationGroup.GetCalculations().OfType()
.Where(cs => cs.IsDikeProfileIntersectionWithReferenceLineInSection(lineSegments));
- return calculations.Select(c => new GrassCoverErosionInwardsScenarioRow(c)).ToList();
+ return calculations.Select(c => new GrassCoverErosionInwardsScenarioRow(c, FailureMechanism, assessmentSection)).ToList();
}
}
}
\ No newline at end of file
Index: Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsPlugin.cs
===================================================================
diff -u -r37a4e660b01d95d3ff79fd2121cdc905d1867bfe -r9b642748438acbabb3f67559e289ec49525aaf4b
--- Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsPlugin.cs (.../GrassCoverErosionInwardsPlugin.cs) (revision 37a4e660b01d95d3ff79fd2121cdc905d1867bfe)
+++ Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsPlugin.cs (.../GrassCoverErosionInwardsPlugin.cs) (revision 9b642748438acbabb3f67559e289ec49525aaf4b)
@@ -192,7 +192,7 @@
{
GetViewData = context => context.WrappedData,
GetViewName = (view, context) => RiskeerCommonFormsResources.Scenarios_DisplayName,
- CreateInstance = context => new GrassCoverErosionInwardsScenariosView(context.WrappedData, context.ParentFailureMechanism),
+ CreateInstance = context => new GrassCoverErosionInwardsScenariosView(context.WrappedData, context.ParentFailureMechanism, context.AssessmentSection),
CloseForData = CloseScenariosViewForData,
Image = RiskeerCommonFormsResources.ScenariosIcon
};
@@ -507,7 +507,7 @@
return new object[]
{
new FailureMechanismAssemblyCategoriesContext(failureMechanism, assessmentSection, () => failureMechanism.GeneralInput.N),
- new GrassCoverErosionInwardsScenariosContext(failureMechanism.CalculationsGroup, failureMechanism),
+ new GrassCoverErosionInwardsScenariosContext(failureMechanism.CalculationsGroup, failureMechanism, assessmentSection),
new ProbabilityFailureMechanismSectionResultContext(
failureMechanism.SectionResults, failureMechanism, assessmentSection),
failureMechanism.OutputComments
Index: Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Forms.Test/PresentationObjects/GrassCoverErosionInwardsScenariosContextTest.cs
===================================================================
diff -u -rf1a99bd6f1bfda45d8b7b4dbb8d7b7e51fcc718f -r9b642748438acbabb3f67559e289ec49525aaf4b
--- Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Forms.Test/PresentationObjects/GrassCoverErosionInwardsScenariosContextTest.cs (.../GrassCoverErosionInwardsScenariosContextTest.cs) (revision f1a99bd6f1bfda45d8b7b4dbb8d7b7e51fcc718f)
+++ Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Forms.Test/PresentationObjects/GrassCoverErosionInwardsScenariosContextTest.cs (.../GrassCoverErosionInwardsScenariosContextTest.cs) (revision 9b642748438acbabb3f67559e289ec49525aaf4b)
@@ -22,6 +22,8 @@
using System;
using Core.Common.Controls.PresentationObjects;
using NUnit.Framework;
+using Rhino.Mocks;
+using Riskeer.Common.Data.AssessmentSection;
using Riskeer.Common.Data.Calculation;
using Riskeer.GrassCoverErosionInwards.Data;
using Riskeer.GrassCoverErosionInwards.Forms.PresentationObjects;
@@ -35,30 +37,52 @@
public void Constructor_ExpectedValues()
{
// Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
var calculationGroup = new CalculationGroup();
// Call
- var context = new GrassCoverErosionInwardsScenariosContext(calculationGroup, failureMechanism);
+ var context = new GrassCoverErosionInwardsScenariosContext(calculationGroup, failureMechanism, assessmentSection);
// Assert
Assert.IsInstanceOf>(context);
Assert.AreSame(calculationGroup, context.WrappedData);
Assert.AreSame(failureMechanism, context.ParentFailureMechanism);
+ Assert.AreSame(assessmentSection, context.AssessmentSection);
+ mocks.VerifyAll();
}
[Test]
public void Constructor_FailureMechanismNull_ThrowArgumentNullException()
{
// Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
var calculationGroup = new CalculationGroup();
// Call
- TestDelegate test = () => new GrassCoverErosionInwardsScenariosContext(calculationGroup, null);
+ void Call() => new GrassCoverErosionInwardsScenariosContext(calculationGroup, null, assessmentSection);
// Assert
- var exception = Assert.Throws(test);
+ var exception = Assert.Throws(Call);
Assert.AreEqual("failureMechanism", exception.ParamName);
+ mocks.VerifyAll();
}
+
+ [Test]
+ public void Constructor_AssessmentSectionNull_ThrowsArgumentNullException()
+ {
+ // Call
+ void Call() => new GrassCoverErosionInwardsScenariosContext(new CalculationGroup(), new GrassCoverErosionInwardsFailureMechanism(), null);
+
+ // Assert
+ var exception = Assert.Throws(Call);
+ Assert.AreEqual("assessmentSection", exception.ParamName);
+ }
}
}
\ No newline at end of file
Index: Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsScenarioRowTest.cs
===================================================================
diff -u -r86f7f85e5485e3566223ebf44e46625503f511b3 -r9b642748438acbabb3f67559e289ec49525aaf4b
--- Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsScenarioRowTest.cs (.../GrassCoverErosionInwardsScenarioRowTest.cs) (revision 86f7f85e5485e3566223ebf44e46625503f511b3)
+++ Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsScenarioRowTest.cs (.../GrassCoverErosionInwardsScenarioRowTest.cs) (revision 9b642748438acbabb3f67559e289ec49525aaf4b)
@@ -19,9 +19,15 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System;
using NUnit.Framework;
+using Rhino.Mocks;
+using Riskeer.Common.Data.AssessmentSection;
+using Riskeer.Common.Data.Probability;
+using Riskeer.Common.Data.TestUtil;
using Riskeer.Common.Forms.Views;
using Riskeer.GrassCoverErosionInwards.Data;
+using Riskeer.GrassCoverErosionInwards.Data.TestUtil;
using Riskeer.GrassCoverErosionInwards.Forms.Views;
namespace Riskeer.GrassCoverErosionInwards.Forms.Test.Views
@@ -30,17 +36,189 @@
public class GrassCoverErosionInwardsScenarioRowTest
{
[Test]
+ public void Constructor_FailureMechanismNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ // Call
+ void Call() => new GrassCoverErosionInwardsScenarioRow(new GrassCoverErosionInwardsCalculationScenario(), null, assessmentSection);
+
+ // Assert
+ var exception = Assert.Throws(Call);
+ Assert.AreEqual("failureMechanism", exception.ParamName);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Constructor_AssessmentSectionNull_ThrowsArgumentNullException()
+ {
+ // Call
+ void Call() => new GrassCoverErosionInwardsScenarioRow(new GrassCoverErosionInwardsCalculationScenario(), new GrassCoverErosionInwardsFailureMechanism(), null);
+
+ // Assert
+ var exception = Assert.Throws(Call);
+ Assert.AreEqual("assessmentSection", exception.ParamName);
+ }
+
+ [Test]
public void Constructor_ExpectedValues()
{
// Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
var calculation = new GrassCoverErosionInwardsCalculationScenario();
// Call
- var row = new GrassCoverErosionInwardsScenarioRow(calculation);
+ var row = new GrassCoverErosionInwardsScenarioRow(calculation, new GrassCoverErosionInwardsFailureMechanism(), assessmentSection);
// Assert
Assert.IsInstanceOf>(row);
Assert.AreSame(calculation, row.CalculationScenario);
+ mocks.VerifyAll();
}
+
+ [Test]
+ public void Constructor_WithCalculationWithOutput_PropertiesFromCalculation()
+ {
+ // Setup
+ var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
+
+ var mocks = new MockRepository();
+ IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
+ mocks.ReplayAll();
+
+ var calculation = new GrassCoverErosionInwardsCalculationScenario
+ {
+ Output = new TestGrassCoverErosionInwardsOutput()
+ };
+
+ // Call
+ var row = new GrassCoverErosionInwardsScenarioRow(calculation, failureMechanism, assessmentSection);
+
+ // Assert
+ ProbabilityAssessmentOutput expectedDerivedOutput = GrassCoverErosionInwardsProbabilityAssessmentOutputFactory.Create(
+ calculation.Output.OvertoppingOutput, failureMechanism, assessmentSection);
+ Assert.AreEqual(expectedDerivedOutput.Probability, row.FailureProbability);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Constructor_WithCalculationWithoutOutput_PropertiesFromCalculation()
+ {
+ // Setup
+ var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
+
+ var mocks = new MockRepository();
+ IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
+ mocks.ReplayAll();
+
+ var calculation = new GrassCoverErosionInwardsCalculationScenario();
+
+ // Call
+ var row = new GrassCoverErosionInwardsScenarioRow(calculation, failureMechanism, assessmentSection);
+
+ // Assert
+ Assert.IsNaN(row.FailureProbability);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void GivenScenarioRow_WhenOutputSetAndUpdate_ThenDerivedOutputUpdated()
+ {
+ // Given
+ var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
+
+ var mocks = new MockRepository();
+ IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
+ mocks.ReplayAll();
+
+ var calculation = new GrassCoverErosionInwardsCalculationScenario();
+
+ var row = new GrassCoverErosionInwardsScenarioRow(calculation, failureMechanism, assessmentSection);
+
+ // Precondition
+ Assert.IsNaN(row.FailureProbability);
+
+ // When
+ calculation.Output = new TestGrassCoverErosionInwardsOutput();
+ row.Update();
+
+ // Then
+ ProbabilityAssessmentOutput expectedDerivedOutput = GrassCoverErosionInwardsProbabilityAssessmentOutputFactory.Create(
+ calculation.Output.OvertoppingOutput, failureMechanism, assessmentSection);
+ Assert.AreEqual(expectedDerivedOutput.Probability, row.FailureProbability);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void GivenScenarioRow_WhenOutputSetToNullAndUpdate_ThenDerivedOutputUpdated()
+ {
+ // Given
+ var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
+
+ var mocks = new MockRepository();
+ IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
+ mocks.ReplayAll();
+
+ var calculation = new GrassCoverErosionInwardsCalculationScenario
+ {
+ Output = new TestGrassCoverErosionInwardsOutput()
+ };
+
+ var row = new GrassCoverErosionInwardsScenarioRow(calculation, failureMechanism, assessmentSection);
+
+ // Precondition
+ ProbabilityAssessmentOutput expectedDerivedOutput = GrassCoverErosionInwardsProbabilityAssessmentOutputFactory.Create(
+ calculation.Output.OvertoppingOutput, failureMechanism, assessmentSection);
+ Assert.AreEqual(expectedDerivedOutput.Probability, row.FailureProbability);
+
+ // When
+ calculation.Output = null;
+ row.Update();
+
+ // Then
+ Assert.IsNaN(row.FailureProbability);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void GivenScenarioRow_WhenOutputChangedAndUpdate_ThenDerivedOutputUpdated()
+ {
+ // Given
+ var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
+
+ var mocks = new MockRepository();
+ IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
+ mocks.ReplayAll();
+
+ var calculation = new GrassCoverErosionInwardsCalculationScenario
+ {
+ Output = new TestGrassCoverErosionInwardsOutput()
+ };
+
+ var row = new GrassCoverErosionInwardsScenarioRow(calculation, failureMechanism, assessmentSection);
+
+ // Precondition
+ ProbabilityAssessmentOutput expectedDerivedOutput = GrassCoverErosionInwardsProbabilityAssessmentOutputFactory.Create(
+ calculation.Output.OvertoppingOutput, failureMechanism, assessmentSection);
+ Assert.AreEqual(expectedDerivedOutput.Probability, row.FailureProbability);
+
+ var random = new Random(11);
+
+ // When
+ calculation.Output = new GrassCoverErosionInwardsOutput(new TestOvertoppingOutput(random.NextDouble()), null, null);
+ row.Update();
+
+ // Then
+ ProbabilityAssessmentOutput newExpectedDerivedOutput = GrassCoverErosionInwardsProbabilityAssessmentOutputFactory.Create(
+ calculation.Output.OvertoppingOutput, failureMechanism, assessmentSection);
+ Assert.AreEqual(newExpectedDerivedOutput.Probability, row.FailureProbability);
+ mocks.VerifyAll();
+ }
}
}
\ No newline at end of file
Index: Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsScenariosViewTest.cs
===================================================================
diff -u -r86f7f85e5485e3566223ebf44e46625503f511b3 -r9b642748438acbabb3f67559e289ec49525aaf4b
--- Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsScenariosViewTest.cs (.../GrassCoverErosionInwardsScenariosViewTest.cs) (revision 86f7f85e5485e3566223ebf44e46625503f511b3)
+++ Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsScenariosViewTest.cs (.../GrassCoverErosionInwardsScenariosViewTest.cs) (revision 9b642748438acbabb3f67559e289ec49525aaf4b)
@@ -25,6 +25,8 @@
using Core.Common.Base.Geometry;
using NUnit.Extensions.Forms;
using NUnit.Framework;
+using Rhino.Mocks;
+using Riskeer.Common.Data.AssessmentSection;
using Riskeer.Common.Data.Calculation;
using Riskeer.Common.Data.DikeProfiles;
using Riskeer.Common.Data.FailureMechanism;
@@ -60,18 +62,35 @@
}
[Test]
+ public void Constructor_AssessmentSectionNull_ThrowsArgumentNullException()
+ {
+ // Call
+ void Call() => new GrassCoverErosionInwardsScenariosView(new CalculationGroup(), new GrassCoverErosionInwardsFailureMechanism(), null);
+
+ // Assert
+ var exception = Assert.Throws(Call);
+ Assert.AreEqual("assessmentSection", exception.ParamName);
+ }
+
+ [Test]
public void Constructor_ExpectedValues()
{
// Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
var calculationGroup = new CalculationGroup();
// Call
- using(var view = new GrassCoverErosionInwardsScenariosView(calculationGroup, new GrassCoverErosionInwardsFailureMechanism()))
+ using (var view = new GrassCoverErosionInwardsScenariosView(calculationGroup, new GrassCoverErosionInwardsFailureMechanism(), assessmentSection))
{
// Assert
Assert.IsInstanceOf>(view);
Assert.AreSame(calculationGroup, view.Data);
}
+
+ mocks.VerifyAll();
}
[Test]
@@ -81,7 +100,7 @@
ShowGrassCoverErosionInwardsScenariosView(new GrassCoverErosionInwardsFailureMechanism());
// Assert
- var dataGridView = (DataGridView)new ControlTester("dataGridView").TheObject;
+ var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject;
Assert.AreEqual(4, dataGridView.ColumnCount);
Assert.AreEqual("In oordeel", dataGridView.Columns[isRelevantColumnIndex].HeaderText);
Assert.AreEqual("Bijdrage aan\r\nscenario\r\n[%]", dataGridView.Columns[contributionColumnIndex].HeaderText);
@@ -95,7 +114,7 @@
// Call
ShowFullyConfiguredGrassCoverErosionInwardsScenariosView();
- var dataGridView = (DataGridView)new ControlTester("dataGridView").TheObject;
+ var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject;
// Assert
DataGridViewRowCollection rows = dataGridView.Rows;
@@ -113,7 +132,7 @@
Assert.IsTrue(Convert.ToBoolean(cells[isRelevantColumnIndex].FormattedValue));
Assert.AreEqual(new RoundedDouble(2, 100).ToString(), cells[contributionColumnIndex].FormattedValue);
Assert.AreEqual("Calculation 2", cells[nameColumnIndex].FormattedValue);
- Assert.AreEqual(ProbabilityFormattingHelper.Format(0.2), cells[failureProbabilityColumnIndex].FormattedValue);
+ Assert.AreEqual(ProbabilityFormattingHelper.Format(0.5), cells[failureProbabilityColumnIndex].FormattedValue);
}
private void ShowFullyConfiguredGrassCoverErosionInwardsScenariosView()
@@ -163,7 +182,7 @@
private void ShowGrassCoverErosionInwardsScenariosView(GrassCoverErosionInwardsFailureMechanism failureMechanism)
{
- var scenariosView = new GrassCoverErosionInwardsScenariosView(failureMechanism.CalculationsGroup, failureMechanism);
+ var scenariosView = new GrassCoverErosionInwardsScenariosView(failureMechanism.CalculationsGroup, failureMechanism, new AssessmentSectionStub());
testForm.Controls.Add(scenariosView);
testForm.Show();
}
Index: Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Integration.Test/GrassCoverErosionInwardsScenariosViewIntegrationTest.cs
===================================================================
diff -u -r3aea1664d081533081c7ee4e879a7eeb6586721d -r9b642748438acbabb3f67559e289ec49525aaf4b
--- Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Integration.Test/GrassCoverErosionInwardsScenariosViewIntegrationTest.cs (.../GrassCoverErosionInwardsScenariosViewIntegrationTest.cs) (revision 3aea1664d081533081c7ee4e879a7eeb6586721d)
+++ Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Integration.Test/GrassCoverErosionInwardsScenariosViewIntegrationTest.cs (.../GrassCoverErosionInwardsScenariosViewIntegrationTest.cs) (revision 9b642748438acbabb3f67559e289ec49525aaf4b)
@@ -19,10 +19,11 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
-using System.Collections.Generic;
+using System;
using System.IO;
using System.Linq;
using System.Windows.Forms;
+using Core.Common.Base.Data;
using Core.Common.TestUtil;
using NUnit.Extensions.Forms;
using NUnit.Framework;
@@ -45,6 +46,11 @@
[TestFixture]
public class GrassCoverErosionInwardsScenariosViewIntegrationTest
{
+ private const int isRelevantColumnIndex = 0;
+ private const int contributionColumnIndex = 1;
+ private const int nameColumnIndex = 2;
+ private const int failureProbabilityColumnIndex = 3;
+
private readonly string filePath = TestHelper.GetTestDataPath(TestDataPath.Riskeer.GrassCoverErosionInwards.Integration,
Path.Combine("DikeProfiles", "Voorlanden 6-3.shp"));
@@ -58,31 +64,23 @@
DataImportHelper.ImportReferenceLine(assessmentSection);
var view = new GrassCoverErosionInwardsScenariosView(assessmentSection.GrassCoverErosionInwards.CalculationsGroup,
- assessmentSection.GrassCoverErosionInwards);
+ assessmentSection.GrassCoverErosionInwards,
+ assessmentSection);
form.Controls.Add(view);
form.Show();
- var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject;
+ var listBox = (ListBox) new ControlTester("listBox").TheObject;
// Precondition
- Assert.AreEqual(0, dataGridView.RowCount);
+ CollectionAssert.IsEmpty(listBox.Items);
// Call
IFailureMechanism failureMechanism = assessmentSection.GrassCoverErosionInwards;
DataImportHelper.ImportFailureMechanismSections(assessmentSection, failureMechanism);
assessmentSection.GrassCoverErosionInwards.NotifyObservers();
// Assert
- Assert.AreEqual(283, dataGridView.RowCount);
-
- IEnumerable expectedValues = assessmentSection.GrassCoverErosionInwards.SectionResults.Select(sr => sr.Section.Name);
- var foundValues = new List();
- foreach (DataGridViewRow row in dataGridView.Rows)
- {
- foundValues.Add(row.Cells[0].FormattedValue.ToString());
- }
-
- CollectionAssert.AreEqual(expectedValues, foundValues);
+ CollectionAssert.AreEqual(assessmentSection.GrassCoverErosionInwards.Sections, listBox.Items);
}
}
@@ -103,19 +101,27 @@
CalculationGroup calculationsGroup = assessmentSection.GrassCoverErosionInwards.CalculationsGroup;
var view = new GrassCoverErosionInwardsScenariosView(assessmentSection.GrassCoverErosionInwards.CalculationsGroup,
- assessmentSection.GrassCoverErosionInwards);
+ assessmentSection.GrassCoverErosionInwards,
+ assessmentSection);
form.Controls.Add(view);
form.Show();
- var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject;
-
var dikeProfilesImporter = new DikeProfilesImporter(assessmentSection.GrassCoverErosionInwards.DikeProfiles,
assessmentSection.ReferenceLine,
filePath, new GrassCoverErosionInwardsDikeProfileReplaceDataStrategy(
(GrassCoverErosionInwardsFailureMechanism) failureMechanism),
messageProvider);
dikeProfilesImporter.Import();
+ var listBox = (ListBox) new ControlTester("listBox").TheObject;
+ var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject;
+
+ listBox.SelectedItem = failureMechanism.Sections.ElementAt(13);
+
+ // Precondition
+ DataGridViewRowCollection rows = dataGridView.Rows;
+ CollectionAssert.IsEmpty(rows);
+
// Call
foreach (DikeProfile profile in assessmentSection.GrassCoverErosionInwards.DikeProfiles)
{
@@ -132,11 +138,15 @@
calculationsGroup.NotifyObservers();
// Assert
- DataGridViewCell dataGridViewCell = dataGridView.Rows[13].Cells[1];
- Assert.AreEqual(2, ((DataGridViewComboBoxCell) dataGridViewCell).Items.Count);
- Assert.AreEqual("", ((DataGridViewComboBoxCell) dataGridViewCell).Items[0].ToString());
- Assert.AreEqual("profiel63p1Naam", ((DataGridViewComboBoxCell) dataGridViewCell).Items[1].ToString());
+ Assert.AreEqual(1, rows.Count);
+ DataGridViewCellCollection cells = rows[0].Cells;
+ Assert.AreEqual(4, cells.Count);
+ Assert.IsTrue(Convert.ToBoolean(cells[isRelevantColumnIndex].FormattedValue));
+ Assert.AreEqual(new RoundedDouble(2, 100).ToString(), cells[contributionColumnIndex].FormattedValue);
+ Assert.AreEqual("profiel63p1Naam", cells[nameColumnIndex].FormattedValue);
+ Assert.AreEqual("-", cells[failureProbabilityColumnIndex].FormattedValue);
+
mocks.VerifyAll();
}
}
@@ -158,12 +168,11 @@
CalculationGroup calculationsGroup = assessmentSection.GrassCoverErosionInwards.CalculationsGroup;
var view = new GrassCoverErosionInwardsScenariosView(assessmentSection.GrassCoverErosionInwards.CalculationsGroup,
- assessmentSection.GrassCoverErosionInwards);
+ assessmentSection.GrassCoverErosionInwards,
+ assessmentSection);
form.Controls.Add(view);
form.Show();
- var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject;
-
var dikeProfilesImporter = new DikeProfilesImporter(assessmentSection.GrassCoverErosionInwards.DikeProfiles,
assessmentSection.ReferenceLine,
filePath,
@@ -186,17 +195,26 @@
calculationsGroup.NotifyObservers();
+ var listBox = (ListBox)new ControlTester("listBox").TheObject;
+ var dataGridView = (DataGridView)new ControlTester("dataGridView").TheObject;
+
+ listBox.SelectedItem = failureMechanism.Sections.ElementAt(13);
+
+ // Precondition
+ DataGridViewRowCollection rows = dataGridView.Rows;
+ Assert.AreEqual(1, rows.Count);
+
+ DataGridViewCellCollection cells = rows[0].Cells;
+ Assert.AreEqual("profiel63p1Naam", cells[nameColumnIndex].FormattedValue);
+
// Call
foreach (GrassCoverErosionInwardsCalculationScenario calculation in calculationsGroup.Children.Cast())
{
calculation.Name += "_changed";
}
// Assert
- DataGridViewCell dataGridViewCell = dataGridView.Rows[13].Cells[1];
- Assert.AreEqual(2, ((DataGridViewComboBoxCell) dataGridViewCell).Items.Count);
- Assert.AreEqual("", ((DataGridViewComboBoxCell) dataGridViewCell).Items[0].ToString());
- Assert.AreEqual("profiel63p1Naam_changed", ((DataGridViewComboBoxCell) dataGridViewCell).Items[1].ToString());
+ Assert.AreEqual("profiel63p1Naam_changed", cells[nameColumnIndex].FormattedValue);
mocks.VerifyAll();
}
@@ -218,12 +236,11 @@
DataImportHelper.ImportFailureMechanismSections(assessmentSection, failureMechanism);
var view = new GrassCoverErosionInwardsScenariosView(assessmentSection.GrassCoverErosionInwards.CalculationsGroup,
- assessmentSection.GrassCoverErosionInwards);
+ assessmentSection.GrassCoverErosionInwards,
+ assessmentSection);
form.Controls.Add(view);
form.Show();
- var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject;
-
var dikeProfilesImporter = new DikeProfilesImporter(assessmentSection.GrassCoverErosionInwards.DikeProfiles,
assessmentSection.ReferenceLine,
filePath, new GrassCoverErosionInwardsDikeProfileReplaceDataStrategy(
@@ -242,24 +259,28 @@
}
});
}
+
+ var listBox = (ListBox)new ControlTester("listBox").TheObject;
+ var dataGridView = (DataGridView)new ControlTester("dataGridView").TheObject;
+ listBox.SelectedItem = failureMechanism.Sections.ElementAt(13);
+
+ // Precondition
+ DataGridViewRowCollection rows = dataGridView.Rows;
+ Assert.AreEqual(1, rows.Count);
+ Assert.AreEqual("profiel63p1NaamCalculation", rows[0].Cells[nameColumnIndex].FormattedValue);
+
// Call
CalculationGroup calculationsGroup = assessmentSection.GrassCoverErosionInwards.CalculationsGroup;
((GrassCoverErosionInwardsCalculationScenario) calculationsGroup.Children[1]).InputParameters.DikeProfile =
((GrassCoverErosionInwardsCalculationScenario) calculationsGroup.Children[0]).InputParameters.DikeProfile;
calculationsGroup.NotifyObservers();
// Assert
- DataGridViewCell dataGridViewCell = dataGridView.Rows[13].Cells[1];
- Assert.AreEqual(3, ((DataGridViewComboBoxCell) dataGridViewCell).Items.Count);
- Assert.AreEqual("", ((DataGridViewComboBoxCell) dataGridViewCell).Items[0].ToString());
- Assert.AreEqual("profiel63p1NaamCalculation", ((DataGridViewComboBoxCell) dataGridViewCell).Items[1].ToString());
- Assert.AreEqual("profiel63p2NaamCalculation", ((DataGridViewComboBoxCell) dataGridViewCell).Items[2].ToString());
+ Assert.AreEqual(2, rows.Count);
+ Assert.AreEqual("profiel63p1NaamCalculation", rows[0].Cells[nameColumnIndex].FormattedValue);
+ Assert.AreEqual("profiel63p2NaamCalculation", rows[1].Cells[nameColumnIndex].FormattedValue);
- DataGridViewCell dataGridViewCellWithRemovedCalculation = dataGridView.Rows[56].Cells[1];
- Assert.AreEqual(1, ((DataGridViewComboBoxCell) dataGridViewCellWithRemovedCalculation).Items.Count);
- Assert.AreEqual("", ((DataGridViewComboBoxCell) dataGridViewCellWithRemovedCalculation).Items[0].ToString());
-
mocks.VerifyAll();
}
}
Index: Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionInwardsScenariosContextTreeNodeInfoTest.cs
===================================================================
diff -u -rf1a99bd6f1bfda45d8b7b4dbb8d7b7e51fcc718f -r9b642748438acbabb3f67559e289ec49525aaf4b
--- Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionInwardsScenariosContextTreeNodeInfoTest.cs (.../GrassCoverErosionInwardsScenariosContextTreeNodeInfoTest.cs) (revision f1a99bd6f1bfda45d8b7b4dbb8d7b7e51fcc718f)
+++ Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionInwardsScenariosContextTreeNodeInfoTest.cs (.../GrassCoverErosionInwardsScenariosContextTreeNodeInfoTest.cs) (revision 9b642748438acbabb3f67559e289ec49525aaf4b)
@@ -27,7 +27,9 @@
using Core.Common.TestUtil;
using NUnit.Framework;
using Rhino.Mocks;
+using Riskeer.Common.Data.AssessmentSection;
using Riskeer.Common.Data.Calculation;
+using Riskeer.Common.Data.TestUtil;
using Riskeer.GrassCoverErosionInwards.Data;
using Riskeer.GrassCoverErosionInwards.Forms.PresentationObjects;
using RiskeerCommonFormsResources = Riskeer.Common.Forms.Properties.Resources;
@@ -81,30 +83,40 @@
public void Text_Always_ReturnScenarios()
{
// Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
var group = new CalculationGroup();
var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
- var context = new GrassCoverErosionInwardsScenariosContext(group, failureMechanism);
+ var context = new GrassCoverErosionInwardsScenariosContext(group, failureMechanism, assessmentSection);
// Call
string text = info.Text(context);
// Assert
Assert.AreEqual("Scenario's", text);
+ mocks.VerifyAll();
}
[Test]
public void Image_Always_ReturnExpectedImage()
{
// Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
var group = new CalculationGroup();
var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
- var context = new GrassCoverErosionInwardsScenariosContext(group, failureMechanism);
+ var context = new GrassCoverErosionInwardsScenariosContext(group, failureMechanism, assessmentSection);
// Call
Image image = info.Image(context);
// Assert
TestHelper.AssertImagesAreEqual(RiskeerCommonFormsResources.ScenariosIcon, image);
+ mocks.VerifyAll();
}
[Test]
@@ -113,12 +125,9 @@
// Setup
using (var treeViewControl = new TreeViewControl())
{
- var group = new CalculationGroup();
- var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
- var context = new GrassCoverErosionInwardsScenariosContext(group, failureMechanism);
+ var context = new GrassCoverErosionInwardsScenariosContext(new CalculationGroup(), new GrassCoverErosionInwardsFailureMechanism(), new AssessmentSectionStub());
var mocks = new MockRepository();
-
var menuBuilder = mocks.StrictMock();
menuBuilder.Expect(mb => mb.AddOpenItem()).Return(menuBuilder);
menuBuilder.Expect(mb => mb.Build()).Return(null);
Index: Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Plugin.Test/ViewInfos/GrassCoverErosionInwardsScenariosViewInfoTest.cs
===================================================================
diff -u -r37a4e660b01d95d3ff79fd2121cdc905d1867bfe -r9b642748438acbabb3f67559e289ec49525aaf4b
--- Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Plugin.Test/ViewInfos/GrassCoverErosionInwardsScenariosViewInfoTest.cs (.../GrassCoverErosionInwardsScenariosViewInfoTest.cs) (revision 37a4e660b01d95d3ff79fd2121cdc905d1867bfe)
+++ Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Plugin.Test/ViewInfos/GrassCoverErosionInwardsScenariosViewInfoTest.cs (.../GrassCoverErosionInwardsScenariosViewInfoTest.cs) (revision 9b642748438acbabb3f67559e289ec49525aaf4b)
@@ -77,15 +77,20 @@
public void GetViewData_WithContext_ReturnWrappedData()
{
// Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
var calculationGroup = new CalculationGroup();
var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
- var context = new GrassCoverErosionInwardsScenariosContext(calculationGroup, failureMechanism);
+ var context = new GrassCoverErosionInwardsScenariosContext(calculationGroup, failureMechanism, assessmentSection);
// Call
object viewData = info.GetViewData(context);
// Assert
Assert.AreSame(calculationGroup, viewData);
+ mocks.VerifyAll();
}
[Test]
@@ -112,7 +117,7 @@
});
mocks.ReplayAll();
- using (var view = new GrassCoverErosionInwardsScenariosView(new CalculationGroup(), new GrassCoverErosionInwardsFailureMechanism()))
+ using (var view = new GrassCoverErosionInwardsScenariosView(new CalculationGroup(), new GrassCoverErosionInwardsFailureMechanism(), assessmentSection))
{
// Precondition
Assert.AreNotSame(view.Data, unrelatedFailureMechanism.CalculationsGroup);
@@ -141,7 +146,7 @@
});
mocks.ReplayAll();
- using (var view = new GrassCoverErosionInwardsScenariosView(relatedFailureMechanism.CalculationsGroup, relatedFailureMechanism))
+ using (var view = new GrassCoverErosionInwardsScenariosView(relatedFailureMechanism.CalculationsGroup, relatedFailureMechanism, assessmentSection))
{
// Precondition
Assert.AreSame(view.Data, relatedFailureMechanism.CalculationsGroup);
@@ -160,29 +165,39 @@
public void CloseForData_ViewNotCorrespondingToRemovedFailureMechanism_ReturnFalse()
{
// Setup
- using (var view = new GrassCoverErosionInwardsScenariosView(new CalculationGroup(), new GrassCoverErosionInwardsFailureMechanism()))
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ using (var view = new GrassCoverErosionInwardsScenariosView(new CalculationGroup(), new GrassCoverErosionInwardsFailureMechanism(), assessmentSection))
{
// Call
bool closeForData = info.CloseForData(view, new GrassCoverErosionInwardsFailureMechanism());
// Assert
Assert.IsFalse(closeForData);
}
+ mocks.VerifyAll();
}
[Test]
public void CloseForData_ViewCorrespondingToRemovedFailureMechanism_ReturnTrue()
{
// Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
var correspondingFailureMechanism = new GrassCoverErosionInwardsFailureMechanism();
- using (var view = new GrassCoverErosionInwardsScenariosView(correspondingFailureMechanism.CalculationsGroup, correspondingFailureMechanism))
+ using (var view = new GrassCoverErosionInwardsScenariosView(correspondingFailureMechanism.CalculationsGroup, correspondingFailureMechanism, assessmentSection))
{
// Call
bool closeForData = info.CloseForData(view, correspondingFailureMechanism);
// Assert
Assert.IsTrue(closeForData);
}
+ mocks.VerifyAll();
}
[Test]
@@ -194,7 +209,7 @@
assessmentSection.Stub(asm => asm.GetFailureMechanisms()).Return(new IFailureMechanism[0]);
mocks.ReplayAll();
- using (var view = new GrassCoverErosionInwardsScenariosView(new CalculationGroup(), new GrassCoverErosionInwardsFailureMechanism()))
+ using (var view = new GrassCoverErosionInwardsScenariosView(new CalculationGroup(), new GrassCoverErosionInwardsFailureMechanism(), assessmentSection))
{
// Call
bool closeForData = info.CloseForData(view, assessmentSection);
@@ -217,7 +232,7 @@
var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
var failureMechanismContext = new GrassCoverErosionInwardsFailureMechanismContext(new GrassCoverErosionInwardsFailureMechanism(), assessmentSection);
- using (var view = new GrassCoverErosionInwardsScenariosView(failureMechanism.CalculationsGroup, failureMechanism))
+ using (var view = new GrassCoverErosionInwardsScenariosView(failureMechanism.CalculationsGroup, failureMechanism, assessmentSection))
{
// Call
bool closeForData = info.CloseForData(view, failureMechanismContext);
@@ -240,7 +255,7 @@
var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
var failureMechanismContext = new GrassCoverErosionInwardsFailureMechanismContext(failureMechanism, assessmentSection);
- using (var view = new GrassCoverErosionInwardsScenariosView(failureMechanism.CalculationsGroup, failureMechanism))
+ using (var view = new GrassCoverErosionInwardsScenariosView(failureMechanism.CalculationsGroup, failureMechanism, assessmentSection))
{
// Call
bool closeForData = info.CloseForData(view, failureMechanismContext);
@@ -256,9 +271,12 @@
public void AfterCreate_WithContext_ReturnsGrassCoverErosionInwardsScenariosView()
{
// Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
var group = new CalculationGroup();
- var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
- var context = new GrassCoverErosionInwardsScenariosContext(group, failureMechanism);
+ var context = new GrassCoverErosionInwardsScenariosContext(group, new GrassCoverErosionInwardsFailureMechanism(), assessmentSection);
// Call
using (IView view = info.CreateInstance(context))
@@ -267,6 +285,7 @@
Assert.IsInstanceOf(view);
Assert.AreSame(group, view.Data);
}
+ mocks.VerifyAll();
}
}
}
\ No newline at end of file