Index: Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsCalculationRowTest.cs =================================================================== diff -u -r46b96a8bc87091274e3537e8bb5ca21aa0a6d04b -r184759005a2e6f4ca8c2bb5f4f91ef1ed7a7c02f --- Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsCalculationRowTest.cs (.../GrassCoverErosionInwardsCalculationRowTest.cs) (revision 46b96a8bc87091274e3537e8bb5ca21aa0a6d04b) +++ Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsCalculationRowTest.cs (.../GrassCoverErosionInwardsCalculationRowTest.cs) (revision 184759005a2e6f4ca8c2bb5f4f91ef1ed7a7c02f) @@ -236,10 +236,8 @@ public void UseBreakWaterState_AlwaysOnChange_CorrectColumnStates(bool useBreakWaterState, bool columnIsEnabled) { // Setup - var mockRepository = new MockRepository(); - mockRepository.ReplayAll(); - var calculation = new GrassCoverErosionInwardsCalculationScenario(); + // Call var row = new GrassCoverErosionInwardsCalculationRow(calculation, new ObservablePropertyChangeHandler(calculation, new GrassCoverErosionInwardsInput())) { @@ -251,26 +249,28 @@ DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState(columnStateDefinitions[breakWaterTypeColumnIndex], columnIsEnabled); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState(columnStateDefinitions[breakWaterHeightColumnIndex], columnIsEnabled); - - mockRepository.VerifyAll(); } [Test] [TestCase(BreakWaterType.Wall, BreakWaterType.Dam)] [TestCase(BreakWaterType.Caisson, BreakWaterType.Wall)] [TestCase(BreakWaterType.Dam, BreakWaterType.Caisson)] - public void BreakWaterType_AlwaysOnChange_NotifyObserverAndCalculationPropertyChanged(BreakWaterType breakWaterType, BreakWaterType oldBreakWaterType) + public void BreakWaterType_AlwaysOnChange_NotifyObserverAndCalculationPropertyChanged(BreakWaterType breakWaterType, BreakWaterType newBreakWaterType) { // Setup - BreakWaterType newValue = breakWaterType; + var calculation = new GrassCoverErosionInwardsCalculationScenario + { + InputParameters = + { + BreakWater = + { + Type = breakWaterType + } + } + }; - var calculation = new GrassCoverErosionInwardsCalculationScenario(); - - // This step is necessary because setting the same value would not change the row state. - calculation.InputParameters.BreakWater.Type = oldBreakWaterType; - // Call & Assert - SetPropertyAndVerifyNotificationsAndOutputForCalculation(row => row.BreakWaterType = newValue, calculation); + SetPropertyAndVerifyNotificationsAndOutputForCalculation(row => row.BreakWaterType = newBreakWaterType, calculation); } [Test] @@ -279,21 +279,18 @@ [TestCase(BreakWaterType.Dam)] public void BreakWaterType_ChangeToEqualValue_NoNotificationsOutputNotCleared(BreakWaterType breakWaterType) { - // Setup - BreakWaterType oldValue = breakWaterType; - // Call AssertPropertyNotChanged( row => { - oldValue = row.BreakWaterType; + breakWaterType = row.BreakWaterType; row.BreakWaterType = row.BreakWaterType; }, calculation => { // Assert - Assert.NotNull(oldValue); - Assert.AreEqual(oldValue, calculation.InputParameters.BreakWater.Type); + Assert.NotNull(breakWaterType); + Assert.AreEqual(breakWaterType, calculation.InputParameters.BreakWater.Type); }); } @@ -408,9 +405,6 @@ public void UseForeshoreState_CalculationWithDikeProfileWithoutForeshoreGeometry_CorrectColumnState() { // Setup - var mockRepository = new MockRepository(); - mockRepository.ReplayAll(); - var calculation = new GrassCoverErosionInwardsCalculationScenario { InputParameters = @@ -426,8 +420,6 @@ IDictionary columnStateDefinitions = row.ColumnStateDefinitions; DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnStateIsDisabled(columnStateDefinitions[useForeshoreColumnIndex]); - - mockRepository.VerifyAll(); } [Test] Index: Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsCalculationsViewTest.cs =================================================================== diff -u -re98a0f7266a2f152b8411c0b2c876ab2fe0464d1 -r184759005a2e6f4ca8c2bb5f4f91ef1ed7a7c02f --- Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsCalculationsViewTest.cs (.../GrassCoverErosionInwardsCalculationsViewTest.cs) (revision e98a0f7266a2f152b8411c0b2c876ab2fe0464d1) +++ Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsCalculationsViewTest.cs (.../GrassCoverErosionInwardsCalculationsViewTest.cs) (revision 184759005a2e6f4ca8c2bb5f4f91ef1ed7a7c02f) @@ -77,7 +77,6 @@ // Assert var exception = Assert.Throws(Call); Assert.AreEqual("data", exception.ParamName); - mocks.VerifyAll(); } @@ -93,7 +92,6 @@ // Assert var exception = Assert.Throws(Call); Assert.AreEqual("failureMechanism", exception.ParamName); - mocks.VerifyAll(); } @@ -129,7 +127,6 @@ Assert.IsInstanceOf(calculationsView); Assert.IsInstanceOf(calculationsView); Assert.IsInstanceOf(calculationsView); - mocks.VerifyAll(); } @@ -154,9 +151,7 @@ Assert.AreEqual(10, dataGridView.ColumnCount); AssertColumnMembers(dataGridView.Columns.OfType().ToArray()); - AssertDataGridViewControlColumnHeaders(dataGridView); - mocks.VerifyAll(); } @@ -178,7 +173,6 @@ // Assert Assert.AreEqual(2, listBox.Items.Count); - mocks.VerifyAll(); } @@ -205,7 +199,6 @@ Assert.AreEqual("Location 2 (6 m)", hydraulicBoundaryLocationComboboxItems[4].ToString()); Assert.AreEqual("Location 1 (4 m)", hydraulicBoundaryLocationComboboxItems[5].ToString()); Assert.AreEqual("Location 2 (5 m)", hydraulicBoundaryLocationComboboxItems[6].ToString()); - mocks.VerifyAll(); } @@ -228,7 +221,6 @@ // Assert Assert.IsTrue(state); - mocks.VerifyAll(); } @@ -239,13 +231,12 @@ // Setup var mocks = new MockRepository(); var assessmentSection = mocks.Stub(); - mocks.ReplayAll(); ConfigureHydraulicBoundaryDatabase(assessmentSection); var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); - var calculationsView = ShowCalculationsView(ConfigureCalculationGroup(failureMechanism, assessmentSection), failureMechanism, assessmentSection); + GrassCoverErosionInwardsCalculationsView calculationsView = ShowCalculationsView(ConfigureCalculationGroup(failureMechanism, assessmentSection), failureMechanism, assessmentSection); // Precondition var button = (Button) calculationsView.Controls.Find("buttonGenerateCalculations", true)[0]; @@ -272,7 +263,6 @@ // Assert Assert.IsTrue(button.Enabled); - mocks.VerifyAll(); } @@ -324,7 +314,6 @@ Assert.AreSame(failureMechanismSection1, listBox.Items[0]); Assert.AreSame(failureMechanismSection2, listBox.Items[1]); Assert.AreSame(failureMechanismSection3, listBox.Items[2]); - mocks.VerifyAll(); } @@ -360,7 +349,16 @@ cells = rows[1].Cells; Assert.AreEqual(10, cells.Count); - + Assert.AreEqual("Calculation 2", cells[nameColumnIndex].FormattedValue); + Assert.AreEqual("Location 2 (5 m)", cells[selectableHydraulicBoundaryLocationsColumnIndex].FormattedValue); + Assert.AreEqual("name", cells[dikeProfileColumnIndex].FormattedValue); + Assert.AreEqual(false, cells[useBreakWaterColumnIndex].FormattedValue); + Assert.AreEqual("Havendam", cells[breakWaterTypeColumnIndex].FormattedValue); + Assert.AreEqual(3.30.ToString("0.00", CultureInfo.CurrentCulture), cells[breakWaterHeightColumnIndex].FormattedValue); + Assert.AreEqual(false, cells[useForeShoreGeometryColumnIndex].FormattedValue); + Assert.AreEqual(1.10.ToString("0.00", CultureInfo.CurrentCulture), cells[dikeHeightColumnIndex].FormattedValue); + Assert.AreEqual(4.4000.ToString("0.0000", CultureInfo.CurrentCulture), cells[meanCriticalFlowRateColumnIndex].FormattedValue); + Assert.AreEqual(5.5000.ToString("0.0000", CultureInfo.CurrentCulture), cells[standardDeviationCriticalFlowRateColumnIndex].FormattedValue); mocks.VerifyAll(); } @@ -426,7 +424,6 @@ Assert.AreEqual(1, dataGridView.Rows.Count); Assert.AreEqual("Calculation 2", dataGridView.Rows[0].Cells[nameColumnIndex].FormattedValue); Assert.AreEqual(2, selectionChangedCount); - mocks.VerifyAll(); } @@ -455,7 +452,6 @@ // Assert Assert.AreEqual("De tekst moet een getal zijn.", dataGridView.Rows[0].ErrorText); - mocks.VerifyAll(); } @@ -499,7 +495,6 @@ // Assert Assert.IsEmpty(dataGridView.Rows[0].ErrorText); - mocks.VerifyAll(); } @@ -568,7 +563,6 @@ Assert.AreSame(failureMechanismSection1, listBox.Items[0]); Assert.AreSame(failureMechanismSection2, listBox.Items[1]); Assert.AreSame(failureMechanismSection3, listBox.Items[2]); - mocks.VerifyAll(); } @@ -602,7 +596,6 @@ // Assert Assert.AreEqual("Gemiddelde moet groter zijn dan 0.", dataGridView.Rows[0].ErrorText); - mocks.VerifyAll(); // No observer notified } @@ -633,7 +626,6 @@ // Assert Assert.AreEqual("Standaardafwijking (σ) moet groter zijn dan of gelijk zijn aan 0.", dataGridView.Rows[0].ErrorText); - mocks.VerifyAll(); // No observer notified } @@ -700,7 +692,6 @@ // Assert calculationScenario.Output = null; - mocks.VerifyAll(); } @@ -729,7 +720,6 @@ // Assert Assert.AreEqual(expectedState, dataGridView.Rows[0].Cells[breakWaterTypeColumnIndex].ReadOnly); Assert.AreEqual(expectedState, dataGridView.Rows[0].Cells[breakWaterHeightColumnIndex].ReadOnly); - mocks.VerifyAll(); } @@ -756,7 +746,6 @@ Assert.IsInstanceOf(selection); var dataRow = (GrassCoverErosionInwardsCalculationRow) dataGridView.Rows[selectedRow].DataBoundItem; Assert.AreSame(dataRow.CalculationScenario, ((GrassCoverErosionInwardsInputContext) selection).Calculation); - mocks.VerifyAll(); } @@ -797,7 +786,6 @@ // Assert calculation.Output = null; - mocks.VerifyAll(); }