Index: Riskeer/Common/src/Riskeer.Common.Forms/PresentationObjects/HydraulicBoundaryLocationCalculationContext.cs =================================================================== diff -u -r6e3bc0437167a40cf4a79f0f04e31dc61ef4407f -r1ff69e48e3d825419ff83aeae34846b6d738541f --- Riskeer/Common/src/Riskeer.Common.Forms/PresentationObjects/HydraulicBoundaryLocationCalculationContext.cs (.../HydraulicBoundaryLocationCalculationContext.cs) (revision 6e3bc0437167a40cf4a79f0f04e31dc61ef4407f) +++ Riskeer/Common/src/Riskeer.Common.Forms/PresentationObjects/HydraulicBoundaryLocationCalculationContext.cs (.../HydraulicBoundaryLocationCalculationContext.cs) (revision 1ff69e48e3d825419ff83aeae34846b6d738541f) @@ -21,6 +21,7 @@ using System; using Core.Common.Controls.PresentationObjects; +using Riskeer.Common.Data.AssessmentSection; using Riskeer.Common.Data.Hydraulics; namespace Riskeer.Common.Forms.PresentationObjects @@ -35,8 +36,22 @@ /// /// The which the /// belongs to. - /// Thrown when is null. - protected HydraulicBoundaryLocationCalculationContext(HydraulicBoundaryLocationCalculation wrappedData) - : base(wrappedData) {} + /// The assessment section the calculation belongs to. + /// Thrown when any parameter is null. + protected HydraulicBoundaryLocationCalculationContext(HydraulicBoundaryLocationCalculation wrappedData, IAssessmentSection assessmentSection) + : base(wrappedData) + { + if (assessmentSection == null) + { + throw new ArgumentNullException(nameof(assessmentSection)); + } + + AssessmentSection = assessmentSection; + } + + /// + /// Gets the assessment section that the context belongs to. + /// + public IAssessmentSection AssessmentSection { get; } } } \ No newline at end of file Index: Riskeer/Common/test/Riskeer.Common.Forms.Test/PresentationObjects/HydraulicBoundaryLocationCalculationContextTest.cs =================================================================== diff -u -r6e3bc0437167a40cf4a79f0f04e31dc61ef4407f -r1ff69e48e3d825419ff83aeae34846b6d738541f --- Riskeer/Common/test/Riskeer.Common.Forms.Test/PresentationObjects/HydraulicBoundaryLocationCalculationContextTest.cs (.../HydraulicBoundaryLocationCalculationContextTest.cs) (revision 6e3bc0437167a40cf4a79f0f04e31dc61ef4407f) +++ Riskeer/Common/test/Riskeer.Common.Forms.Test/PresentationObjects/HydraulicBoundaryLocationCalculationContextTest.cs (.../HydraulicBoundaryLocationCalculationContextTest.cs) (revision 1ff69e48e3d825419ff83aeae34846b6d738541f) @@ -21,6 +21,8 @@ using Core.Common.Controls.PresentationObjects; using NUnit.Framework; +using Rhino.Mocks; +using Riskeer.Common.Data.AssessmentSection; using Riskeer.Common.Data.Hydraulics; using Riskeer.Common.Data.TestUtil; using Riskeer.Common.Forms.PresentationObjects; @@ -34,20 +36,26 @@ public void Constructor_ValidParameters_ExpectedValues() { // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + var hydraulicBoundaryLocationCalculation = new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation()); // Call - var context = new TestHydraulicBoundaryCalculationContext(hydraulicBoundaryLocationCalculation); + var context = new TestHydraulicBoundaryCalculationContext(hydraulicBoundaryLocationCalculation, assessmentSection); // Assert Assert.IsInstanceOf>(context); Assert.AreSame(hydraulicBoundaryLocationCalculation, context.WrappedData); + Assert.AreSame(assessmentSection, context.AssessmentSection); + mocks.VerifyAll(); } private class TestHydraulicBoundaryCalculationContext : HydraulicBoundaryLocationCalculationContext { - public TestHydraulicBoundaryCalculationContext(HydraulicBoundaryLocationCalculation calculation) - : base(calculation) {} + public TestHydraulicBoundaryCalculationContext(HydraulicBoundaryLocationCalculation calculation, IAssessmentSection assessmentSection) + : base(calculation, assessmentSection) {} } } } \ No newline at end of file