Index: Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/PropertyClasses/WaveConditionsInputContextProperties.cs =================================================================== diff -u -r173a4723b6e66c6931657148a6e9f18a8f4a5a05 -rc5403002418d1b299cd40a15f93e151caa28ea14 --- Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/PropertyClasses/WaveConditionsInputContextProperties.cs (.../WaveConditionsInputContextProperties.cs) (revision 173a4723b6e66c6931657148a6e9f18a8f4a5a05) +++ Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/PropertyClasses/WaveConditionsInputContextProperties.cs (.../WaveConditionsInputContextProperties.cs) (revision c5403002418d1b299cd40a15f93e151caa28ea14) @@ -124,7 +124,7 @@ { get { - return WaveConditionsInputHelper.GetUpperBoundaryDesignWaterLevel(getNormativeAssessmentLevelFunc()); + return WaveConditionsInputHelper.GetUpperBoundaryDesignWaterLevel(AssessmentLevel); } } @@ -233,7 +233,7 @@ return data.WrappedData.ForeshoreProfile == null ? null : new Point2D(new RoundedDouble(0, data.WrappedData.ForeshoreProfile.WorldReferencePoint.X), - new RoundedDouble(0, data.WrappedData.ForeshoreProfile.WorldReferencePoint.Y)); + new RoundedDouble(0, data.WrappedData.ForeshoreProfile.WorldReferencePoint.Y)); } } @@ -263,7 +263,8 @@ get { return data.WrappedData.ForeshoreProfile == null -? new UseBreakWaterProperties() : new UseBreakWaterProperties(data.WrappedData, propertyChangeHandler); + ? new UseBreakWaterProperties() + : new UseBreakWaterProperties(data.WrappedData, propertyChangeHandler); } } Index: Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/PropertyClasses/WaveConditionsInputContextPropertiesTest.cs =================================================================== diff -u -r173a4723b6e66c6931657148a6e9f18a8f4a5a05 -rc5403002418d1b299cd40a15f93e151caa28ea14 --- Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/PropertyClasses/WaveConditionsInputContextPropertiesTest.cs (.../WaveConditionsInputContextPropertiesTest.cs) (revision 173a4723b6e66c6931657148a6e9f18a8f4a5a05) +++ Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/PropertyClasses/WaveConditionsInputContextPropertiesTest.cs (.../WaveConditionsInputContextPropertiesTest.cs) (revision c5403002418d1b299cd40a15f93e151caa28ea14) @@ -75,41 +75,62 @@ { mockRepository = new MockRepository(); handler = mockRepository.Stub(); + mockRepository.ReplayAll(); } + [TearDown] + public void TearDown() + { + mockRepository.VerifyAll(); + } + [Test] public void Constructor_DataNull_ThrowsArgumentNullException() { // Call - TestDelegate test = () => new TestWaveConditionsInputContextProperties(null, handler); + TestDelegate test = () => new TestWaveConditionsInputContextProperties(null, GetTestNormativeAssessmentLevel, handler); // Assert string paramName = Assert.Throws(test).ParamName; Assert.AreEqual("context", paramName); } [Test] - public void Constructor_PropertyChangeHandlerNull_ThrowsArgumentNullException() + public void Constructor_GetNormativeAssessmentLevelFuncNull_ThrowsArgumentNullException() { // Setup - mockRepository.ReplayAll(); + var context = new TestWaveConditionsInputContext( + new WaveConditionsInput(), + Enumerable.Empty(), + Enumerable.Empty()); + // Call + TestDelegate test = () => new TestWaveConditionsInputContextProperties(context, null, handler); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("getNormativeAssessmentLevelFunc", exception.ParamName); + } + + [Test] + public void Constructor_PropertyChangeHandlerNull_ThrowsArgumentNullException() + { + // Setup var context = new TestWaveConditionsInputContext( new WaveConditionsInput(), Enumerable.Empty(), Enumerable.Empty()); // Call - TestDelegate test = () => new TestWaveConditionsInputContextProperties(context, null); + TestDelegate test = () => new TestWaveConditionsInputContextProperties(context, GetTestNormativeAssessmentLevel, null); // Assert var exception = Assert.Throws(test); Assert.AreEqual("propertyChangeHandler", exception.ParamName); - mockRepository.VerifyAll(); } [Test] - public void Constructor_WithContext_ExpectedValues() + public void Constructor_WithValidData_ExpectedValues() { // Setup var random = new Random(21); @@ -136,7 +157,7 @@ Orientation = foreshoreProfileOrientation, X0 = -3 }); - TestHydraulicBoundaryLocation hydraulicBoundaryLocation = TestHydraulicBoundaryLocation.CreateDesignWaterLevelCalculated(assessmentLevel); + var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation(); var input = new WaveConditionsInput { ForeshoreProfile = foreshoreProfile, @@ -150,7 +171,7 @@ var inputContext = new TestWaveConditionsInputContext(input, new ForeshoreProfile[0], new HydraulicBoundaryLocation[0]); // Call - var properties = new TestWaveConditionsInputContextProperties(inputContext, handler); + var properties = new TestWaveConditionsInputContextProperties(inputContext, () => assessmentLevel, handler); // Assert Assert.IsInstanceOf>(properties); @@ -197,13 +218,14 @@ { input.ForeshoreProfile = foreshoreProfile; } + var inputContext = new TestWaveConditionsInputContext(input, new[] { foreshoreProfile }, new HydraulicBoundaryLocation[0]); // Call - var properties = new TestWaveConditionsInputContextProperties(inputContext, handler); + var properties = new TestWaveConditionsInputContextProperties(inputContext, GetTestNormativeAssessmentLevel, handler); // Assert PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); @@ -409,7 +431,7 @@ var input = new WaveConditionsInput(); var inputContext = new TestWaveConditionsInputContext(input, new ForeshoreProfile[0], new HydraulicBoundaryLocation[0]); - var properties = new TestWaveConditionsInputContextProperties(inputContext, handler); + var properties = new TestWaveConditionsInputContextProperties(inputContext, GetTestNormativeAssessmentLevel, handler); SelectableHydraulicBoundaryLocation selectedHydraulicBoundaryLocation = null; @@ -437,7 +459,7 @@ }; var inputContext = new TestWaveConditionsInputContext(input, new ForeshoreProfile[0], locations); - var properties = new TestWaveConditionsInputContextProperties(inputContext, handler); + var properties = new TestWaveConditionsInputContextProperties(inputContext, GetTestNormativeAssessmentLevel, handler); // Call IEnumerable availableHydraulicBoundaryLocations = @@ -467,7 +489,7 @@ ForeshoreProfile = new TestForeshoreProfile(new Point2D(200620.173572981, 503401.652985217)) }; var inputContext = new TestWaveConditionsInputContext(input, new ForeshoreProfile[0], new HydraulicBoundaryLocation[0]); - var properties = new TestWaveConditionsInputContextProperties(inputContext, handler); + var properties = new TestWaveConditionsInputContextProperties(inputContext, GetTestNormativeAssessmentLevel, handler); // Call SelectableHydraulicBoundaryLocation selectedHydraulicBoundaryLocation = properties.SelectedHydraulicBoundaryLocation; @@ -501,7 +523,7 @@ }; var inputContext = new TestWaveConditionsInputContext(input, new ForeshoreProfile[0], locations); - var properties = new TestWaveConditionsInputContextProperties(inputContext, handler); + var properties = new TestWaveConditionsInputContextProperties(inputContext, GetTestNormativeAssessmentLevel, handler); // When IEnumerable availableHydraulicBoundaryLocations = @@ -529,7 +551,7 @@ var input = new WaveConditionsInput(); var inputContext = new TestWaveConditionsInputContext(input, new ForeshoreProfile[0], locations); - var properties = new TestWaveConditionsInputContextProperties(inputContext, handler); + var properties = new TestWaveConditionsInputContextProperties(inputContext, GetTestNormativeAssessmentLevel, handler); // Call IEnumerable availableHydraulicBoundaryLocations = properties.GetSelectableHydraulicBoundaryLocations(); @@ -561,7 +583,7 @@ }; var inputContext = new TestWaveConditionsInputContext(input, new ForeshoreProfile[0], locations); - var properties = new TestWaveConditionsInputContextProperties(inputContext, handler); + var properties = new TestWaveConditionsInputContextProperties(inputContext, GetTestNormativeAssessmentLevel, handler); // Call IEnumerable availableHydraulicBoundaryLocations = properties.GetSelectableHydraulicBoundaryLocations(); @@ -598,7 +620,7 @@ var otherProfile = new TestForeshoreProfile(new Point2D(0, 190)); var customHandler = new SetPropertyValueAfterConfirmationParameterTester(Enumerable.Empty()); - var properties = new TestWaveConditionsInputContextProperties(inputContext, customHandler); + var properties = new TestWaveConditionsInputContextProperties(inputContext, GetTestNormativeAssessmentLevel, customHandler); IEnumerable originalList = properties.GetSelectableHydraulicBoundaryLocations() .ToList(); @@ -632,7 +654,7 @@ var input = new WaveConditionsInput(); var inputContext = new TestWaveConditionsInputContext(input, locations, new HydraulicBoundaryLocation[0]); - var properties = new TestWaveConditionsInputContextProperties(inputContext, handler); + var properties = new TestWaveConditionsInputContextProperties(inputContext, GetTestNormativeAssessmentLevel, handler); // Call IEnumerable availableForeshoreProfiles = properties.GetAvailableForeshoreProfiles(); @@ -641,7 +663,7 @@ Assert.AreSame(locations, availableForeshoreProfiles); } - private void SetPropertyAndVerifyNotificationsAndOutputForCalculation(Action setProperty) + private static void SetPropertyAndVerifyNotificationsAndOutputForCalculation(Action setProperty) { // Setup var mocks = new MockRepository(); @@ -663,7 +685,7 @@ observable }); - var properties = new TestWaveConditionsInputContextProperties(context, customHandler); + var properties = new TestWaveConditionsInputContextProperties(context, GetTestNormativeAssessmentLevel, customHandler); // Call setProperty(properties); @@ -673,9 +695,17 @@ mocks.VerifyAll(); } + private static RoundedDouble GetTestNormativeAssessmentLevel() + { + return (RoundedDouble) 1.1; + } + private class TestWaveConditionsInputContextProperties : WaveConditionsInputContextProperties { - public TestWaveConditionsInputContextProperties(WaveConditionsInputContext context, IObservablePropertyChangeHandler handler) : base(context, handler) {} + public TestWaveConditionsInputContextProperties(WaveConditionsInputContext context, + Func getNormativeAssessmentLevelFunc, + IObservablePropertyChangeHandler handler) + : base(context, getNormativeAssessmentLevelFunc, handler) {} public override string RevetmentType {