Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/DesignWaterLevelLocationsViewInfoTest.cs =================================================================== diff -u -ra5bf4f56dbf07e5cf48d0b874f5d46d7d02f0dba -r82feef3e508c2a4fdae35ce6af4b755a3d0c4160 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/DesignWaterLevelLocationsViewInfoTest.cs (.../DesignWaterLevelLocationsViewInfoTest.cs) (revision a5bf4f56dbf07e5cf48d0b874f5d46d7d02f0dba) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/DesignWaterLevelLocationsViewInfoTest.cs (.../DesignWaterLevelLocationsViewInfoTest.cs) (revision 82feef3e508c2a4fdae35ce6af4b755a3d0c4160) @@ -24,6 +24,7 @@ using System.Drawing; using System.Linq; using System.Threading; +using System.Windows.Forms; using Core.Common.Base; using Core.Common.Gui; using Core.Common.Gui.Commands; @@ -36,6 +37,7 @@ using Ringtoets.Common.Data.Hydraulics; using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Forms.GuiServices; +using Ringtoets.Common.Forms.TestUtil; using Ringtoets.Integration.Forms.PresentationObjects; using Ringtoets.Integration.Forms.Views; using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; @@ -45,6 +47,8 @@ [TestFixture] public class DesignWaterLevelLocationsViewInfoTest { + private const int locationDesignWaterlevelColumnIndex = 5; + private RingtoetsPlugin plugin; private ViewInfo info; @@ -127,13 +131,35 @@ } [Test] - public void CreateInstance_WithContext_SetExpectedProperties() + public void CreateInstance_WithContext_SetsExpectedData() { // Setup + var random = new Random(); var assessmentSection = new ObservableTestAssessmentSectionStub(); - var context = new DesignWaterLevelLocationsContext(new ObservableList(), + var hydraulicBoundaryLocations = new ObservableList(); + var hydraulicBoundaryLocationsLookup = new Dictionary + { + { + new TestHydraulicBoundaryLocation(), + new HydraulicBoundaryLocationCalculation + { + Output = new TestHydraulicBoundaryLocationOutput(random.NextDouble()) + } + }, + { + new TestHydraulicBoundaryLocation(), + new HydraulicBoundaryLocationCalculation + { + Output = new TestHydraulicBoundaryLocationOutput(random.NextDouble()) + } + } + }; + + hydraulicBoundaryLocations.AddRange(hydraulicBoundaryLocationsLookup.Keys); + + var context = new DesignWaterLevelLocationsContext(hydraulicBoundaryLocations, assessmentSection, - hbl => new HydraulicBoundaryLocationCalculation(), + hbl => hydraulicBoundaryLocationsLookup[hbl], "Category"); using (var ringtoetsPlugin = new RingtoetsPlugin()) @@ -145,6 +171,18 @@ // Assert Assert.AreSame(assessmentSection, view.AssessmentSection); + + using (var testForm = new Form()) + { + testForm.Controls.Add(view); + testForm.Show(); + + DataGridView locationsDataGridView = ControlTestHelper.GetDataGridView(view, "DataGridView"); + DataGridViewRowCollection rows = locationsDataGridView.Rows; + Assert.AreEqual(2, rows.Count); + Assert.AreEqual(hydraulicBoundaryLocationsLookup.Values.ElementAt(0).Output.Result.ToString(), rows[0].Cells[locationDesignWaterlevelColumnIndex].FormattedValue); + Assert.AreEqual(hydraulicBoundaryLocationsLookup.Values.ElementAt(1).Output.Result.ToString(), rows[1].Cells[locationDesignWaterlevelColumnIndex].FormattedValue); + } } }