Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssemblyResultTotalViewTest.cs =================================================================== diff -u -r5562ec9835fa2ad44ede7aa031e80c3e9a368445 -rc05d1ef136bcd8e31ce35f00d87168e359d36f3e --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssemblyResultTotalViewTest.cs (.../AssemblyResultTotalViewTest.cs) (revision 5562ec9835fa2ad44ede7aa031e80c3e9a368445) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssemblyResultTotalViewTest.cs (.../AssemblyResultTotalViewTest.cs) (revision c05d1ef136bcd8e31ce35f00d87168e359d36f3e) @@ -93,11 +93,8 @@ var assessmentSection = new AssessmentSection(random.NextEnumValue()); // Call - using (var view = new AssemblyResultTotalView(assessmentSection)) + using (AssemblyResultTotalView view = ShowAssemblyResultTotalView(assessmentSection)) { - testForm.Controls.Add(view); - testForm.Show(); - // Assert Assert.AreEqual(2, view.Controls.Count); @@ -116,15 +113,9 @@ public void GivenWithAssemblyResultTotalView_ThenExpectedColumnsAreVisible() { // Given - var random = new Random(21); - var assessmentSection = new AssessmentSection(random.NextEnumValue()); - - // Then - using (var view = new AssemblyResultTotalView(assessmentSection)) + using (ShowAssemblyResultTotalView()) { - testForm.Controls.Add(view); - testForm.Show(); - + // Then var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; Assert.AreEqual(expectedColumnCount, dataGridView.ColumnCount); @@ -161,11 +152,8 @@ var calculatorfactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; FailureMechanismAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismAssemblyCalculator; - using (var view = new AssemblyResultTotalView(assessmentSection)) + using (ShowAssemblyResultTotalView(assessmentSection)) { - testForm.Controls.Add(view); - testForm.Show(); - // Then var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; AssertFailureMechanismRows(assessmentSection, @@ -185,11 +173,8 @@ var assessmentSection = new AssessmentSection(random.NextEnumValue()); using (new AssemblyToolCalculatorFactoryConfig()) - using (var view = new AssemblyResultTotalView(assessmentSection)) + using (AssemblyResultTotalView view = ShowAssemblyResultTotalView(assessmentSection)) { - testForm.Controls.Add(view); - testForm.Show(); - var calculatorfactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; FailureMechanismAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismAssemblyCalculator; @@ -223,7 +208,7 @@ var assessmentSection = new AssessmentSection(random.NextEnumValue()); using (new AssemblyToolCalculatorFactoryConfig()) - using (var view = new AssemblyResultTotalView(assessmentSection)) + using (AssemblyResultTotalView view = ShowAssemblyResultTotalView(assessmentSection)) { testForm.Controls.Add(view); testForm.Show(); @@ -251,15 +236,8 @@ public void GivenAssemblyResultTotalView_WhenRefreshingAssemblyResults_ThenDataGridViewInvalidated() { // Given - var random = new Random(21); - var assessmentSection = new AssessmentSection(random.NextEnumValue()); - - // Then - using (var view = new AssemblyResultTotalView(assessmentSection)) + using (ShowAssemblyResultTotalView()) { - testForm.Controls.Add(view); - testForm.Show(); - var invalidated = false; var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; dataGridView.Invalidated += (sender, args) => invalidated = true; @@ -412,5 +390,22 @@ { return rowCells[failureMechanismAssemblyCategoryColumnIndex]; } + + private AssemblyResultTotalView ShowAssemblyResultTotalView(AssessmentSection assessmentSection) + { + var view = new AssemblyResultTotalView(assessmentSection); + testForm.Controls.Add(view); + testForm.Show(); + + return view; + } + + private AssemblyResultTotalView ShowAssemblyResultTotalView() + { + var random = new Random(21); + var assessmentSection = new AssessmentSection(random.NextEnumValue()); + + return ShowAssemblyResultTotalView(assessmentSection); + } } } \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/FailureMechanismAssemblyCategoryGroupResultRowTest.cs =================================================================== diff -u -r75f05375500f06d02554a479eb98cb160a6fe734 -rc05d1ef136bcd8e31ce35f00d87168e359d36f3e --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/FailureMechanismAssemblyCategoryGroupResultRowTest.cs (.../FailureMechanismAssemblyCategoryGroupResultRowTest.cs) (revision 75f05375500f06d02554a479eb98cb160a6fe734) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/FailureMechanismAssemblyCategoryGroupResultRowTest.cs (.../FailureMechanismAssemblyCategoryGroupResultRowTest.cs) (revision c05d1ef136bcd8e31ce35f00d87168e359d36f3e) @@ -82,7 +82,6 @@ IDictionary columnStateDefinitions = row.ColumnStateDefinitions; Assert.AreEqual(1, columnStateDefinitions.Count); FailureMechanismSectionResultRowTestHelper.AssertColumnStateDefinition(columnStateDefinitions, categoryIndex); - Assert.IsTrue(columnStateDefinitions[categoryIndex].ReadOnly); Assert.AreEqual(failureMechanismName, row.Name); Assert.AreEqual(failureMechanismCode, row.Code); @@ -203,11 +202,14 @@ var row = new FailureMechanismAssemblyCategoryGroupResultRow(failureMechanism, () => failureMechanismAssemblyCategoryGroup); + // Precondition + IDictionary columnStateDefinitions = row.ColumnStateDefinitions; + Assert.IsTrue(columnStateDefinitions[categoryIndex].ReadOnly); + // When row.Update(); // Then - IDictionary columnStateDefinitions = row.ColumnStateDefinitions; Assert.IsTrue(columnStateDefinitions[categoryIndex].ReadOnly); } } Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/FailureMechanismAssemblyResultRowTest.cs =================================================================== diff -u -r75f05375500f06d02554a479eb98cb160a6fe734 -rc05d1ef136bcd8e31ce35f00d87168e359d36f3e --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/FailureMechanismAssemblyResultRowTest.cs (.../FailureMechanismAssemblyResultRowTest.cs) (revision 75f05375500f06d02554a479eb98cb160a6fe734) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/FailureMechanismAssemblyResultRowTest.cs (.../FailureMechanismAssemblyResultRowTest.cs) (revision c05d1ef136bcd8e31ce35f00d87168e359d36f3e) @@ -83,7 +83,6 @@ IDictionary columnStateDefinitions = row.ColumnStateDefinitions; Assert.AreEqual(1, columnStateDefinitions.Count); FailureMechanismSectionResultRowTestHelper.AssertColumnStateDefinition(columnStateDefinitions, categoryIndex); - Assert.IsTrue(columnStateDefinitions[categoryIndex].ReadOnly); Assert.AreEqual(failureMechanismName, row.Name); Assert.AreEqual(failureMechanismCode, row.Code); @@ -210,11 +209,14 @@ var row = new FailureMechanismAssemblyResultRow(failureMechanism, () => failureMechanismAssembly); + // Precondition + IDictionary columnStateDefinitions = row.ColumnStateDefinitions; + Assert.IsTrue(columnStateDefinitions[categoryIndex].ReadOnly); + // When row.Update(); // Then - IDictionary columnStateDefinitions = row.ColumnStateDefinitions; Assert.IsTrue(columnStateDefinitions[categoryIndex].ReadOnly); } }