Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/DesignWaterLevelLocationsContextTest.cs =================================================================== diff -u -rc477f3652d0585abf7ef81a5a186535d7f27796f -re77cced30afdaacbb8efccf3b9ec179bc1e93814 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/DesignWaterLevelLocationsContextTest.cs (.../DesignWaterLevelLocationsContextTest.cs) (revision c477f3652d0585abf7ef81a5a186535d7f27796f) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/DesignWaterLevelLocationsContextTest.cs (.../DesignWaterLevelLocationsContextTest.cs) (revision e77cced30afdaacbb8efccf3b9ec179bc1e93814) @@ -44,20 +44,23 @@ mockRepository.ReplayAll(); var locations = new ObservableList(); - Func calculationFunc = hbl => null; + Func getNormFunc = () => 0.01; + Func getCalculationFunc = hbl => null; const string categoryBoundaryName = "Test name"; // Call var presentationObject = new DesignWaterLevelLocationsContext(locations, assessmentSection, - calculationFunc, + getNormFunc, + getCalculationFunc, categoryBoundaryName); // Assert Assert.IsInstanceOf>>(presentationObject); Assert.AreSame(locations, presentationObject.WrappedData); Assert.AreSame(assessmentSection, presentationObject.AssessmentSection); - Assert.AreSame(calculationFunc, presentationObject.GetCalculationFunc); + Assert.AreSame(getNormFunc, presentationObject.GetNormFunc); + Assert.AreSame(getCalculationFunc, presentationObject.GetCalculationFunc); Assert.AreEqual(categoryBoundaryName, presentationObject.CategoryBoundaryName); mockRepository.VerifyAll(); } @@ -68,6 +71,7 @@ // Call TestDelegate call = () => new DesignWaterLevelLocationsContext(new ObservableList(), null, + () => 0.01, hbl => null, "Test name"); @@ -77,6 +81,26 @@ } [Test] + public void Constructor_GetNormFuncNull_ThrowsArgumentNullException() + { + // Setup + var mockRepository = new MockRepository(); + var assessmentSection = mockRepository.Stub(); + mockRepository.ReplayAll(); + + // Call + TestDelegate call = () => new DesignWaterLevelLocationsContext(new ObservableList(), + assessmentSection, + null, + hbl => null, + "Test name"); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("getNormFunc", exception.ParamName); + } + + [Test] public void Constructor_GetCalculationFuncNull_ThrowsArgumentNullException() { // Setup @@ -87,6 +111,7 @@ // Call TestDelegate call = () => new DesignWaterLevelLocationsContext(new ObservableList(), assessmentSection, + () => 0.01, null, "Test name"); @@ -106,6 +131,7 @@ // Call TestDelegate call = () => new DesignWaterLevelLocationsContext(new ObservableList(), assessmentSection, + () => 0.01, hbl => null, null); @@ -125,6 +151,7 @@ // Call TestDelegate call = () => new DesignWaterLevelLocationsContext(new ObservableList(), assessmentSection, + () => 0.01, hbl => null, string.Empty); @@ -139,6 +166,7 @@ { private static readonly MockRepository mocks = new MockRepository(); private static readonly IAssessmentSection assessmentSection = mocks.Stub(); + private static readonly Func getNormFunc = () => 0.01; private static readonly ObservableList hydraulicBoundaryLocations = new ObservableList(); private static readonly Func getCalculationFunc = hbl => null; private static readonly string categoryBoundaryName = "Test name"; @@ -159,6 +187,7 @@ { return new DesignWaterLevelLocationsContext(hydraulicBoundaryLocations, assessmentSection, + getNormFunc, getCalculationFunc, categoryBoundaryName); } @@ -167,6 +196,7 @@ { return new DerivedDesignWaterLevelLocationsContext(hydraulicBoundaryLocations, assessmentSection, + getNormFunc, getCalculationFunc, categoryBoundaryName); } @@ -175,6 +205,7 @@ { yield return new TestCaseData(new DesignWaterLevelLocationsContext(hydraulicBoundaryLocations, assessmentSection, + getNormFunc, getCalculationFunc, "Other")) .SetName("CategoryBoundaryName"); @@ -185,10 +216,12 @@ { public DerivedDesignWaterLevelLocationsContext(ObservableList wrappedData, IAssessmentSection assessmentSection, + Func getNormFunc, Func getCalculationFunc, string categoryBoundaryName) : base(wrappedData, assessmentSection, + getNormFunc, getCalculationFunc, categoryBoundaryName) {} }