Index: Riskeer/Common/src/Riskeer.Common.Forms/PresentationObjects/HydraulicBoundaryLocationCalculationsForUserDefinedTargetProbabilitiesGroupContext.cs =================================================================== diff -u --- Riskeer/Common/src/Riskeer.Common.Forms/PresentationObjects/HydraulicBoundaryLocationCalculationsForUserDefinedTargetProbabilitiesGroupContext.cs (revision 0) +++ Riskeer/Common/src/Riskeer.Common.Forms/PresentationObjects/HydraulicBoundaryLocationCalculationsForUserDefinedTargetProbabilitiesGroupContext.cs (revision a87681a8625134e43c91ef41e7b90d7c412db325) @@ -0,0 +1,40 @@ +using System; +using Core.Common.Base; +using Core.Common.Controls.PresentationObjects; +using Riskeer.Common.Data.AssessmentSection; +using Riskeer.Common.Data.Hydraulics; + +namespace Riskeer.Common.Forms.PresentationObjects +{ + /// + /// Presentation object for all hydraulic boundary location calculations based on user defined target probabilities. + /// + public abstract class HydraulicBoundaryLocationCalculationsForUserDefinedTargetProbabilitiesGroupContext + : ObservableWrappedObjectContextBase> + { + /// + /// Creates a new instance of . + /// + /// The calculations wrapped by the + /// . + /// The that the + /// belongs to. + /// Thrown when any parameter is null. + protected HydraulicBoundaryLocationCalculationsForUserDefinedTargetProbabilitiesGroupContext(ObservableList 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/src/Riskeer.Common.Forms/PresentationObjects/WaterLevelCalculationsForUserDefinedTargetProbabilitiesGroupContext.cs =================================================================== diff -u -r9719d6ccb6c1bb1aba788f160fedc8135e87462e -ra87681a8625134e43c91ef41e7b90d7c412db325 --- Riskeer/Common/src/Riskeer.Common.Forms/PresentationObjects/WaterLevelCalculationsForUserDefinedTargetProbabilitiesGroupContext.cs (.../WaterLevelCalculationsForUserDefinedTargetProbabilitiesGroupContext.cs) (revision 9719d6ccb6c1bb1aba788f160fedc8135e87462e) +++ Riskeer/Common/src/Riskeer.Common.Forms/PresentationObjects/WaterLevelCalculationsForUserDefinedTargetProbabilitiesGroupContext.cs (.../WaterLevelCalculationsForUserDefinedTargetProbabilitiesGroupContext.cs) (revision a87681a8625134e43c91ef41e7b90d7c412db325) @@ -21,7 +21,6 @@ using System; using Core.Common.Base; -using Core.Common.Controls.PresentationObjects; using Riskeer.Common.Data.AssessmentSection; using Riskeer.Common.Data.Hydraulics; @@ -30,7 +29,7 @@ /// /// Presentation object for all water level calculations based on user defined target probabilities. /// - public class WaterLevelCalculationsForUserDefinedTargetProbabilitiesGroupContext : ObservableWrappedObjectContextBase> + public class WaterLevelCalculationsForUserDefinedTargetProbabilitiesGroupContext : HydraulicBoundaryLocationCalculationsForUserDefinedTargetProbabilitiesGroupContext { /// /// Creates a new instance of . @@ -40,19 +39,6 @@ /// Thrown when any parameter is null. public WaterLevelCalculationsForUserDefinedTargetProbabilitiesGroupContext(ObservableList 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; } + : base(wrappedData, assessmentSection) {} } } \ No newline at end of file Index: Riskeer/Common/src/Riskeer.Common.Forms/PresentationObjects/WaveHeightCalculationsForUserDefinedTargetProbabilitiesGroupContext.cs =================================================================== diff -u -r9719d6ccb6c1bb1aba788f160fedc8135e87462e -ra87681a8625134e43c91ef41e7b90d7c412db325 --- Riskeer/Common/src/Riskeer.Common.Forms/PresentationObjects/WaveHeightCalculationsForUserDefinedTargetProbabilitiesGroupContext.cs (.../WaveHeightCalculationsForUserDefinedTargetProbabilitiesGroupContext.cs) (revision 9719d6ccb6c1bb1aba788f160fedc8135e87462e) +++ Riskeer/Common/src/Riskeer.Common.Forms/PresentationObjects/WaveHeightCalculationsForUserDefinedTargetProbabilitiesGroupContext.cs (.../WaveHeightCalculationsForUserDefinedTargetProbabilitiesGroupContext.cs) (revision a87681a8625134e43c91ef41e7b90d7c412db325) @@ -21,7 +21,6 @@ using System; using Core.Common.Base; -using Core.Common.Controls.PresentationObjects; using Riskeer.Common.Data.AssessmentSection; using Riskeer.Common.Data.Hydraulics; @@ -30,7 +29,7 @@ /// /// Presentation object for all wave height calculations based on user defined target probabilities. /// - public class WaveHeightCalculationsForUserDefinedTargetProbabilitiesGroupContext : ObservableWrappedObjectContextBase> + public class WaveHeightCalculationsForUserDefinedTargetProbabilitiesGroupContext : HydraulicBoundaryLocationCalculationsForUserDefinedTargetProbabilitiesGroupContext { /// /// Creates a new instance of . @@ -40,19 +39,6 @@ /// Thrown when any parameter is null. public WaveHeightCalculationsForUserDefinedTargetProbabilitiesGroupContext(ObservableList 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; } + : base(wrappedData, assessmentSection) {} } } \ No newline at end of file Index: Riskeer/Common/test/Riskeer.Common.Forms.Test/PresentationObjects/HydraulicBoundaryLocationCalculationsForUserDefinedTargetProbabilitiesGroupContextTest.cs =================================================================== diff -u --- Riskeer/Common/test/Riskeer.Common.Forms.Test/PresentationObjects/HydraulicBoundaryLocationCalculationsForUserDefinedTargetProbabilitiesGroupContextTest.cs (revision 0) +++ Riskeer/Common/test/Riskeer.Common.Forms.Test/PresentationObjects/HydraulicBoundaryLocationCalculationsForUserDefinedTargetProbabilitiesGroupContextTest.cs (revision a87681a8625134e43c91ef41e7b90d7c412db325) @@ -0,0 +1,75 @@ +// Copyright (C) Stichting Deltares 2021. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Core.Common.Base; +using Core.Common.Controls.PresentationObjects; +using NUnit.Framework; +using Rhino.Mocks; +using Riskeer.Common.Data.AssessmentSection; +using Riskeer.Common.Data.Hydraulics; +using Riskeer.Common.Forms.PresentationObjects; + +namespace Riskeer.Common.Forms.Test.PresentationObjects +{ + [TestFixture] + public class HydraulicBoundaryLocationCalculationsForUserDefinedTargetProbabilitiesGroupContextTest + { + [Test] + public void Constructor_AssessmentSectionNull_ThrowsArgumentNullException() + { + // Call + void Call() => new TestHydraulicBoundaryLocationCalculationsForUserDefinedTargetProbabilitiesGroupContext(new ObservableList(), null); + + // Assert + var exception = Assert.Throws(Call); + Assert.AreEqual("assessmentSection", exception.ParamName); + } + + [Test] + public void Constructor_ExpectedValues() + { + // Setup + var mockRepository = new MockRepository(); + var assessmentSection = mockRepository.Stub(); + mockRepository.ReplayAll(); + + var calculations = new ObservableList(); + + // Call + var context = new TestHydraulicBoundaryLocationCalculationsForUserDefinedTargetProbabilitiesGroupContext(calculations, assessmentSection); + + // Assert + Assert.IsInstanceOf>>(context); + Assert.AreSame(calculations, context.WrappedData); + Assert.AreSame(assessmentSection, context.AssessmentSection); + mockRepository.VerifyAll(); + } + + private class TestHydraulicBoundaryLocationCalculationsForUserDefinedTargetProbabilitiesGroupContext + : HydraulicBoundaryLocationCalculationsForUserDefinedTargetProbabilitiesGroupContext + { + public TestHydraulicBoundaryLocationCalculationsForUserDefinedTargetProbabilitiesGroupContext( + ObservableList wrappedData, IAssessmentSection assessmentSection) + : base(wrappedData, assessmentSection) {} + } + } +} \ No newline at end of file Index: Riskeer/Common/test/Riskeer.Common.Forms.Test/PresentationObjects/WaterLevelCalculationsForUserDefinedTargetProbabilitiesGroupContextTest.cs =================================================================== diff -u -r2a1abc74560c6ef1f82fa9dd3023d3f8adb09dba -ra87681a8625134e43c91ef41e7b90d7c412db325 --- Riskeer/Common/test/Riskeer.Common.Forms.Test/PresentationObjects/WaterLevelCalculationsForUserDefinedTargetProbabilitiesGroupContextTest.cs (.../WaterLevelCalculationsForUserDefinedTargetProbabilitiesGroupContextTest.cs) (revision 2a1abc74560c6ef1f82fa9dd3023d3f8adb09dba) +++ Riskeer/Common/test/Riskeer.Common.Forms.Test/PresentationObjects/WaterLevelCalculationsForUserDefinedTargetProbabilitiesGroupContextTest.cs (.../WaterLevelCalculationsForUserDefinedTargetProbabilitiesGroupContextTest.cs) (revision a87681a8625134e43c91ef41e7b90d7c412db325) @@ -19,9 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. -using System; using Core.Common.Base; -using Core.Common.Controls.PresentationObjects; using NUnit.Framework; using Rhino.Mocks; using Riskeer.Common.Data.AssessmentSection; @@ -34,17 +32,6 @@ public class WaterLevelCalculationsForUserDefinedTargetProbabilitiesGroupContextTest { [Test] - public void Constructor_AssessmentSectionNull_ThrowsArgumentNullException() - { - // Call - void Call() => new WaterLevelCalculationsForUserDefinedTargetProbabilitiesGroupContext(new ObservableList(), null); - - // Assert - var exception = Assert.Throws(Call); - Assert.AreEqual("assessmentSection", exception.ParamName); - } - - [Test] public void Constructor_ExpectedValues() { // Setup @@ -58,7 +45,7 @@ var context = new WaterLevelCalculationsForUserDefinedTargetProbabilitiesGroupContext(calculations, assessmentSection); // Assert - Assert.IsInstanceOf>>(context); + Assert.IsInstanceOf(context); Assert.AreSame(calculations, context.WrappedData); Assert.AreSame(assessmentSection, context.AssessmentSection); mockRepository.VerifyAll(); Index: Riskeer/Common/test/Riskeer.Common.Forms.Test/PresentationObjects/WaveHeightCalculationsForUserDefinedTargetProbabilitiesGroupContextTest.cs =================================================================== diff -u -r2a1abc74560c6ef1f82fa9dd3023d3f8adb09dba -ra87681a8625134e43c91ef41e7b90d7c412db325 --- Riskeer/Common/test/Riskeer.Common.Forms.Test/PresentationObjects/WaveHeightCalculationsForUserDefinedTargetProbabilitiesGroupContextTest.cs (.../WaveHeightCalculationsForUserDefinedTargetProbabilitiesGroupContextTest.cs) (revision 2a1abc74560c6ef1f82fa9dd3023d3f8adb09dba) +++ Riskeer/Common/test/Riskeer.Common.Forms.Test/PresentationObjects/WaveHeightCalculationsForUserDefinedTargetProbabilitiesGroupContextTest.cs (.../WaveHeightCalculationsForUserDefinedTargetProbabilitiesGroupContextTest.cs) (revision a87681a8625134e43c91ef41e7b90d7c412db325) @@ -19,9 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. -using System; using Core.Common.Base; -using Core.Common.Controls.PresentationObjects; using NUnit.Framework; using Rhino.Mocks; using Riskeer.Common.Data.AssessmentSection; @@ -34,17 +32,6 @@ public class WaveHeightCalculationsForUserDefinedTargetProbabilitiesGroupContextTest { [Test] - public void Constructor_AssessmentSectionNull_ThrowsArgumentNullException() - { - // Call - void Call() => new WaveHeightCalculationsForUserDefinedTargetProbabilitiesGroupContext(new ObservableList(), null); - - // Assert - var exception = Assert.Throws(Call); - Assert.AreEqual("assessmentSection", exception.ParamName); - } - - [Test] public void Constructor_ExpectedValues() { // Setup @@ -58,7 +45,7 @@ var context = new WaveHeightCalculationsForUserDefinedTargetProbabilitiesGroupContext(calculations, assessmentSection); // Assert - Assert.IsInstanceOf>>(context); + Assert.IsInstanceOf(context); Assert.AreSame(calculations, context.WrappedData); Assert.AreSame(assessmentSection, context.AssessmentSection); mockRepository.VerifyAll();