Index: Core/Common/test/Core.Common.TestUtil/DataGridViewTestHelper.cs =================================================================== diff -u -ra221fe6647c886b0421cd97d5e53880169e077f2 -raa1f5e937d3b306af894425c975187a8de09512d --- Core/Common/test/Core.Common.TestUtil/DataGridViewTestHelper.cs (.../DataGridViewTestHelper.cs) (revision a221fe6647c886b0421cd97d5e53880169e077f2) +++ Core/Common/test/Core.Common.TestUtil/DataGridViewTestHelper.cs (.../DataGridViewTestHelper.cs) (revision aa1f5e937d3b306af894425c975187a8de09512d) @@ -100,17 +100,19 @@ /// The cells from a view. /// The indices to assert the cell for. /// Indicator whether the cell should be enabled or disabled. + /// Flag indicating whether the cell is readonly when enabled. /// Thrown when expectancies are not met. public static void AssertCellsState(DataGridViewCellCollection cells, IEnumerable indices, - bool isEnabled) + bool isEnabled, + bool enabledIsReadOnly = false) { foreach (int index in indices) { DataGridViewCell cell = cells[index]; if (isEnabled) { - AssertCellIsEnabled(cell); + AssertCellIsEnabled(cell, enabledIsReadOnly); } else { @@ -140,7 +142,7 @@ /// Asserts whether a is in an enabled state. /// /// The cell that needs to be asserted. - /// Flag indicating whether the cell is readonly + /// Flag indicating whether the cell is readonly. /// Thrown when: /// /// The readonly property of the cell does not match with . Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/MacroStabilityOutwardsResultView.cs =================================================================== diff -u -rd08ab1ae8e6befe9ba2e16fdb9264cd5dbc6d8ad -raa1f5e937d3b306af894425c975187a8de09512d --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/MacroStabilityOutwardsResultView.cs (.../MacroStabilityOutwardsResultView.cs) (revision d08ab1ae8e6befe9ba2e16fdb9264cd5dbc6d8ad) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/MacroStabilityOutwardsResultView.cs (.../MacroStabilityOutwardsResultView.cs) (revision aa1f5e937d3b306af894425c975187a8de09512d) @@ -40,10 +40,15 @@ public class MacroStabilityOutwardsResultView : FailureMechanismResultView { + private const int simpleAssessmentResultIndex = 1; private const int detailedAssessmentResultIndex = 2; private const int detailedAssessmentProbabilityIndex = 3; private const int tailorMadeAssessmentResultIndex = 4; private const int tailorMadeAssessmentProbabilityIndex = 5; + private const int simpleAssemblyCategoryGroupIndex = 6; + private const int detailedAssemblyCategoryGroupIndex = 7; + private const int tailorMadeAssemblyCategoryGroupIndex = 8; + private const int combinedAssemblyCategoryGroupIndex = 9; private const int manualAssemblyCategoryGroupIndex = 11; private readonly IAssessmentSection assessmentSection; @@ -152,11 +157,25 @@ }, row => row.TailorMadeAssessmentResult != TailorMadeAssessmentResultType.Probability), new DataGridViewColumnFormattingRule( - new [] + new[] { manualAssemblyCategoryGroupIndex }, - row => !row.UseManualAssemblyCategoryGroup), + row => !row.UseManualAssemblyCategoryGroup), + new DataGridViewColumnFormattingRule( + new[] + { + simpleAssessmentResultIndex, + detailedAssessmentResultIndex, + detailedAssessmentProbabilityIndex, + tailorMadeAssessmentResultIndex, + tailorMadeAssessmentProbabilityIndex, + simpleAssemblyCategoryGroupIndex, + detailedAssemblyCategoryGroupIndex, + tailorMadeAssemblyCategoryGroupIndex, + combinedAssemblyCategoryGroupIndex + }, + row => row.UseManualAssemblyCategoryGroup) }; } } Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/MacrostabilityOutwardsResultViewTest.cs =================================================================== diff -u -rd08ab1ae8e6befe9ba2e16fdb9264cd5dbc6d8ad -raa1f5e937d3b306af894425c975187a8de09512d --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/MacrostabilityOutwardsResultViewTest.cs (.../MacrostabilityOutwardsResultViewTest.cs) (revision d08ab1ae8e6befe9ba2e16fdb9264cd5dbc6d8ad) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/MacrostabilityOutwardsResultViewTest.cs (.../MacrostabilityOutwardsResultViewTest.cs) (revision aa1f5e937d3b306af894425c975187a8de09512d) @@ -43,7 +43,7 @@ public class MacroStabilityOutwardsResultViewTest { private const int nameColumnIndex = 0; - private const int simpleAssessmentIndex = 1; + private const int simpleAssessmentResultIndex = 1; private const int detailedAssessmentResultIndex = 2; private const int detailedAssessmentProbabilityIndex = 3; private const int tailorMadeAssessmentResultIndex = 4; @@ -114,7 +114,7 @@ Assert.AreEqual(columnCount, dataGridView.ColumnCount); Assert.IsInstanceOf(dataGridView.Columns[nameColumnIndex]); - Assert.IsInstanceOf(dataGridView.Columns[simpleAssessmentIndex]); + Assert.IsInstanceOf(dataGridView.Columns[simpleAssessmentResultIndex]); Assert.IsInstanceOf(dataGridView.Columns[detailedAssessmentResultIndex]); Assert.IsInstanceOf(dataGridView.Columns[detailedAssessmentProbabilityIndex]); Assert.IsInstanceOf(dataGridView.Columns[tailorMadeAssessmentResultIndex]); @@ -127,7 +127,7 @@ Assert.IsInstanceOf(dataGridView.Columns[manualAssemblyCategoryGroupIndex]); Assert.AreEqual("Vak", dataGridView.Columns[nameColumnIndex].HeaderText); - Assert.AreEqual("Eenvoudige toets", dataGridView.Columns[simpleAssessmentIndex].HeaderText); + Assert.AreEqual("Eenvoudige toets", dataGridView.Columns[simpleAssessmentResultIndex].HeaderText); Assert.AreEqual("Gedetailleerde toets per vak", dataGridView.Columns[detailedAssessmentResultIndex].HeaderText); Assert.AreEqual("Gedetailleerde toets per vak\r\nFaalkans", dataGridView.Columns[detailedAssessmentProbabilityIndex].HeaderText); Assert.AreEqual("Toets op maat", dataGridView.Columns[tailorMadeAssessmentResultIndex].HeaderText); @@ -177,18 +177,18 @@ form.Show(); // Assert - var dataGridView = (DataGridView)new ControlTester("dataGridView").TheObject; + var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; DataGridViewRowCollection rows = dataGridView.Rows; Assert.AreEqual(1, rows.Count); DataGridViewRow dataGridViewRow = rows[0]; - var rowObject = (MacroStabilityOutwardsSectionResultRow)dataGridViewRow.DataBoundItem; + var rowObject = (MacroStabilityOutwardsSectionResultRow) dataGridViewRow.DataBoundItem; DataGridViewCellCollection cells = dataGridViewRow.Cells; Assert.AreEqual(columnCount, cells.Count); Assert.AreEqual("Section 1", cells[nameColumnIndex].FormattedValue); - Assert.AreEqual(result.SimpleAssessmentResult, cells[simpleAssessmentIndex].Value); + Assert.AreEqual(result.SimpleAssessmentResult, cells[simpleAssessmentResultIndex].Value); Assert.AreEqual(result.DetailedAssessmentResult, cells[detailedAssessmentResultIndex].Value); string expectedDetailedAssessmentProbabilityString = ProbabilityFormattingHelper.Format(result.DetailedAssessmentProbability); Assert.AreEqual(expectedDetailedAssessmentProbabilityString, cells[detailedAssessmentProbabilityIndex].FormattedValue); @@ -233,6 +233,7 @@ // Call using (var form = new Form()) + using (new AssemblyToolCalculatorFactoryConfig()) using (var view = new MacroStabilityOutwardsResultView(sectionResults, new MacroStabilityOutwardsFailureMechanism(), assessmentSection)) { form.Controls.Add(view); @@ -277,6 +278,7 @@ // Call using (var form = new Form()) + using (new AssemblyToolCalculatorFactoryConfig()) using (var view = new MacroStabilityOutwardsResultView(sectionResults, new MacroStabilityOutwardsFailureMechanism(), assessmentSection)) { form.Controls.Add(view); @@ -321,6 +323,7 @@ // Call using (var form = new Form()) + using (new AssemblyToolCalculatorFactoryConfig()) using (var view = new MacroStabilityOutwardsResultView(sectionResults, new MacroStabilityOutwardsFailureMechanism(), assessmentSection)) { form.Controls.Add(view); @@ -351,6 +354,7 @@ var result = new MacroStabilityOutwardsFailureMechanismSectionResult( FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) { + TailorMadeAssessmentResult = TailorMadeAssessmentResultType.Probability, UseManualAssemblyCategoryGroup = useManualAssemblyCategoryGroup }; var sectionResults = new ObservableList @@ -360,19 +364,37 @@ // Call using (var form = new Form()) + using (new AssemblyToolCalculatorFactoryConfig()) using (var view = new MacroStabilityOutwardsResultView(sectionResults, new MacroStabilityOutwardsFailureMechanism(), assessmentSection)) { form.Controls.Add(view); form.Show(); - var dataGridView = (DataGridView)new ControlTester("dataGridView").TheObject; + var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; DataGridViewCellCollection cells = dataGridView.Rows[0].Cells; // Assert DataGridViewTestHelper.AssertCellsState(cells, new[] { manualAssemblyCategoryGroupIndex }, useManualAssemblyCategoryGroup); + + DataGridViewTestHelper.AssertCellsState(cells, new[] + { + simpleAssessmentResultIndex, + detailedAssessmentResultIndex, + detailedAssessmentProbabilityIndex, + tailorMadeAssessmentResultIndex, + tailorMadeAssessmentProbabilityIndex + }, !useManualAssemblyCategoryGroup); + + DataGridViewTestHelper.AssertCellsState(cells, new[] + { + simpleAssemblyCategoryGroupIndex, + detailedAssemblyCategoryGroupIndex, + tailorMadeAssemblyCategoryGroupIndex, + combinedAssemblyCategoryGroupIndex + }, !useManualAssemblyCategoryGroup, true); mocks.VerifyAll(); } }