Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/DesignWaterLevelLocationsContext.cs =================================================================== diff -u -r44d4c114a254db9859fbf71812e599c468dcbe77 -r9fca8960992f7a4e457e3457e35325aafe4ef87b --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/DesignWaterLevelLocationsContext.cs (.../DesignWaterLevelLocationsContext.cs) (revision 44d4c114a254db9859fbf71812e599c468dcbe77) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/DesignWaterLevelLocationsContext.cs (.../DesignWaterLevelLocationsContext.cs) (revision 9fca8960992f7a4e457e3457e35325aafe4ef87b) @@ -40,10 +40,14 @@ /// The that the belongs to. /// for obtaining a /// based on . - /// Thrown when any parameter is null. + /// The name of the category boundary. + /// Thrown when , + /// or is null. + /// Thrown when is null or empty. public DesignWaterLevelLocationsContext(ObservableList wrappedData, IAssessmentSection assessmentSection, - Func getCalculationFunc) + Func getCalculationFunc, + string categoryBoundaryName) : base(wrappedData) { if (assessmentSection == null) @@ -56,8 +60,14 @@ throw new ArgumentNullException(nameof(getCalculationFunc)); } + if (string.IsNullOrEmpty(categoryBoundaryName)) + { + throw new ArgumentException(nameof(categoryBoundaryName)); + } + AssessmentSection = assessmentSection; GetCalculationFunc = getCalculationFunc; + CategoryBoundaryName = categoryBoundaryName; } /// @@ -70,5 +80,10 @@ /// based on . /// public Func GetCalculationFunc { get; } + + /// + /// Gets the name of the category boundary. + /// + public string CategoryBoundaryName { get; } } } \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/WaveHeightLocationsContext.cs =================================================================== diff -u -r44d4c114a254db9859fbf71812e599c468dcbe77 -r9fca8960992f7a4e457e3457e35325aafe4ef87b --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/WaveHeightLocationsContext.cs (.../WaveHeightLocationsContext.cs) (revision 44d4c114a254db9859fbf71812e599c468dcbe77) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/WaveHeightLocationsContext.cs (.../WaveHeightLocationsContext.cs) (revision 9fca8960992f7a4e457e3457e35325aafe4ef87b) @@ -40,10 +40,14 @@ /// The that the belongs to. /// for obtaining a /// based on . - /// Thrown when any parameter is null. + /// The name of the category boundary. + /// Thrown when , + /// or is null. + /// Thrown when is null or empty. public WaveHeightLocationsContext(ObservableList wrappedData, IAssessmentSection assessmentSection, - Func getCalculationFunc) + Func getCalculationFunc, + string categoryBoundaryName) : base(wrappedData) { if (assessmentSection == null) @@ -56,8 +60,14 @@ throw new ArgumentNullException(nameof(getCalculationFunc)); } + if (string.IsNullOrEmpty(categoryBoundaryName)) + { + throw new ArgumentException(nameof(categoryBoundaryName)); + } + AssessmentSection = assessmentSection; GetCalculationFunc = getCalculationFunc; + CategoryBoundaryName = categoryBoundaryName; } /// @@ -70,5 +80,10 @@ /// based on . /// public Func GetCalculationFunc { get; } + + /// + /// Gets the name of the category boundary. + /// + public string CategoryBoundaryName { get; } } } \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/DesignWaterLevelLocationsContextTest.cs =================================================================== diff -u -r71b85e7f4d8336947d91b8745279028119860b59 -r9fca8960992f7a4e457e3457e35325aafe4ef87b --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/DesignWaterLevelLocationsContextTest.cs (.../DesignWaterLevelLocationsContextTest.cs) (revision 71b85e7f4d8336947d91b8745279028119860b59) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/DesignWaterLevelLocationsContextTest.cs (.../DesignWaterLevelLocationsContextTest.cs) (revision 9fca8960992f7a4e457e3457e35325aafe4ef87b) @@ -43,23 +43,31 @@ var locations = new ObservableList(); Func calculationFunc = hbl => null; + const string categoryBoundaryName = "Test name"; // Call - var presentationObject = new DesignWaterLevelLocationsContext(locations, assessmentSection, calculationFunc); + var presentationObject = new DesignWaterLevelLocationsContext(locations, + assessmentSection, + calculationFunc, + categoryBoundaryName); // Assert Assert.IsInstanceOf>>(presentationObject); Assert.AreSame(locations, presentationObject.WrappedData); Assert.AreSame(assessmentSection, presentationObject.AssessmentSection); Assert.AreSame(calculationFunc, presentationObject.GetCalculationFunc); + Assert.AreEqual(categoryBoundaryName, presentationObject.CategoryBoundaryName); mockRepository.VerifyAll(); } [Test] public void Constructor_AssessmentSectionNull_ThrowsArgumentNullException() { // Call - TestDelegate call = () => new DesignWaterLevelLocationsContext(new ObservableList(), null, hbl => null); + TestDelegate call = () => new DesignWaterLevelLocationsContext(new ObservableList(), + null, + hbl => null, + "Test name"); // Assert var exception = Assert.Throws(call); @@ -75,11 +83,52 @@ mockRepository.ReplayAll(); // Call - TestDelegate call = () => new DesignWaterLevelLocationsContext(new ObservableList(), assessmentSection, null); + TestDelegate call = () => new DesignWaterLevelLocationsContext(new ObservableList(), + assessmentSection, + null, + "Test name"); // Assert var exception = Assert.Throws(call); Assert.AreEqual("getCalculationFunc", exception.ParamName); } + + [Test] + public void Constructor_CategoryBoundaryNameNull_ThrowsArgumentException() + { + // Setup + var mockRepository = new MockRepository(); + var assessmentSection = mockRepository.Stub(); + mockRepository.ReplayAll(); + + // Call + TestDelegate call = () => new DesignWaterLevelLocationsContext(new ObservableList(), + assessmentSection, + hbl => null, + null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("categoryBoundaryName", exception.ParamName); + } + + [Test] + public void Constructor_CategoryBoundaryNameEmpty_ThrowsArgumentException() + { + // Setup + var mockRepository = new MockRepository(); + var assessmentSection = mockRepository.Stub(); + mockRepository.ReplayAll(); + + // Call + TestDelegate call = () => new DesignWaterLevelLocationsContext(new ObservableList(), + assessmentSection, + hbl => null, + string.Empty); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("categoryBoundaryName", exception.ParamName); + } } } \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/WaveHeightLocationsContextTest.cs =================================================================== diff -u -rc0ae8653c6cd26824e08e97a6704a466e40c2a80 -r9fca8960992f7a4e457e3457e35325aafe4ef87b --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/WaveHeightLocationsContextTest.cs (.../WaveHeightLocationsContextTest.cs) (revision c0ae8653c6cd26824e08e97a6704a466e40c2a80) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/WaveHeightLocationsContextTest.cs (.../WaveHeightLocationsContextTest.cs) (revision 9fca8960992f7a4e457e3457e35325aafe4ef87b) @@ -43,23 +43,31 @@ var locations = new ObservableList(); Func calculationFunc = hbl => null; + const string categoryBoundaryName = "Test name"; // Call - var presentationObject = new WaveHeightLocationsContext(locations, assessmentSection, calculationFunc); + var presentationObject = new WaveHeightLocationsContext(locations, + assessmentSection, + calculationFunc, + categoryBoundaryName); // Assert Assert.IsInstanceOf>>(presentationObject); Assert.AreSame(locations, presentationObject.WrappedData); Assert.AreSame(assessmentSection, presentationObject.AssessmentSection); Assert.AreSame(calculationFunc, presentationObject.GetCalculationFunc); + Assert.AreEqual(categoryBoundaryName, presentationObject.CategoryBoundaryName); mockRepository.VerifyAll(); } [Test] public void Constructor_AssessmentSectionNull_ThrowsArgumentNullException() { // Call - TestDelegate call = () => new WaveHeightLocationsContext(new ObservableList(), null, hbl => null); + TestDelegate call = () => new WaveHeightLocationsContext(new ObservableList(), + null, + hbl => null, + "Test name"); // Assert var exception = Assert.Throws(call); @@ -75,11 +83,52 @@ mockRepository.ReplayAll(); // Call - TestDelegate call = () => new WaveHeightLocationsContext(new ObservableList(), assessmentSection, null); + TestDelegate call = () => new WaveHeightLocationsContext(new ObservableList(), + assessmentSection, + null, + "Test name"); // Assert var exception = Assert.Throws(call); Assert.AreEqual("getCalculationFunc", exception.ParamName); } + + [Test] + public void Constructor_CategoryBoundaryNameNull_ThrowsArgumentException() + { + // Setup + var mockRepository = new MockRepository(); + var assessmentSection = mockRepository.Stub(); + mockRepository.ReplayAll(); + + // Call + TestDelegate call = () => new WaveHeightLocationsContext(new ObservableList(), + assessmentSection, + hbl => null, + null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("categoryBoundaryName", exception.ParamName); + } + + [Test] + public void Constructor_CategoryBoundaryNameEmpty_ThrowsArgumentException() + { + // Setup + var mockRepository = new MockRepository(); + var assessmentSection = mockRepository.Stub(); + mockRepository.ReplayAll(); + + // Call + TestDelegate call = () => new WaveHeightLocationsContext(new ObservableList(), + assessmentSection, + hbl => null, + string.Empty); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("categoryBoundaryName", exception.ParamName); + } } } \ No newline at end of file