Index: Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/PresentationObjects/ClosingStructuresScenariosContext.cs
===================================================================
diff -u -rf5cd3b2ee9b7436f606ee6bc027b795accf0549d -r72392d6dfe2538a4566813a2a254e1c4dd19d01e
--- Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/PresentationObjects/ClosingStructuresScenariosContext.cs (.../ClosingStructuresScenariosContext.cs) (revision f5cd3b2ee9b7436f606ee6bc027b795accf0549d)
+++ Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/PresentationObjects/ClosingStructuresScenariosContext.cs (.../ClosingStructuresScenariosContext.cs) (revision 72392d6dfe2538a4566813a2a254e1c4dd19d01e)
@@ -22,6 +22,7 @@
using System;
using Core.Common.Controls.PresentationObjects;
using Riskeer.ClosingStructures.Data;
+using Riskeer.Common.Data.AssessmentSection;
using Riskeer.Common.Data.Calculation;
namespace Riskeer.ClosingStructures.Forms.PresentationObjects
@@ -37,21 +38,33 @@
///
/// The wrapped .
/// A forming the context.
+ /// The the belongs to.
/// Thrown when any parameter is null.
- public ClosingStructuresScenariosContext(CalculationGroup wrappedData, ClosingStructuresFailureMechanism failureMechanism)
+ public ClosingStructuresScenariosContext(CalculationGroup wrappedData, ClosingStructuresFailureMechanism 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;
}
///
/// The parent failure mechanism of the calculation group.
///
public ClosingStructuresFailureMechanism ParentFailureMechanism { get; }
+
+ ///
+ /// Gets the of the calculation group.
+ ///
+ public IAssessmentSection AssessmentSection { get; }
}
}
\ No newline at end of file
Index: Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Plugin/ClosingStructuresPlugin.cs
===================================================================
diff -u -r4c3b6a2ffc9aa9b193773b8ed818e59eb79b561b -r72392d6dfe2538a4566813a2a254e1c4dd19d01e
--- Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Plugin/ClosingStructuresPlugin.cs (.../ClosingStructuresPlugin.cs) (revision 4c3b6a2ffc9aa9b193773b8ed818e59eb79b561b)
+++ Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Plugin/ClosingStructuresPlugin.cs (.../ClosingStructuresPlugin.cs) (revision 72392d6dfe2538a4566813a2a254e1c4dd19d01e)
@@ -1,4 +1,4 @@
-// Copyright (C) Stichting Deltares 2019. All rights reserved.
+// Copyright (C) Stichting Deltares 2019. All rights reserved.
//
// This file is part of Riskeer.
//
@@ -364,7 +364,7 @@
return new object[]
{
new FailureMechanismAssemblyCategoriesContext(failureMechanism, assessmentSection, () => failureMechanism.GeneralInput.N),
- new ClosingStructuresScenariosContext(failureMechanism.CalculationsGroup, failureMechanism),
+ new ClosingStructuresScenariosContext(failureMechanism.CalculationsGroup, failureMechanism, assessmentSection),
new ProbabilityFailureMechanismSectionResultContext(
failureMechanism.SectionResults, failureMechanism, assessmentSection),
failureMechanism.OutputComments
Index: Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Forms.Test/PresentationObjects/ClosingStructuresScenariosContextTest.cs
===================================================================
diff -u -rd28e27005c5da2025e65e0544e70f89e5c08b67e -r72392d6dfe2538a4566813a2a254e1c4dd19d01e
--- Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Forms.Test/PresentationObjects/ClosingStructuresScenariosContextTest.cs (.../ClosingStructuresScenariosContextTest.cs) (revision d28e27005c5da2025e65e0544e70f89e5c08b67e)
+++ Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Forms.Test/PresentationObjects/ClosingStructuresScenariosContextTest.cs (.../ClosingStructuresScenariosContextTest.cs) (revision 72392d6dfe2538a4566813a2a254e1c4dd19d01e)
@@ -22,8 +22,10 @@
using System;
using Core.Common.Controls.PresentationObjects;
using NUnit.Framework;
+using Rhino.Mocks;
using Riskeer.ClosingStructures.Data;
using Riskeer.ClosingStructures.Forms.PresentationObjects;
+using Riskeer.Common.Data.AssessmentSection;
using Riskeer.Common.Data.Calculation;
namespace Riskeer.ClosingStructures.Forms.Test.PresentationObjects
@@ -35,30 +37,52 @@
public void Constructor_FailureMechanismNull_ThrowArgumentNullException()
{
// Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
var calculationGroup = new CalculationGroup();
// Call
- TestDelegate test = () => new ClosingStructuresScenariosContext(calculationGroup, null);
+ void Call() => new ClosingStructuresScenariosContext(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 ClosingStructuresScenariosContext(new CalculationGroup(), new ClosingStructuresFailureMechanism(), 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();
var failureMechanism = new ClosingStructuresFailureMechanism();
// Call
- var context = new ClosingStructuresScenariosContext(calculationGroup, failureMechanism);
+ var context = new ClosingStructuresScenariosContext(calculationGroup, failureMechanism, assessmentSection);
// Assert
Assert.IsInstanceOf>(context);
Assert.AreSame(calculationGroup, context.WrappedData);
Assert.AreSame(failureMechanism, context.ParentFailureMechanism);
+ Assert.AreSame(assessmentSection, context.AssessmentSection);
+ mocks.VerifyAll();
}
}
}
\ No newline at end of file
Index: Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Plugin.Test/ViewInfos/ClosingStructuresScenariosViewInfoTest.cs
===================================================================
diff -u -rd28e27005c5da2025e65e0544e70f89e5c08b67e -r72392d6dfe2538a4566813a2a254e1c4dd19d01e
--- Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Plugin.Test/ViewInfos/ClosingStructuresScenariosViewInfoTest.cs (.../ClosingStructuresScenariosViewInfoTest.cs) (revision d28e27005c5da2025e65e0544e70f89e5c08b67e)
+++ Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Plugin.Test/ViewInfos/ClosingStructuresScenariosViewInfoTest.cs (.../ClosingStructuresScenariosViewInfoTest.cs) (revision 72392d6dfe2538a4566813a2a254e1c4dd19d01e)
@@ -1,4 +1,4 @@
-// Copyright (C) Stichting Deltares 2019. All rights reserved.
+// Copyright (C) Stichting Deltares 2019. All rights reserved.
//
// This file is part of Riskeer.
//
@@ -78,15 +78,20 @@
public void GetViewData_Always_ReturnWrappedData()
{
// Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
var calculationGroup = new CalculationGroup();
var failureMechanism = new ClosingStructuresFailureMechanism();
- var context = new ClosingStructuresScenariosContext(calculationGroup, failureMechanism);
+ var context = new ClosingStructuresScenariosContext(calculationGroup, failureMechanism, assessmentSection);
// Call
object viewData = info.GetViewData(context);
// Assert
Assert.AreSame(calculationGroup, viewData);
+ mocks.VerifyAll();
}
[Test]