Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/MicrostabilityResultViewTest.cs =================================================================== diff -u -r94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4 -r6351c078e52e7a091c3307337ba66e18fde91525 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/MicrostabilityResultViewTest.cs (.../MicrostabilityResultViewTest.cs) (revision 94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/MicrostabilityResultViewTest.cs (.../MicrostabilityResultViewTest.cs) (revision 6351c078e52e7a091c3307337ba66e18fde91525) @@ -22,13 +22,13 @@ 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.Views; +using Ringtoets.Integration.Data.StandAlone; using Ringtoets.Integration.Data.StandAlone.SectionResults; using Ringtoets.Integration.Forms.Views.SectionResultViews; @@ -46,14 +46,16 @@ public void Constructor_ExpectedValues() { // Setup - var failureMechanismSectionResults = new ObservableList(); + var failureMechanism = new MicrostabilityFailureMechanism(); // Call - using (var view = new MicrostabilityResultView(failureMechanismSectionResults)) + using (var view = new MicrostabilityResultView(failureMechanism, failureMechanism.SectionResults)) { // Assert - Assert.IsInstanceOf>(view); - Assert.AreSame(failureMechanismSectionResults, view.Data); + Assert.IsInstanceOf>(view); + Assert.IsNull(view.Data); + Assert.AreSame(failureMechanism, view.FailureMechanism); } } @@ -62,7 +64,8 @@ { // Given using (var form = new Form()) - using (var view = new MicrostabilityResultView(new ObservableList())) + using (var view = new MicrostabilityResultView(new MicrostabilityFailureMechanism(), + new ObservableList())) { form.Controls.Add(view); @@ -88,9 +91,9 @@ } [Test] - public void GivenFormWithFailureMechanismResultView_WhenDataSourceWithFailureMechanismSectionResultAssigned_ThenSectionsAddedAsRows() + public void FailureMechanismResultView_WithFailureMechanismSectionResultAssigned_SectionsAddedAsRows() { - // Given + // Setup var section1 = new FailureMechanismSection("Section 1", new[] { new Point2D(0, 0) @@ -109,19 +112,19 @@ { AssessmentLayerOne = AssessmentLayerOneState.Sufficient, AssessmentLayerTwoA = AssessmentLayerTwoAResult.Failed, - AssessmentLayerThree = (RoundedDouble) random.NextDouble() + AssessmentLayerThree = random.NextRoundedDouble() }; var result2 = new MicrostabilityFailureMechanismSectionResult(section2) { AssessmentLayerOne = AssessmentLayerOneState.NotAssessed, AssessmentLayerTwoA = AssessmentLayerTwoAResult.Successful, - AssessmentLayerThree = (RoundedDouble) random.NextDouble() + AssessmentLayerThree = random.NextRoundedDouble() }; var result3 = new MicrostabilityFailureMechanismSectionResult(section3) { AssessmentLayerOne = AssessmentLayerOneState.NoVerdict, AssessmentLayerTwoA = AssessmentLayerTwoAResult.Successful, - AssessmentLayerThree = (RoundedDouble) random.NextDouble() + AssessmentLayerThree = random.NextRoundedDouble() }; var sectionResults = new ObservableList { @@ -130,16 +133,14 @@ result3 }; + // Call using (var form = new Form()) - using (var view = new MicrostabilityResultView(sectionResults)) + using (var view = new MicrostabilityResultView(new MicrostabilityFailureMechanism(), sectionResults)) { form.Controls.Add(view); form.Show(); - // When - view.Data = sectionResults; - - // Then + // Assert var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; DataGridViewRowCollection rows = dataGridView.Rows; @@ -193,21 +194,19 @@ { AssessmentLayerOne = assessmentLayerOneState, AssessmentLayerTwoA = AssessmentLayerTwoAResult.Failed, - AssessmentLayerThree = (RoundedDouble) random.NextDouble() + AssessmentLayerThree = random.NextRoundedDouble() }; var sectionResults = new ObservableList { result }; using (var form = new Form()) - using (var view = new MicrostabilityResultView(sectionResults)) + using (var view = new MicrostabilityResultView(new MicrostabilityFailureMechanism(), sectionResults)) { form.Controls.Add(view); form.Show(); - view.Data = sectionResults; - // When result.AssessmentLayerOne = AssessmentLayerOneState.Sufficient; result.NotifyObservers();