Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/TechnicalInnovationResultViewTest.cs =================================================================== diff -u -r94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4 -r6351c078e52e7a091c3307337ba66e18fde91525 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/TechnicalInnovationResultViewTest.cs (.../TechnicalInnovationResultViewTest.cs) (revision 94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/TechnicalInnovationResultViewTest.cs (.../TechnicalInnovationResultViewTest.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; @@ -45,14 +45,16 @@ public void Constructor_ExpectedValues() { // Setup - var failureMechanismSectionResults = new ObservableList(); + var failureMechanism = new TechnicalInnovationFailureMechanism(); // Call - using (var view = new TechnicalInnovationResultView(failureMechanismSectionResults)) + using (var view = new TechnicalInnovationResultView(failureMechanism, failureMechanism.SectionResults)) { // Assert - Assert.IsInstanceOf>(view); - Assert.AreSame(failureMechanismSectionResults, view.Data); + Assert.IsInstanceOf>(view); + Assert.IsNull(view.Data); + Assert.AreSame(failureMechanism, view.FailureMechanism); } } @@ -61,7 +63,8 @@ { // Given using (var form = new Form()) - using (var view = new TechnicalInnovationResultView(new ObservableList())) + using (var view = new TechnicalInnovationResultView(new TechnicalInnovationFailureMechanism(), + new ObservableList())) { form.Controls.Add(view); @@ -85,9 +88,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) @@ -105,17 +108,17 @@ var result1 = new TechnicalInnovationFailureMechanismSectionResult(section1) { AssessmentLayerOne = AssessmentLayerOneState.Sufficient, - AssessmentLayerThree = (RoundedDouble) random.NextDouble() + AssessmentLayerThree = random.NextRoundedDouble() }; var result2 = new TechnicalInnovationFailureMechanismSectionResult(section2) { AssessmentLayerOne = AssessmentLayerOneState.NotAssessed, - AssessmentLayerThree = (RoundedDouble) random.NextDouble() + AssessmentLayerThree = random.NextRoundedDouble() }; var result3 = new TechnicalInnovationFailureMechanismSectionResult(section3) { AssessmentLayerOne = AssessmentLayerOneState.NoVerdict, - AssessmentLayerThree = (RoundedDouble) random.NextDouble() + AssessmentLayerThree = random.NextRoundedDouble() }; var sectionResults = new ObservableList { @@ -124,16 +127,15 @@ result3 }; + // Call using (var form = new Form()) - using (var view = new TechnicalInnovationResultView(sectionResults)) + using (var view = new TechnicalInnovationResultView(new TechnicalInnovationFailureMechanism(), + sectionResults)) { form.Controls.Add(view); form.Show(); - // When - view.Data = sectionResults; - - // Then + // Assert var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; DataGridViewRowCollection rows = dataGridView.Rows; @@ -180,21 +182,20 @@ var result = new TechnicalInnovationFailureMechanismSectionResult(section) { AssessmentLayerOne = assessmentLayerOneState, - AssessmentLayerThree = (RoundedDouble) random.NextDouble() + AssessmentLayerThree = random.NextRoundedDouble() }; var sectionResults = new ObservableList { result }; using (var form = new Form()) - using (var view = new TechnicalInnovationResultView(sectionResults)) + using (var view = new TechnicalInnovationResultView(new TechnicalInnovationFailureMechanism(), + sectionResults)) { form.Controls.Add(view); form.Show(); - view.Data = sectionResults; - // When result.AssessmentLayerOne = AssessmentLayerOneState.Sufficient; result.NotifyObservers();