Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/StrengthStabilityLengthwiseConstructionResultViewTest.cs =================================================================== diff -u -rbdfc832a125e7fac88579677e784a29a7ca1340b -r94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/StrengthStabilityLengthwiseConstructionResultViewTest.cs (.../StrengthStabilityLengthwiseConstructionResultViewTest.cs) (revision bdfc832a125e7fac88579677e784a29a7ca1340b) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/StrengthStabilityLengthwiseConstructionResultViewTest.cs (.../StrengthStabilityLengthwiseConstructionResultViewTest.cs) (revision 94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4) @@ -21,13 +21,14 @@ using System; using System.Windows.Forms; +using Core.Common.Base; using Core.Common.Base.Data; using Core.Common.Base.Geometry; using Core.Common.TestUtil; using NUnit.Extensions.Forms; using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; -using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Forms.Views; using Ringtoets.Integration.Data.StandAlone.SectionResults; using Ringtoets.Integration.Forms.Views.SectionResultViews; @@ -41,11 +42,27 @@ private const int assessmentLayerThreeIndex = 2; [Test] + public void Constructor_ExpectedValues() + { + // Setup + var failureMechanismSectionResults = new ObservableList(); + + // Call + using (var view = new StrengthStabilityLengthwiseConstructionResultView(failureMechanismSectionResults)) + { + // Assert + Assert.IsInstanceOf>(view); + Assert.AreSame(failureMechanismSectionResults, view.Data); + } + } + + [Test] public void GivenFormWithFailureMechanismResultView_ThenExpectedColumnsAreVisible() { // Given using (var form = new Form()) - using (var view = new StrengthStabilityLengthwiseConstructionResultView()) + using (var view = new StrengthStabilityLengthwiseConstructionResultView( + new ObservableList())) { form.Controls.Add(view); form.Show(); @@ -99,20 +116,21 @@ AssessmentLayerOne = AssessmentLayerOneState.NoVerdict, AssessmentLayerThree = (RoundedDouble) random.NextDouble() }; + var sectionResults = new ObservableList + { + result1, + result2, + result3 + }; using (var form = new Form()) - using (var view = new StrengthStabilityLengthwiseConstructionResultView()) + using (var view = new StrengthStabilityLengthwiseConstructionResultView(sectionResults)) { form.Controls.Add(view); form.Show(); // When - view.Data = new[] - { - result1, - result2, - result3 - }; + view.Data = sectionResults; // Then var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; @@ -162,16 +180,18 @@ AssessmentLayerOne = assessmentLayerOneState, AssessmentLayerThree = (RoundedDouble) random.NextDouble() }; + var sectionResults = new ObservableList + { + result + }; + using (var form = new Form()) - using (var view = new StrengthStabilityLengthwiseConstructionResultView()) + using (var view = new StrengthStabilityLengthwiseConstructionResultView(sectionResults)) { form.Controls.Add(view); form.Show(); - view.Data = new[] - { - result - }; + view.Data = sectionResults; // When result.AssessmentLayerOne = AssessmentLayerOneState.Sufficient; @@ -188,40 +208,5 @@ DataGridViewTestHelper.AssertCellIsDisabled(cells[assessmentLayerThreeIndex]); } } - - [Test] - public void GivenFormWithFailureMechanismResultView_WhenDataSourceWithOtherFailureMechanismSectionResultAssigned_ThenSectionsNotAdded() - { - // Given - var section1 = new FailureMechanismSection("Section 1", new[] - { - new Point2D(0, 0) - }); - var section2 = new FailureMechanismSection("Section 2", new[] - { - new Point2D(0, 0) - }); - var result1 = new TestFailureMechanismSectionResult(section1); - var result2 = new TestFailureMechanismSectionResult(section2); - - using (var form = new Form()) - using (var view = new StrengthStabilityLengthwiseConstructionResultView()) - { - form.Controls.Add(view); - form.Show(); - - // When - view.Data = new[] - { - result1, - result2 - }; - - // Then - var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; - DataGridViewRowCollection rows = dataGridView.Rows; - Assert.AreEqual(0, rows.Count); - } - } } } \ No newline at end of file