Index: Core/Common/test/Core.Common.TestUtil.Test/Core.Common.TestUtil.Test.csproj =================================================================== diff -u -r7f82fd637dc8796f3d270cb0fa6d9ab18548c6f4 -ra221fe6647c886b0421cd97d5e53880169e077f2 --- Core/Common/test/Core.Common.TestUtil.Test/Core.Common.TestUtil.Test.csproj (.../Core.Common.TestUtil.Test.csproj) (revision 7f82fd637dc8796f3d270cb0fa6d9ab18548c6f4) +++ Core/Common/test/Core.Common.TestUtil.Test/Core.Common.TestUtil.Test.csproj (.../Core.Common.TestUtil.Test.csproj) (revision a221fe6647c886b0421cd97d5e53880169e077f2) @@ -27,7 +27,6 @@ - Fisheye: Tag a221fe6647c886b0421cd97d5e53880169e077f2 refers to a dead (removed) revision in file `Core/Common/test/Core.Common.TestUtil.Test/DataGridViewTestHelperTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Core/Common/test/Core.Common.TestUtil/DataGridViewTestHelper.cs =================================================================== diff -u -rac96d7c315129af851634ed5a4a6800b59ede718 -ra221fe6647c886b0421cd97d5e53880169e077f2 --- Core/Common/test/Core.Common.TestUtil/DataGridViewTestHelper.cs (.../DataGridViewTestHelper.cs) (revision ac96d7c315129af851634ed5a4a6800b59ede718) +++ Core/Common/test/Core.Common.TestUtil/DataGridViewTestHelper.cs (.../DataGridViewTestHelper.cs) (revision a221fe6647c886b0421cd97d5e53880169e077f2) @@ -94,6 +94,32 @@ } /// + /// Asserts whether the at specified + /// are enabled or disabled based on . + /// + /// The cells from a view. + /// The indices to assert the cell for. + /// Indicator whether the cell should be enabled or disabled. + /// Thrown when expectancies are not met. + public static void AssertCellsState(DataGridViewCellCollection cells, + IEnumerable indices, + bool isEnabled) + { + foreach (int index in indices) + { + DataGridViewCell cell = cells[index]; + if (isEnabled) + { + AssertCellIsEnabled(cell); + } + else + { + AssertCellIsDisabled(cell); + } + } + } + + /// /// Asserts whether a is in a disabled state. /// /// The cell that needs to be asserted. Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/MacroStabilityOutwardsResultView.cs =================================================================== diff -u -rb68519cb00cc197de677c3f43573a720ad097dcb -ra221fe6647c886b0421cd97d5e53880169e077f2 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/MacroStabilityOutwardsResultView.cs (.../MacroStabilityOutwardsResultView.cs) (revision b68519cb00cc197de677c3f43573a720ad097dcb) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/MacroStabilityOutwardsResultView.cs (.../MacroStabilityOutwardsResultView.cs) (revision a221fe6647c886b0421cd97d5e53880169e077f2) @@ -102,7 +102,9 @@ new DataGridViewColumnFormattingRule( new[] { + 2, 3, + 4, 5 }, new Func[] Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/MacrostabilityOutwardsResultViewTest.cs =================================================================== diff -u -rb68519cb00cc197de677c3f43573a720ad097dcb -ra221fe6647c886b0421cd97d5e53880169e077f2 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/MacrostabilityOutwardsResultViewTest.cs (.../MacrostabilityOutwardsResultViewTest.cs) (revision b68519cb00cc197de677c3f43573a720ad097dcb) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/MacrostabilityOutwardsResultViewTest.cs (.../MacrostabilityOutwardsResultViewTest.cs) (revision a221fe6647c886b0421cd97d5e53880169e077f2) @@ -174,49 +174,47 @@ } [Test] - [TestCase(SimpleAssessmentResultType.None, TestName = "FormWithFailureMechanismResultView_SectionPassesLevel0AndListenersNotified_RowsForSectionDisabled(notAssessed)")] - [TestCase(SimpleAssessmentResultType.AssessFurther, TestName = "FormWithFailureMechanismResultView_SectionPassesLevel0AndListenersNotified_RowsForSectionDisabled(noVerdict)")] - public void GivenFormWithFailureMechanismResultView_WhenSectionPassesSimpleAssessmentAndListenersNotified_ThenRowsForSectionDisabled( - SimpleAssessmentResultType simpleAssessmentResult) + [TestCase(SimpleAssessmentResultType.None, true)] + [TestCase(SimpleAssessmentResultType.AssessFurther, true)] + [TestCase(SimpleAssessmentResultType.NotApplicable, false)] + [TestCase(SimpleAssessmentResultType.ProbabilityNegligible, false)] + public void FailureMechanismResultView_SimpleAssessmentResultSet_CellsDisabledEnabled( + SimpleAssessmentResultType simpleAssessmentResult, + bool cellsEnabled) { - // Given - var random = new Random(21); + // Setup var mocks = new MockRepository(); var assessmentSection = mocks.Stub(); mocks.ReplayAll(); var result = new MacroStabilityOutwardsFailureMechanismSectionResult( FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) { - SimpleAssessmentResult = simpleAssessmentResult, - DetailedAssessmentProbability = random.NextDouble(), - TailorMadeAssessmentProbability = random.NextDouble() + SimpleAssessmentResult = simpleAssessmentResult }; var sectionResults = new ObservableList { result }; + // Call using (var form = new Form()) using (var view = new MacroStabilityOutwardsResultView(sectionResults, new MacroStabilityOutwardsFailureMechanism(), assessmentSection)) { form.Controls.Add(view); form.Show(); - // When - result.SimpleAssessmentResult = SimpleAssessmentResultType.ProbabilityNegligible; - result.NotifyObservers(); - - // Then var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; - DataGridViewRowCollection rows = dataGridView.Rows; - Assert.AreEqual(1, rows.Count); + DataGridViewCellCollection cells = dataGridView.Rows[0].Cells; - DataGridViewCellCollection cells = rows[0].Cells; - Assert.AreEqual(6, cells.Count); - - DataGridViewTestHelper.AssertCellIsDisabled(cells[detailedAssessmentProbabilityIndex]); - DataGridViewTestHelper.AssertCellIsDisabled(cells[tailorMadeAssessmentProbabilityIndex]); + // Assert + DataGridViewTestHelper.AssertCellsState(cells, new[] + { + detailedAssessmentResultIndex, + detailedAssessmentProbabilityIndex, + tailorMadeAssessmentResultIndex, + tailorMadeAssessmentProbabilityIndex + }, cellsEnabled); mocks.VerifyAll(); } }