Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/StrengthStabilityLengthwiseConstructionResultViewTest.cs =================================================================== diff -u -r44420c717ac32101ba0da4739d259c622f47976e -r802d3cd39b925ac9873ea277588ecd1933e374f6 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/StrengthStabilityLengthwiseConstructionResultViewTest.cs (.../StrengthStabilityLengthwiseConstructionResultViewTest.cs) (revision 44420c717ac32101ba0da4739d259c622f47976e) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/StrengthStabilityLengthwiseConstructionResultViewTest.cs (.../StrengthStabilityLengthwiseConstructionResultViewTest.cs) (revision 802d3cd39b925ac9873ea277588ecd1933e374f6) @@ -19,15 +19,8 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. -using System; -using System.Windows.Forms; -using Core.Common.Base; -using Core.Common.TestUtil; -using NUnit.Extensions.Forms; using NUnit.Framework; -using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Forms.Views; -using Ringtoets.Common.Primitives; using Ringtoets.Integration.Data.StandAlone; using Ringtoets.Integration.Data.StandAlone.SectionResults; using Ringtoets.Integration.Forms.Views.SectionResultRows; @@ -58,159 +51,5 @@ Assert.AreSame(failureMechanism, view.FailureMechanism); } } - - [Test] - public void GivenFormWithFailureMechanismResultView_ThenExpectedColumnsAreVisible() - { - // Given - using (var form = new Form()) - using (var view = new StrengthStabilityLengthwiseConstructionResultView( - new ObservableList(), - new StrengthStabilityLengthwiseConstructionFailureMechanism())) - { - form.Controls.Add(view); - form.Show(); - - // Then - var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; - - Assert.AreEqual(3, dataGridView.ColumnCount); - - Assert.IsInstanceOf(dataGridView.Columns[simpleAssessmentIndex]); - Assert.IsInstanceOf(dataGridView.Columns[assessmentLayerThreeIndex]); - - Assert.AreEqual("Eenvoudige toets", dataGridView.Columns[simpleAssessmentIndex].HeaderText); - Assert.AreEqual("Toets op maat", dataGridView.Columns[assessmentLayerThreeIndex].HeaderText); - - Assert.AreEqual(DataGridViewAutoSizeColumnsMode.AllCells, dataGridView.AutoSizeColumnsMode); - Assert.AreEqual(DataGridViewContentAlignment.MiddleCenter, dataGridView.ColumnHeadersDefaultCellStyle.Alignment); - } - } - - [Test] - public void FailureMechanismResultView_WithFailureMechanismSectionResultAssigned_SectionsAddedAsRows() - { - // Setup - var random = new Random(21); - var result1 = new StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult( - FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 1")) - { - SimpleAssessmentResult = SimpleAssessmentResultType.None, - AssessmentLayerThree = random.NextRoundedDouble() - }; - var result2 = new StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult( - FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 2")) - { - SimpleAssessmentResult = SimpleAssessmentResultType.NotApplicable, - AssessmentLayerThree = random.NextRoundedDouble() - }; - var result3 = new StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult( - FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 3")) - { - SimpleAssessmentResult = SimpleAssessmentResultType.ProbabilityNegligible, - AssessmentLayerThree = random.NextRoundedDouble() - }; - var result4 = new StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult( - FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 4")) - { - SimpleAssessmentResult = SimpleAssessmentResultType.AssessFurther, - AssessmentLayerThree = random.NextRoundedDouble() - }; - var sectionResults = new ObservableList - { - result1, - result2, - result3, - result4 - }; - - // Call - using (var form = new Form()) - using (var view = new StrengthStabilityLengthwiseConstructionResultView(sectionResults, - new StrengthStabilityLengthwiseConstructionFailureMechanism())) - { - form.Controls.Add(view); - form.Show(); - - // Assert - var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; - DataGridViewRowCollection rows = dataGridView.Rows; - Assert.AreEqual(4, rows.Count); - - DataGridViewCellCollection cells = rows[0].Cells; - Assert.AreEqual(3, cells.Count); - Assert.AreEqual("Section 1", cells[nameColumnIndex].FormattedValue); - Assert.AreEqual(result1.SimpleAssessmentResult, cells[simpleAssessmentIndex].Value); - Assert.AreEqual(result1.AssessmentLayerThree.ToString(), cells[assessmentLayerThreeIndex].FormattedValue); - - DataGridViewTestHelper.AssertCellIsEnabled(cells[assessmentLayerThreeIndex]); - - cells = rows[1].Cells; - Assert.AreEqual(3, cells.Count); - Assert.AreEqual("Section 2", cells[nameColumnIndex].FormattedValue); - Assert.AreEqual(result2.SimpleAssessmentResult, cells[simpleAssessmentIndex].Value); - Assert.AreEqual(result2.AssessmentLayerThree.ToString(), cells[assessmentLayerThreeIndex].FormattedValue); - - DataGridViewTestHelper.AssertCellIsDisabled(cells[assessmentLayerThreeIndex]); - - cells = rows[2].Cells; - Assert.AreEqual(3, cells.Count); - Assert.AreEqual("Section 3", cells[nameColumnIndex].FormattedValue); - Assert.AreEqual(result3.SimpleAssessmentResult, cells[simpleAssessmentIndex].Value); - Assert.AreEqual(result3.AssessmentLayerThree.ToString(), cells[assessmentLayerThreeIndex].FormattedValue); - - DataGridViewTestHelper.AssertCellIsDisabled(cells[assessmentLayerThreeIndex]); - - cells = rows[3].Cells; - Assert.AreEqual(3, cells.Count); - Assert.AreEqual("Section 4", cells[nameColumnIndex].FormattedValue); - Assert.AreEqual(result4.SimpleAssessmentResult, cells[simpleAssessmentIndex].Value); - Assert.AreEqual(result4.AssessmentLayerThree.ToString(), cells[assessmentLayerThreeIndex].FormattedValue); - - DataGridViewTestHelper.AssertCellIsEnabled(cells[assessmentLayerThreeIndex]); - } - } - - [Test] - [TestCase(SimpleAssessmentResultType.None)] - [TestCase(SimpleAssessmentResultType.AssessFurther)] - public void GivenFormWithFailureMechanismResultView_WhenSectionPassesSimpleAssessmentAndListenersNotified_ThenRowsForSectionDisabled( - SimpleAssessmentResultType simpleAssessmentResult) - { - // Given - var random = new Random(21); - var result = new StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult( - FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) - { - SimpleAssessmentResult = simpleAssessmentResult, - AssessmentLayerThree = random.NextRoundedDouble() - }; - var sectionResults = new ObservableList - { - result - }; - - using (var form = new Form()) - using (var view = new StrengthStabilityLengthwiseConstructionResultView(sectionResults, - new StrengthStabilityLengthwiseConstructionFailureMechanism())) - { - 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 = rows[0].Cells; - Assert.AreEqual(3, cells.Count); - - DataGridViewTestHelper.AssertCellIsDisabled(cells[assessmentLayerThreeIndex]); - } - } } } \ No newline at end of file