Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/PresentationObjects/HeightStructuresInputContext.cs =================================================================== diff -u -r46ef6c094cc1589938bc88bee6f5bdac70233462 -r7823eab06c968c167d9d5b24a30acaa344478dc0 --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/PresentationObjects/HeightStructuresInputContext.cs (.../HeightStructuresInputContext.cs) (revision 46ef6c094cc1589938bc88bee6f5bdac70233462) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/PresentationObjects/HeightStructuresInputContext.cs (.../HeightStructuresInputContext.cs) (revision 7823eab06c968c167d9d5b24a30acaa344478dc0) @@ -35,22 +35,15 @@ /// /// Creates a new instance of . /// + /// The calculation input wrapped by the context object. /// The height structures calculation containing the . /// The failure mechanism which the context belongs to. /// The assessment section which the context belongs to. /// Thrown when any input argument is null. - public HeightStructuresInputContext(HeightStructuresCalculation calculation, + public HeightStructuresInputContext(HeightStructuresInput wrappedData, + HeightStructuresCalculation calculation, HeightStructuresFailureMechanism failureMechanism, IAssessmentSection assessmentSection) - : base(ValidateCalculation(calculation).InputParameters, calculation, failureMechanism, assessmentSection) {} - - private static HeightStructuresCalculation ValidateCalculation(HeightStructuresCalculation calculation) - { - if (calculation == null) - { - throw new ArgumentNullException("calculation"); - } - return calculation; - } + : base(wrappedData, calculation, failureMechanism, assessmentSection) {} } } \ No newline at end of file Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresPlugin.cs =================================================================== diff -u -r5724d9646d808c712d3bd87ecc89d8e23426c83f -r7823eab06c968c167d9d5b24a30acaa344478dc0 --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresPlugin.cs (.../HeightStructuresPlugin.cs) (revision 5724d9646d808c712d3bd87ecc89d8e23426c83f) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresPlugin.cs (.../HeightStructuresPlugin.cs) (revision 7823eab06c968c167d9d5b24a30acaa344478dc0) @@ -534,7 +534,8 @@ var childNodes = new List { new CommentContext(context.WrappedData), - new HeightStructuresInputContext(context.WrappedData, + new HeightStructuresInputContext(context.WrappedData.InputParameters, + context.WrappedData, context.FailureMechanism, context.AssessmentSection) }; Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PresentationObjects/HeightStructuresInputContextTest.cs =================================================================== diff -u -rca23b1b155ca87c0aa4665fd919727570f31c781 -r7823eab06c968c167d9d5b24a30acaa344478dc0 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PresentationObjects/HeightStructuresInputContextTest.cs (.../HeightStructuresInputContextTest.cs) (revision ca23b1b155ca87c0aa4665fd919727570f31c781) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PresentationObjects/HeightStructuresInputContextTest.cs (.../HeightStructuresInputContextTest.cs) (revision 7823eab06c968c167d9d5b24a30acaa344478dc0) @@ -19,7 +19,6 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. -using System; using NUnit.Framework; using Rhino.Mocks; using Ringtoets.Common.Data.AssessmentSection; @@ -34,25 +33,6 @@ public class HeightStructuresInputContextTest { [Test] - public void Constructor_CalcationIsNull_ThrowsArgumentNullException() - { - // Setup - var mocks = new MockRepository(); - var assessmentSectionMock = mocks.Stub(); - mocks.ReplayAll(); - - var failureMechanism = new HeightStructuresFailureMechanism(); - - // Call - TestDelegate test = () => new HeightStructuresInputContext(null, failureMechanism, assessmentSectionMock); - - // Assert - string paramName = Assert.Throws(test).ParamName; - Assert.AreEqual("calculation", paramName); - mocks.VerifyAll(); - } - - [Test] public void Constructor_ValidInputParameters_ExpectedValues() { // Setup @@ -64,10 +44,13 @@ var failureMechanism = new HeightStructuresFailureMechanism(); // Call - var context = new HeightStructuresInputContext(calculation, failureMechanism, assessmentSectionMock); + var context = new HeightStructuresInputContext(calculation.InputParameters, + calculation, + failureMechanism, + assessmentSectionMock); // Assert - Assert.IsInstanceOf>(context); + Assert.IsInstanceOf>(context); Assert.AreSame(calculation.InputParameters, context.WrappedData); Assert.AreSame(calculation, context.Calculation); Assert.AreSame(failureMechanism, context.FailureMechanism); Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PropertyClasses/HeightStructuresInputContextPropertiesTest.cs =================================================================== diff -u -rcad219225ee11e816a86a0763d7b888a4d49d8a0 -r7823eab06c968c167d9d5b24a30acaa344478dc0 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PropertyClasses/HeightStructuresInputContextPropertiesTest.cs (.../HeightStructuresInputContextPropertiesTest.cs) (revision cad219225ee11e816a86a0763d7b888a4d49d8a0) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PropertyClasses/HeightStructuresInputContextPropertiesTest.cs (.../HeightStructuresInputContextPropertiesTest.cs) (revision 7823eab06c968c167d9d5b24a30acaa344478dc0) @@ -36,7 +36,6 @@ using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Forms.Helpers; using Ringtoets.Common.Forms.PropertyClasses; -using Ringtoets.Common.Forms.UITypeEditors; using Ringtoets.HeightStructures.Data; using Ringtoets.HeightStructures.Data.TestUtil; using Ringtoets.HeightStructures.Forms.PresentationObjects; @@ -96,7 +95,10 @@ var calculation = new HeightStructuresCalculation(); var properties = new HeightStructuresInputContextProperties(); - var inputContext = new HeightStructuresInputContext(calculation, failureMechanism, assessmentSectionMock); + var inputContext = new HeightStructuresInputContext(calculation.InputParameters, + calculation, + failureMechanism, + assessmentSectionMock); // Call properties.Data = inputContext; @@ -162,7 +164,8 @@ } }; - var inputContext = new HeightStructuresInputContext(calculation, + var inputContext = new HeightStructuresInputContext(calculation.InputParameters, + calculation, failureMechanism, assessmentSectionMock); var properties = new HeightStructuresInputContextProperties(); @@ -219,7 +222,10 @@ var calculation = new HeightStructuresCalculation(); var input = calculation.InputParameters; input.Attach(observerMock); - var inputContext = new HeightStructuresInputContext(calculation, failureMechanism, assessmentSectionMock); + var inputContext = new HeightStructuresInputContext(input, + calculation, + failureMechanism, + assessmentSectionMock); var properties = new HeightStructuresInputContextProperties { @@ -264,7 +270,10 @@ var failureMechanism = new HeightStructuresFailureMechanism(); var calculation = new HeightStructuresCalculation(); - var inputContext = new HeightStructuresInputContext(calculation, failureMechanism, assessmentSectionMock); + var inputContext = new HeightStructuresInputContext(calculation.InputParameters, + calculation, + failureMechanism, + assessmentSectionMock); var properties = new HeightStructuresInputContextProperties { @@ -292,7 +301,10 @@ var failureMechanism = new HeightStructuresFailureMechanism(); var calculation = new HeightStructuresCalculation(); - var inputContext = new HeightStructuresInputContext(calculation, failureMechanism, assessmentSectionMock); + var inputContext = new HeightStructuresInputContext(calculation.InputParameters, + calculation, + failureMechanism, + assessmentSectionMock); var properties = new HeightStructuresInputContextProperties { @@ -318,7 +330,10 @@ var failureMechanism = new HeightStructuresFailureMechanism(); var calculation = new HeightStructuresCalculation(); - var inputContext = new HeightStructuresInputContext(calculation, failureMechanism, assessmentSectionMock); + var inputContext = new HeightStructuresInputContext(calculation.InputParameters, + calculation, + failureMechanism, + assessmentSectionMock); var properties = new HeightStructuresInputContextProperties { @@ -344,7 +359,10 @@ var failureMechanism = new HeightStructuresFailureMechanism(); var calculation = new HeightStructuresCalculation(); - var inputContext = new HeightStructuresInputContext(calculation, failureMechanism, assessmentSectionMock); + var inputContext = new HeightStructuresInputContext(calculation.InputParameters, + calculation, + failureMechanism, + assessmentSectionMock); // Call var properties = new HeightStructuresInputContextProperties Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresInputContextTreeNodeInfoTest.cs =================================================================== diff -u -r5d503cf8885ced4799e5ad44242038d99e04b162 -r7823eab06c968c167d9d5b24a30acaa344478dc0 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresInputContextTreeNodeInfoTest.cs (.../HeightStructuresInputContextTreeNodeInfoTest.cs) (revision 5d503cf8885ced4799e5ad44242038d99e04b162) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresInputContextTreeNodeInfoTest.cs (.../HeightStructuresInputContextTreeNodeInfoTest.cs) (revision 7823eab06c968c167d9d5b24a30acaa344478dc0) @@ -91,9 +91,12 @@ var assessmentSectionStub = mocksRepository.Stub(); mocksRepository.ReplayAll(); - var heightStructuresInputContext = new HeightStructuresInputContext(new HeightStructuresCalculation(), - new HeightStructuresFailureMechanism(), - assessmentSectionStub); + var heightStructuresCalculation = new HeightStructuresCalculation(); + var heightStructuresInputContext = new HeightStructuresInputContext( + heightStructuresCalculation.InputParameters, + heightStructuresCalculation, + new HeightStructuresFailureMechanism(), + assessmentSectionStub); // Call var text = info.Text(heightStructuresInputContext); @@ -106,12 +109,15 @@ public void Image_Always_ReturnsSetImage() { // Setup - var assessmentSectionStub = mocksRepository.Stub(); + var assessmentSectionStub = mocksRepository.Stub(); mocksRepository.ReplayAll(); - var heightStructuresInputContext = new HeightStructuresInputContext(new HeightStructuresCalculation(), - new HeightStructuresFailureMechanism(), - assessmentSectionStub); + var heightStructuresCalculation = new HeightStructuresCalculation(); + var heightStructuresInputContext = new HeightStructuresInputContext( + heightStructuresCalculation.InputParameters, + heightStructuresCalculation, + new HeightStructuresFailureMechanism(), + assessmentSectionStub); // Call var image = info.Image(heightStructuresInputContext);