Index: Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/Views/WaveConditionsInputViewTest.cs =================================================================== diff -u -rca50e203235730c6a88901c20588095704aeee84 -rc9718aac47d13f790a2ec0cc7d51305361b90d77 --- Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/Views/WaveConditionsInputViewTest.cs (.../WaveConditionsInputViewTest.cs) (revision ca50e203235730c6a88901c20588095704aeee84) +++ Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/Views/WaveConditionsInputViewTest.cs (.../WaveConditionsInputViewTest.cs) (revision c9718aac47d13f790a2ec0cc7d51305361b90d77) @@ -101,21 +101,32 @@ } [Test] - public void Constructor_WaveConditionsInputViewStyleNull_ThrowArgumentNullException() + public void Constructor_InputViewStyleNull_ThrowArgumentNullException() { // Call - TestDelegate test = () => new WaveConditionsInputView(null); + TestDelegate test = () => new WaveConditionsInputView(null, GetTestNormativeAssessmentLevel); // Assert var exception = Assert.Throws(test); Assert.AreEqual("inputViewStyle", exception.ParamName); } [Test] + public void Constructor_GetNormativeAssessmentLevelFuncNull_ThrowArgumentNullException() + { + // Call + TestDelegate test = () => new WaveConditionsInputView(new TestWaveConditionsInputViewStyle(), null); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("getNormativeAssessmentLevelFunc", exception.ParamName); + } + + [Test] public void Constructor_ExpectedValues() { // Call - using (var view = new WaveConditionsInputView(new TestWaveConditionsInputViewStyle())) + using (var view = new WaveConditionsInputView(new TestWaveConditionsInputViewStyle(), GetTestNormativeAssessmentLevel)) { // Assert Assert.IsInstanceOf(view); @@ -130,7 +141,7 @@ public void Constructor_Always_AddEmptyChartControl() { // Call - using (var view = new WaveConditionsInputView(new TestWaveConditionsInputViewStyle())) + using (var view = new WaveConditionsInputView(new TestWaveConditionsInputViewStyle(), GetTestNormativeAssessmentLevel)) { // Assert var chartControl = (IChartControl) view.Controls.Find("chartControl", true).First(); @@ -147,7 +158,7 @@ public void Data_IWaveConditionsCalculation_DataSet() { // Setup - using (var view = new WaveConditionsInputView(new TestWaveConditionsInputViewStyle())) + using (var view = new WaveConditionsInputView(new TestWaveConditionsInputViewStyle(), GetTestNormativeAssessmentLevel)) { var calculation = new TestWaveConditionsCalculation(); @@ -163,7 +174,7 @@ public void Data_OtherThanWaveConditionsCalculation_DataNull() { // Setup - using (var view = new WaveConditionsInputView(new TestWaveConditionsInputViewStyle())) + using (var view = new WaveConditionsInputView(new TestWaveConditionsInputViewStyle(), GetTestNormativeAssessmentLevel)) { var calculation = new object(); @@ -179,7 +190,7 @@ public void Data_SetToNull_ChartDataCleared() { // Setup - using (var view = new WaveConditionsInputView(new TestWaveConditionsInputViewStyle()) + using (var view = new WaveConditionsInputView(new TestWaveConditionsInputViewStyle(), GetTestNormativeAssessmentLevel) { Data = new TestWaveConditionsCalculation() }) @@ -202,7 +213,7 @@ public void Data_EmptyCalculation_NoChartDataSet() { // Setup - using (var view = new WaveConditionsInputView(new TestWaveConditionsInputViewStyle())) + using (var view = new WaveConditionsInputView(new TestWaveConditionsInputViewStyle(), GetTestNormativeAssessmentLevel)) { var calculation = new TestWaveConditionsCalculation(); @@ -220,7 +231,7 @@ // Setup const string calculationName = "Calculation name"; - using (var view = new WaveConditionsInputView(new TestWaveConditionsInputViewStyle())) + using (var view = new WaveConditionsInputView(new TestWaveConditionsInputViewStyle(), () => (RoundedDouble) 6)) { var calculation = new TestWaveConditionsCalculation { @@ -236,8 +247,7 @@ LowerBoundaryRevetment = (RoundedDouble) 5, UpperBoundaryRevetment = (RoundedDouble) 8, LowerBoundaryWaterLevels = (RoundedDouble) 3, - UpperBoundaryWaterLevels = (RoundedDouble) 9, - HydraulicBoundaryLocation = TestHydraulicBoundaryLocation.CreateDesignWaterLevelCalculated(6) + UpperBoundaryWaterLevels = (RoundedDouble) 9 } }; @@ -286,7 +296,7 @@ public void UpdateObserver_CalculationNameUpdated_ChartTitleUpdated() { // Setup - using (var view = new WaveConditionsInputView(new TestWaveConditionsInputViewStyle())) + using (var view = new WaveConditionsInputView(new TestWaveConditionsInputViewStyle(), GetTestNormativeAssessmentLevel)) { const string initialName = "Initial name"; const string updatedName = "Updated name"; @@ -315,7 +325,7 @@ public void UpdateObserver_OtherCalculationNameUpdated_ChartTitleNotUpdated() { // Setup - using (var view = new WaveConditionsInputView(new TestWaveConditionsInputViewStyle())) + using (var view = new WaveConditionsInputView(new TestWaveConditionsInputViewStyle(), GetTestNormativeAssessmentLevel)) { const string initialName = "Initial name"; const string updatedName = "Updated name"; @@ -366,12 +376,11 @@ LowerBoundaryRevetment = (RoundedDouble) 5, UpperBoundaryRevetment = (RoundedDouble) 8, LowerBoundaryWaterLevels = (RoundedDouble) 3, - UpperBoundaryWaterLevels = (RoundedDouble) 7, - HydraulicBoundaryLocation = TestHydraulicBoundaryLocation.CreateDesignWaterLevelCalculated(6) + UpperBoundaryWaterLevels = (RoundedDouble) 7 } }; - using (var view = new WaveConditionsInputView(new TestWaveConditionsInputViewStyle()) + using (var view = new WaveConditionsInputView(new TestWaveConditionsInputViewStyle(), () => (RoundedDouble) 6) { Data = calculation }) @@ -458,7 +467,7 @@ mocks.ReplayAll(); var calculation1 = new TestWaveConditionsCalculation(); - using (var view = new WaveConditionsInputView(new TestWaveConditionsInputViewStyle()) + using (var view = new WaveConditionsInputView(new TestWaveConditionsInputViewStyle(), GetTestNormativeAssessmentLevel) { Data = calculation1 }) @@ -490,7 +499,6 @@ public void GivenViewWithInputData_WhenWaterLevelForCalculationUpdated_ThenUpdatedDataIsShownInChart(Func updateWaterLevelOnInput) { // Given - HydraulicBoundaryLocation testHydraulicBoundaryLocation = new TestHydraulicBoundaryLocation(); var profile = new TestForeshoreProfile(new[] { new Point2D(0.0, 0.0), @@ -505,12 +513,11 @@ LowerBoundaryRevetment = (RoundedDouble) 5, UpperBoundaryRevetment = (RoundedDouble) 8, LowerBoundaryWaterLevels = (RoundedDouble) 3, - UpperBoundaryWaterLevels = (RoundedDouble) 7, - HydraulicBoundaryLocation = testHydraulicBoundaryLocation + UpperBoundaryWaterLevels = (RoundedDouble) 7 } }; - using (var view = new WaveConditionsInputView(new TestWaveConditionsInputViewStyle()) + using (var view = new WaveConditionsInputView(new TestWaveConditionsInputViewStyle(), GetTestNormativeAssessmentLevel) { Data = calculation }) @@ -703,5 +710,10 @@ { return ((pointY - lastForeshorePoint.Y) / 3) + lastForeshorePoint.X; } + + private static RoundedDouble GetTestNormativeAssessmentLevel() + { + return (RoundedDouble) 1.1; + } } } \ No newline at end of file