Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/MacrostabilityOutwardsResultViewTest.cs =================================================================== diff -u -r94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4 -r6351c078e52e7a091c3307337ba66e18fde91525 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/MacrostabilityOutwardsResultViewTest.cs (.../MacrostabilityOutwardsResultViewTest.cs) (revision 94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/MacrostabilityOutwardsResultViewTest.cs (.../MacrostabilityOutwardsResultViewTest.cs) (revision 6351c078e52e7a091c3307337ba66e18fde91525) @@ -22,14 +22,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.Forms.Helpers; using Ringtoets.Common.Forms.Views; +using Ringtoets.Integration.Data.StandAlone; using Ringtoets.Integration.Data.StandAlone.SectionResults; using Ringtoets.Integration.Forms.Views.SectionResultViews; @@ -47,14 +47,16 @@ public void Constructor_ExpectedValues() { // Setup - var failureMechanismSectionResults = new ObservableList(); + var failureMechanism = new MacroStabilityOutwardsFailureMechanism(); // Call - using (var view = new MacroStabilityOutwardsResultView(failureMechanismSectionResults)) + using (var view = new MacroStabilityOutwardsResultView(failureMechanism, failureMechanism.SectionResults)) { // Assert - Assert.IsInstanceOf>(view); - Assert.AreSame(failureMechanismSectionResults, view.Data); + Assert.IsInstanceOf>(view); + Assert.IsNull(view.Data); + Assert.AreSame(failureMechanism, view.FailureMechanism); } } @@ -63,7 +65,8 @@ { // Given using (var form = new Form()) - using (var view = new MacroStabilityOutwardsResultView(new ObservableList())) + using (var view = new MacroStabilityOutwardsResultView(new MacroStabilityOutwardsFailureMechanism(), + new ObservableList())) { form.Controls.Add(view); form.Show(); @@ -87,9 +90,9 @@ } [Test] - public void GivenFormWithFailureMechanismResultView_WhenDataSourceWithFailureMechanismSectionResultAssigned_ThenSectionsAddedAsRows() + public void FailureMechanismResultView_FailureMechanismSectionResultAssigned_SectionsAddedAsRows() { - // Given + // Setup var section1 = new FailureMechanismSection("Section 1", new[] { new Point2D(0, 0) @@ -107,20 +110,20 @@ var result1 = new MacroStabilityOutwardsFailureMechanismSectionResult(section1) { AssessmentLayerOne = AssessmentLayerOneState.Sufficient, - AssessmentLayerTwoA = (RoundedDouble) random.NextDouble(), - AssessmentLayerThree = (RoundedDouble) random.NextDouble() + AssessmentLayerTwoA = random.NextRoundedDouble(), + AssessmentLayerThree = random.NextRoundedDouble() }; var result2 = new MacroStabilityOutwardsFailureMechanismSectionResult(section2) { AssessmentLayerOne = AssessmentLayerOneState.NotAssessed, - AssessmentLayerTwoA = (RoundedDouble) random.NextDouble(), - AssessmentLayerThree = (RoundedDouble) random.NextDouble() + AssessmentLayerTwoA = random.NextRoundedDouble(), + AssessmentLayerThree = random.NextRoundedDouble() }; var result3 = new MacroStabilityOutwardsFailureMechanismSectionResult(section3) { AssessmentLayerOne = AssessmentLayerOneState.NoVerdict, - AssessmentLayerTwoA = (RoundedDouble) random.NextDouble(), - AssessmentLayerThree = (RoundedDouble) random.NextDouble() + AssessmentLayerTwoA = random.NextRoundedDouble(), + AssessmentLayerThree = random.NextRoundedDouble() }; var sectionResults = new ObservableList { @@ -129,16 +132,14 @@ result3 }; + // Call using (var form = new Form()) - using (var view = new MacroStabilityOutwardsResultView(sectionResults)) + using (var view = new MacroStabilityOutwardsResultView(new MacroStabilityOutwardsFailureMechanism(), sectionResults)) { form.Controls.Add(view); form.Show(); - // When - view.Data = sectionResults; - - // Then + // Assert var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; DataGridViewRowCollection rows = dataGridView.Rows; Assert.AreEqual(3, rows.Count); @@ -192,22 +193,20 @@ })) { AssessmentLayerOne = assessmentLayerOneState, - AssessmentLayerTwoA = (RoundedDouble) random.NextDouble(), - AssessmentLayerThree = (RoundedDouble) random.NextDouble() + AssessmentLayerTwoA = random.NextRoundedDouble(), + AssessmentLayerThree = random.NextRoundedDouble() }; var sectionResults = new ObservableList { result }; using (var form = new Form()) - using (var view = new MacroStabilityOutwardsResultView(sectionResults)) + using (var view = new MacroStabilityOutwardsResultView(new MacroStabilityOutwardsFailureMechanism(), sectionResults)) { form.Controls.Add(view); form.Show(); - view.Data = sectionResults; - // When result.AssessmentLayerOne = AssessmentLayerOneState.Sufficient; result.NotifyObservers();