Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs =================================================================== diff -u -r1d7200c0c6202324faaa30dadb7df91f99b1eb44 -r82feef3e508c2a4fdae35ce6af4b755a3d0c4160 --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 1d7200c0c6202324faaa30dadb7df91f99b1eb44) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 82feef3e508c2a4fdae35ce6af4b755a3d0c4160) @@ -330,7 +330,8 @@ }; yield return new PropertyInfo { - CreateInstance = context => new DesignWaterLevelLocationProperties(context.WrappedData, context.Calculation) + CreateInstance = context => new DesignWaterLevelLocationProperties(context.WrappedData, + context.Calculation) }; yield return new PropertyInfo { @@ -339,7 +340,8 @@ }; yield return new PropertyInfo { - CreateInstance = context => new WaveHeightLocationProperties(context.WrappedData, context.Calculation) + CreateInstance = context => new WaveHeightLocationProperties(context.WrappedData, + context.Calculation) }; yield return new PropertyInfo(); yield return new PropertyInfo @@ -370,7 +372,8 @@ }; yield return new PropertyInfo { - CreateInstance = context => new FailureMechanismSectionsProperties(context.WrappedData.Sections, context.WrappedData) + CreateInstance = context => new FailureMechanismSectionsProperties(context.WrappedData.Sections, + context.WrappedData) }; yield return new PropertyInfo { Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/DesignWaterLevelLocationsContextPropertyInfoTest.cs =================================================================== diff -u -r070acdcdc07854f93138da547e97dd7754a5ffc7 -r82feef3e508c2a4fdae35ce6af4b755a3d0c4160 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/DesignWaterLevelLocationsContextPropertyInfoTest.cs (.../DesignWaterLevelLocationsContextPropertyInfoTest.cs) (revision 070acdcdc07854f93138da547e97dd7754a5ffc7) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/DesignWaterLevelLocationsContextPropertyInfoTest.cs (.../DesignWaterLevelLocationsContextPropertyInfoTest.cs) (revision 82feef3e508c2a4fdae35ce6af4b755a3d0c4160) @@ -63,7 +63,7 @@ var random = new Random(); var hydraulicBoundaryLocations = new ObservableList(); - var locationsLookup = new Dictionary + var hydraulicBoundaryLocationsLookup = new Dictionary { { new TestHydraulicBoundaryLocation(), @@ -81,11 +81,11 @@ } }; - hydraulicBoundaryLocations.AddRange(locationsLookup.Keys); + hydraulicBoundaryLocations.AddRange(hydraulicBoundaryLocationsLookup.Keys); var context = new DesignWaterLevelLocationsContext(hydraulicBoundaryLocations, assessmentSection, - hbl => locationsLookup[hbl], + hbl => hydraulicBoundaryLocationsLookup[hbl], "Category"); using (var plugin = new RingtoetsPlugin()) @@ -99,8 +99,8 @@ Assert.IsInstanceOf(objectProperties); Assert.AreSame(hydraulicBoundaryLocations, objectProperties.Data); DesignWaterLevelLocationProperties[] locationProperties = ((DesignWaterLevelLocationsProperties) objectProperties).Locations; - CollectionAssert.AreEqual(locationsLookup.Keys, locationProperties.Select(p => p.Data)); - CollectionAssert.AreEqual(locationsLookup.Values.Select(c => c.Output.Result), locationProperties.Select(p => p.DesignWaterLevel)); + CollectionAssert.AreEqual(hydraulicBoundaryLocationsLookup.Keys, locationProperties.Select(p => p.Data)); + CollectionAssert.AreEqual(hydraulicBoundaryLocationsLookup.Values.Select(c => c.Output.Result), locationProperties.Select(p => p.DesignWaterLevel)); } mockRepository.VerifyAll(); Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/WaveHeightLocationsContextPropertyInfoTest.cs =================================================================== diff -u -r070acdcdc07854f93138da547e97dd7754a5ffc7 -r82feef3e508c2a4fdae35ce6af4b755a3d0c4160 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/WaveHeightLocationsContextPropertyInfoTest.cs (.../WaveHeightLocationsContextPropertyInfoTest.cs) (revision 070acdcdc07854f93138da547e97dd7754a5ffc7) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/WaveHeightLocationsContextPropertyInfoTest.cs (.../WaveHeightLocationsContextPropertyInfoTest.cs) (revision 82feef3e508c2a4fdae35ce6af4b755a3d0c4160) @@ -63,7 +63,7 @@ var random = new Random(); var hydraulicBoundaryLocations = new ObservableList(); - var locationsLookup = new Dictionary + var hydraulicBoundaryLocationsLookup = new Dictionary { { new TestHydraulicBoundaryLocation(), @@ -81,11 +81,11 @@ } }; - hydraulicBoundaryLocations.AddRange(locationsLookup.Keys); + hydraulicBoundaryLocations.AddRange(hydraulicBoundaryLocationsLookup.Keys); var context = new WaveHeightLocationsContext(hydraulicBoundaryLocations, assessmentSection, - hbl => locationsLookup[hbl], + hbl => hydraulicBoundaryLocationsLookup[hbl], "Category"); using (var plugin = new RingtoetsPlugin()) @@ -99,8 +99,8 @@ Assert.IsInstanceOf(objectProperties); Assert.AreSame(hydraulicBoundaryLocations, objectProperties.Data); WaveHeightLocationProperties[] locationProperties = ((WaveHeightLocationsProperties) objectProperties).Locations; - CollectionAssert.AreEqual(locationsLookup.Keys, locationProperties.Select(p => p.Data)); - CollectionAssert.AreEqual(locationsLookup.Values.Select(c => c.Output.Result), locationProperties.Select(p => p.WaveHeight)); + CollectionAssert.AreEqual(hydraulicBoundaryLocationsLookup.Keys, locationProperties.Select(p => p.Data)); + CollectionAssert.AreEqual(hydraulicBoundaryLocationsLookup.Values.Select(c => c.Output.Result), locationProperties.Select(p => p.WaveHeight)); } mockRepository.VerifyAll(); Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj =================================================================== diff -u -r070acdcdc07854f93138da547e97dd7754a5ffc7 -r82feef3e508c2a4fdae35ce6af4b755a3d0c4160 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision 070acdcdc07854f93138da547e97dd7754a5ffc7) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision 82feef3e508c2a4fdae35ce6af4b755a3d0c4160) @@ -207,6 +207,10 @@ {4843D6E5-066F-4795-94F5-1D53932DD03C} Ringtoets.Common.Data.TestUtil + + {D24FA2F7-28A7-413B-AFD3-EE10E985630B} + Ringtoets.Common.Forms.TestUtil + {6346BADF-D331-4948-9772-08E8CD1E1FC9} Ringtoets.Common.Plugin.TestUtil 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); + } } } Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/WaveHeightLocationsViewInfoTest.cs =================================================================== diff -u -ra5bf4f56dbf07e5cf48d0b874f5d46d7d02f0dba -r82feef3e508c2a4fdae35ce6af4b755a3d0c4160 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/WaveHeightLocationsViewInfoTest.cs (.../WaveHeightLocationsViewInfoTest.cs) (revision a5bf4f56dbf07e5cf48d0b874f5d46d7d02f0dba) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/WaveHeightLocationsViewInfoTest.cs (.../WaveHeightLocationsViewInfoTest.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 WaveHeightLocationsViewInfoTest { + private const int locationWaveHeightColumnIndex = 5; + private RingtoetsPlugin plugin; private ViewInfo info; @@ -128,13 +132,35 @@ } [Test] - public void CreateInstance_WithContext_SetExpectedProperties() + public void CreateInstance_WithContext_SetsExpectedData() { // Setup + var random = new Random(); var assessmentSection = new ObservableTestAssessmentSectionStub(); - var context = new WaveHeightLocationsContext(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 WaveHeightLocationsContext(hydraulicBoundaryLocations, assessmentSection, - hbl => new HydraulicBoundaryLocationCalculation(), + hbl => hydraulicBoundaryLocationsLookup[hbl], "Category"); using (var ringtoetsPlugin = new RingtoetsPlugin()) @@ -146,6 +172,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[locationWaveHeightColumnIndex].FormattedValue); + Assert.AreEqual(hydraulicBoundaryLocationsLookup.Values.ElementAt(1).Output.Result.ToString(), rows[1].Cells[locationWaveHeightColumnIndex].FormattedValue); + } } }