Index: Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Plugin/ClosingStructuresPlugin.cs
===================================================================
diff -u -r3c832ffce74b527eb1d588aa722840f0a80330b7 -rbf42d7f7a0afd26840ae4bbecd47ab417b2c4915
--- Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Plugin/ClosingStructuresPlugin.cs (.../ClosingStructuresPlugin.cs) (revision 3c832ffce74b527eb1d588aa722840f0a80330b7)
+++ Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Plugin/ClosingStructuresPlugin.cs (.../ClosingStructuresPlugin.cs) (revision bf42d7f7a0afd26840ae4bbecd47ab417b2c4915)
@@ -713,7 +713,7 @@
calculation,
context.FailureMechanism,
context.AssessmentSection),
- new StructuresOutputContext(calculation)
+ new StructuresOutputContext(calculation, context.AssessmentSection)
};
}
Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Plugin.Test/TreeNodeInfos/ClosingStructuresCalculationContextTreeNodeInfoTest.cs
===================================================================
diff -u -r39e18750ccb61ad1f367279f9dac39a232d4f843 -rbf42d7f7a0afd26840ae4bbecd47ab417b2c4915
--- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Plugin.Test/TreeNodeInfos/ClosingStructuresCalculationContextTreeNodeInfoTest.cs (.../ClosingStructuresCalculationContextTreeNodeInfoTest.cs) (revision 39e18750ccb61ad1f367279f9dac39a232d4f843)
+++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Plugin.Test/TreeNodeInfos/ClosingStructuresCalculationContextTreeNodeInfoTest.cs (.../ClosingStructuresCalculationContextTreeNodeInfoTest.cs) (revision bf42d7f7a0afd26840ae4bbecd47ab417b2c4915)
@@ -143,6 +143,7 @@
var structuresOutputContext = children[2] as StructuresOutputContext;
Assert.IsNotNull(structuresOutputContext);
Assert.AreSame(calculationContext.WrappedData, structuresOutputContext.WrappedData);
+ Assert.AreSame(calculationContext.AssessmentSection, structuresOutputContext.AssessmentSection);
}
[Test]
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/StructuresOutputContext.cs
===================================================================
diff -u -r32146135b20d9eee5707e72eecf71f4b433c2499 -rbf42d7f7a0afd26840ae4bbecd47ab417b2c4915
--- Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/StructuresOutputContext.cs (.../StructuresOutputContext.cs) (revision 32146135b20d9eee5707e72eecf71f4b433c2499)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/StructuresOutputContext.cs (.../StructuresOutputContext.cs) (revision bf42d7f7a0afd26840ae4bbecd47ab417b2c4915)
@@ -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.Common.Data.Structures;
namespace Ringtoets.Common.Forms.PresentationObjects
@@ -33,6 +35,22 @@
/// Creates a new instance of .
///
/// The structures calculation wrapped by the context object.
- public StructuresOutputContext(IStructuresCalculation wrappedData) : base(wrappedData) {}
+ /// The assessment section the calculation belongs to.
+ /// Thrown when any parameter is null.
+ public StructuresOutputContext(IStructuresCalculation wrappedData, IAssessmentSection assessmentSection)
+ : base(wrappedData)
+ {
+ if (assessmentSection == null)
+ {
+ throw new ArgumentNullException(nameof(assessmentSection));
+ }
+
+ AssessmentSection = assessmentSection;
+ }
+
+ ///
+ /// Gets the assessment section.
+ ///
+ public IAssessmentSection AssessmentSection { get; }
}
}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/StructuresOutputContextTest.cs
===================================================================
diff -u -rf92c12d3daee673bf220459c0c7af94893743f41 -rbf42d7f7a0afd26840ae4bbecd47ab417b2c4915
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/StructuresOutputContextTest.cs (.../StructuresOutputContextTest.cs) (revision f92c12d3daee673bf220459c0c7af94893743f41)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/StructuresOutputContextTest.cs (.../StructuresOutputContextTest.cs) (revision bf42d7f7a0afd26840ae4bbecd47ab417b2c4915)
@@ -19,9 +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.Common.Data.Structures;
using Ringtoets.Common.Forms.PresentationObjects;
@@ -31,20 +33,39 @@
public class StructuresOutputContextTest
{
[Test]
- public void ParameteredConstructor_ExpectedValues()
+ public void Constructor_ExpectedValues()
{
// Setup
var mocks = new MockRepository();
var structuresCalculation = mocks.Stub();
+ var assessmentSection = mocks.Stub();
mocks.ReplayAll();
// Call
- var structuresOutputContext = new StructuresOutputContext(structuresCalculation);
+ var structuresOutputContext = new StructuresOutputContext(structuresCalculation, assessmentSection);
// Assert
Assert.IsInstanceOf>(structuresOutputContext);
Assert.AreSame(structuresCalculation, structuresOutputContext.WrappedData);
+ Assert.AreSame(assessmentSection, structuresOutputContext.AssessmentSection);
mocks.VerifyAll();
}
+
+ [Test]
+ public void Constructor_AssessmentSectionNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var structuresCalculation = mocks.Stub();
+ mocks.ReplayAll();
+
+ // Call
+ TestDelegate call = () => new StructuresOutputContext(structuresCalculation, null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("assessmentSection", exception.ParamName);
+ mocks.VerifyAll();
+ }
}
}
\ No newline at end of file
Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresPlugin.cs
===================================================================
diff -u -r3c832ffce74b527eb1d588aa722840f0a80330b7 -rbf42d7f7a0afd26840ae4bbecd47ab417b2c4915
--- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresPlugin.cs (.../HeightStructuresPlugin.cs) (revision 3c832ffce74b527eb1d588aa722840f0a80330b7)
+++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresPlugin.cs (.../HeightStructuresPlugin.cs) (revision bf42d7f7a0afd26840ae4bbecd47ab417b2c4915)
@@ -725,7 +725,7 @@
calculation,
context.FailureMechanism,
context.AssessmentSection),
- new StructuresOutputContext(calculation)
+ new StructuresOutputContext(calculation, context.AssessmentSection)
};
}
Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/TreeNodeInfos/HeightStructuresCalculationContextTreeNodeInfoTest.cs
===================================================================
diff -u -r39e18750ccb61ad1f367279f9dac39a232d4f843 -rbf42d7f7a0afd26840ae4bbecd47ab417b2c4915
--- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/TreeNodeInfos/HeightStructuresCalculationContextTreeNodeInfoTest.cs (.../HeightStructuresCalculationContextTreeNodeInfoTest.cs) (revision 39e18750ccb61ad1f367279f9dac39a232d4f843)
+++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/TreeNodeInfos/HeightStructuresCalculationContextTreeNodeInfoTest.cs (.../HeightStructuresCalculationContextTreeNodeInfoTest.cs) (revision bf42d7f7a0afd26840ae4bbecd47ab417b2c4915)
@@ -157,6 +157,7 @@
var structuresOutputContext = children[2] as StructuresOutputContext;
Assert.IsNotNull(structuresOutputContext);
Assert.AreSame(calculationContext.WrappedData, structuresOutputContext.WrappedData);
+ Assert.AreSame(calculationContext.AssessmentSection, structuresOutputContext.AssessmentSection);
}
[Test]
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/StructuresOutputContextPropertyInfoTest.cs
===================================================================
diff -u -rf92c12d3daee673bf220459c0c7af94893743f41 -rbf42d7f7a0afd26840ae4bbecd47ab417b2c4915
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/StructuresOutputContextPropertyInfoTest.cs (.../StructuresOutputContextPropertyInfoTest.cs) (revision f92c12d3daee673bf220459c0c7af94893743f41)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/StructuresOutputContextPropertyInfoTest.cs (.../StructuresOutputContextPropertyInfoTest.cs) (revision bf42d7f7a0afd26840ae4bbecd47ab417b2c4915)
@@ -24,6 +24,7 @@
using Core.Common.Gui.PropertyBag;
using NUnit.Framework;
using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.Data.Structures;
using Ringtoets.Common.Data.TestUtil;
using Ringtoets.Common.Forms.PresentationObjects;
@@ -62,16 +63,16 @@
public void CreateInstance_StructuresOutputContext_ReturnStructuresOutputProperties()
{
// Setup
- var mocks = new MockRepository();
- var structuresCalculation = mocks.Stub();
var structuresOutput = new StructuresOutput(new TestProbabilityAssessmentOutput(), null);
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ var structuresCalculation = mocks.Stub();
structuresCalculation.Stub(c => c.Output).Return(structuresOutput);
-
mocks.ReplayAll();
// Call
- IObjectProperties objectProperties = info.CreateInstance(new StructuresOutputContext(structuresCalculation));
+ IObjectProperties objectProperties = info.CreateInstance(new StructuresOutputContext(structuresCalculation, assessmentSection));
// Assert
Assert.IsInstanceOf(objectProperties);
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/StructuresOutputContextTreeNodeInfoTest.cs
===================================================================
diff -u -rfe90a6d174a01975381e6cda55ed1f7f4e831a51 -rbf42d7f7a0afd26840ae4bbecd47ab417b2c4915
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/StructuresOutputContextTreeNodeInfoTest.cs (.../StructuresOutputContextTreeNodeInfoTest.cs) (revision fe90a6d174a01975381e6cda55ed1f7f4e831a51)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/StructuresOutputContextTreeNodeInfoTest.cs (.../StructuresOutputContextTreeNodeInfoTest.cs) (revision bf42d7f7a0afd26840ae4bbecd47ab417b2c4915)
@@ -27,6 +27,7 @@
using Core.Common.TestUtil;
using NUnit.Framework;
using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.Data.Structures;
using Ringtoets.Common.Forms.PresentationObjects;
using Ringtoets.Common.Forms.Properties;
@@ -99,11 +100,12 @@
public void ForeColor_HasNoOutput_ReturnGrayText()
{
// Setup
+ var assessmentSection = mocksRepository.Stub();
var structuresCalculation = mocksRepository.Stub();
mocksRepository.ReplayAll();
// Call
- Color color = info.ForeColor(new StructuresOutputContext(structuresCalculation));
+ Color color = info.ForeColor(new StructuresOutputContext(structuresCalculation, assessmentSection));
// Assert
Assert.AreEqual(Color.FromKnownColor(KnownColor.GrayText), color);
@@ -113,12 +115,13 @@
public void ForeColor_HasOutput_ReturnControlText()
{
// Setup
+ var assessmentSection = mocksRepository.Stub();
var structuresCalculation = mocksRepository.Stub();
structuresCalculation.Stub(c => c.HasOutput).Return(true);
mocksRepository.ReplayAll();
// Call
- Color color = info.ForeColor(new StructuresOutputContext(structuresCalculation));
+ Color color = info.ForeColor(new StructuresOutputContext(structuresCalculation, assessmentSection));
// Assert
Assert.AreEqual(Color.FromKnownColor(KnownColor.ControlText), color);
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/GeneralResultFaultTreeIllustrationPointViewInfoTest.cs
===================================================================
diff -u -re919aacb7342da4be2675964c281d133f8dc4abb -rbf42d7f7a0afd26840ae4bbecd47ab417b2c4915
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/GeneralResultFaultTreeIllustrationPointViewInfoTest.cs (.../GeneralResultFaultTreeIllustrationPointViewInfoTest.cs) (revision e919aacb7342da4be2675964c281d133f8dc4abb)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/GeneralResultFaultTreeIllustrationPointViewInfoTest.cs (.../GeneralResultFaultTreeIllustrationPointViewInfoTest.cs) (revision bf42d7f7a0afd26840ae4bbecd47ab417b2c4915)
@@ -89,12 +89,12 @@
{
// Setup
var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
var structuresCalculation = mocks.Stub();
-
mocks.ReplayAll();
// Call
- object viewData = info.GetViewData(new StructuresOutputContext(structuresCalculation));
+ object viewData = info.GetViewData(new StructuresOutputContext(structuresCalculation, assessmentSection));
// Assert
Assert.AreSame(structuresCalculation, viewData);
Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Plugin/StabilityPointStructuresPlugin.cs
===================================================================
diff -u -r3c832ffce74b527eb1d588aa722840f0a80330b7 -rbf42d7f7a0afd26840ae4bbecd47ab417b2c4915
--- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Plugin/StabilityPointStructuresPlugin.cs (.../StabilityPointStructuresPlugin.cs) (revision 3c832ffce74b527eb1d588aa722840f0a80330b7)
+++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Plugin/StabilityPointStructuresPlugin.cs (.../StabilityPointStructuresPlugin.cs) (revision bf42d7f7a0afd26840ae4bbecd47ab417b2c4915)
@@ -725,7 +725,7 @@
calculation,
context.FailureMechanism,
context.AssessmentSection),
- new StructuresOutputContext(calculation)
+ new StructuresOutputContext(calculation, context.AssessmentSection)
};
}
Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/TreeNodeInfos/StabilityPointStructuresCalculationContextTreeNodeInfoTest.cs
===================================================================
diff -u -r39e18750ccb61ad1f367279f9dac39a232d4f843 -rbf42d7f7a0afd26840ae4bbecd47ab417b2c4915
--- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/TreeNodeInfos/StabilityPointStructuresCalculationContextTreeNodeInfoTest.cs (.../StabilityPointStructuresCalculationContextTreeNodeInfoTest.cs) (revision 39e18750ccb61ad1f367279f9dac39a232d4f843)
+++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/TreeNodeInfos/StabilityPointStructuresCalculationContextTreeNodeInfoTest.cs (.../StabilityPointStructuresCalculationContextTreeNodeInfoTest.cs) (revision bf42d7f7a0afd26840ae4bbecd47ab417b2c4915)
@@ -141,6 +141,7 @@
var structuresOutputContext = children[2] as StructuresOutputContext;
Assert.IsNotNull(structuresOutputContext);
Assert.AreSame(calculationContext.WrappedData, structuresOutputContext.WrappedData);
+ Assert.AreSame(calculationContext.AssessmentSection, structuresOutputContext.AssessmentSection);
}
[Test]