Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/DesignWaterLevelLocationContext.cs =================================================================== diff -u -r82c089ea04d564cd80d55a8e0f74a112efbe9c0f -rbba9524cfdab4e69348fddab60efe718e7c1865b --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/DesignWaterLevelLocationContext.cs (.../DesignWaterLevelLocationContext.cs) (revision 82c089ea04d564cd80d55a8e0f74a112efbe9c0f) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/DesignWaterLevelLocationContext.cs (.../DesignWaterLevelLocationContext.cs) (revision bba9524cfdab4e69348fddab60efe718e7c1865b) @@ -20,22 +20,23 @@ // All rights reserved. using System; -using Core.Common.Controls.PresentationObjects; using Ringtoets.HydraRing.Data; namespace Ringtoets.Integration.Forms.PresentationObjects { /// /// Presentation object for all data required to configure an instance of - /// with . + /// with . /// - public class DesignWaterLevelLocationContext : ObservableWrappedObjectContextBase + public class DesignWaterLevelLocationContext : HydraulicBoundaryLocationContext { /// /// Creates a new instance of . /// - /// The which the belongs to. - /// Thrown when is null. - public DesignWaterLevelLocationContext(HydraulicBoundaryLocation wrappedData) : base(wrappedData) {} + /// The which the belongs to. + /// The which the belongs to. + /// Thrown when any input parameter is null. + public DesignWaterLevelLocationContext(HydraulicBoundaryDatabase wrappedData, HydraulicBoundaryLocation hydraulicBoundaryLocation) + : base(wrappedData, hydraulicBoundaryLocation) {} } } \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/HydraulicBoundaryLocationContext.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/HydraulicBoundaryLocationContext.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/HydraulicBoundaryLocationContext.cs (revision bba9524cfdab4e69348fddab60efe718e7c1865b) @@ -0,0 +1,56 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Core.Common.Controls.PresentationObjects; +using Ringtoets.HydraRing.Data; + +namespace Ringtoets.Integration.Forms.PresentationObjects +{ + /// + /// Presentation object for all data required to configure an instance of . + /// + public abstract class HydraulicBoundaryLocationContext : ObservableWrappedObjectContextBase + { + /// + /// Creates a new instance of . + /// + /// The which the + /// belongs to. + /// The + /// which the belongs to. + /// Thrown when any input parameter is null. + protected HydraulicBoundaryLocationContext(HydraulicBoundaryDatabase wrappedData, + HydraulicBoundaryLocation hydraulicBoundaryLocation) : base(wrappedData) + { + if (hydraulicBoundaryLocation == null) + { + throw new ArgumentNullException("hydraulicBoundaryLocation"); + } + HydraulicBoundaryLocation = hydraulicBoundaryLocation; + } + + /// + /// Gets the . + /// + public HydraulicBoundaryLocation HydraulicBoundaryLocation { get; private set; } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/WaveHeightLocationContext.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/WaveHeightLocationContext.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/WaveHeightLocationContext.cs (revision bba9524cfdab4e69348fddab60efe718e7c1865b) @@ -0,0 +1,42 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Ringtoets.HydraRing.Data; + +namespace Ringtoets.Integration.Forms.PresentationObjects +{ + /// + /// Presentation object for all data required to configure an instance of + /// with . + /// + public class WaveHeightLocationContext : HydraulicBoundaryLocationContext + { + /// + /// Creates a new instance of . + /// + /// The which the belongs to. + /// The which the belongs to. + /// Thrown when any input parameter is null. + public WaveHeightLocationContext(HydraulicBoundaryDatabase wrappedData, HydraulicBoundaryLocation hydraulicBoundaryLocation) + : base(wrappedData, hydraulicBoundaryLocation) {} + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/DesignWaterLevelLocationContextProperties.cs =================================================================== diff -u -r6f1e2e16c67292603f19489965183fa7176ff6af -rbba9524cfdab4e69348fddab60efe718e7c1865b --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/DesignWaterLevelLocationContextProperties.cs (.../DesignWaterLevelLocationContextProperties.cs) (revision 6f1e2e16c67292603f19489965183fa7176ff6af) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/DesignWaterLevelLocationContextProperties.cs (.../DesignWaterLevelLocationContextProperties.cs) (revision bba9524cfdab4e69348fddab60efe718e7c1865b) @@ -19,12 +19,14 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System.ComponentModel; using Core.Common.Base.Data; using Core.Common.Base.Geometry; using Core.Common.Gui.Attributes; using Core.Common.Utils; using Core.Common.Utils.Attributes; using Ringtoets.Common.Data.Properties; +using Ringtoets.Common.Forms.TypeConverters; using Ringtoets.HydraRing.Data; namespace Ringtoets.Integration.Forms.PropertyClasses @@ -65,11 +67,12 @@ [ResourcesCategory(typeof(Resources), "Categories_General")] [ResourcesDisplayName(typeof(Properties.Resources), "HydraulicBoundaryDatabase_Locations_DesignWaterLevel_DisplayName")] [ResourcesDescription(typeof(Properties.Resources), "HydraulicBoundaryDatabase_Locations_DesignWaterLevel_Description")] - public string DesignWaterLevel + [TypeConverter(typeof(FailureMechanismSectionResultNoValueRoundedDoubleConverter))] + public RoundedDouble DesignWaterLevel { get { - return double.IsNaN(data.DesignWaterLevel) ? string.Empty : new RoundedDouble(2, data.DesignWaterLevel).ToString(); + return new RoundedDouble(2, data.HydraulicBoundaryLocation.DesignWaterLevel); } } @@ -81,7 +84,7 @@ { get { - return new EnumDisplayWrapper(data.DesignWaterLevelCalculationConvergence).DisplayName; + return new EnumDisplayWrapper(data.HydraulicBoundaryLocation.DesignWaterLevelCalculationConvergence).DisplayName; } } } Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/DesignWaterLevelLocationsContextProperties.cs =================================================================== diff -u -r82c089ea04d564cd80d55a8e0f74a112efbe9c0f -rbba9524cfdab4e69348fddab60efe718e7c1865b --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/DesignWaterLevelLocationsContextProperties.cs (.../DesignWaterLevelLocationsContextProperties.cs) (revision 82c089ea04d564cd80d55a8e0f74a112efbe9c0f) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/DesignWaterLevelLocationsContextProperties.cs (.../DesignWaterLevelLocationsContextProperties.cs) (revision bba9524cfdab4e69348fddab60efe718e7c1865b) @@ -26,6 +26,7 @@ using Core.Common.Utils.Attributes; using Ringtoets.Common.Data.Properties; using Ringtoets.HydraRing.Data; +using Ringtoets.Integration.Forms.PresentationObjects; namespace Ringtoets.Integration.Forms.PropertyClasses { @@ -45,7 +46,7 @@ { return data.Locations.Select(loc => new DesignWaterLevelLocationContextProperties { - Data = loc + Data = new DesignWaterLevelLocationContext(data, loc) }).ToArray(); } } Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/HydraulicBoundaryLocationProperties.cs =================================================================== diff -u -r7057fbcd8621dc714af88e47454b9af566e769de -rbba9524cfdab4e69348fddab60efe718e7c1865b --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/HydraulicBoundaryLocationProperties.cs (.../HydraulicBoundaryLocationProperties.cs) (revision 7057fbcd8621dc714af88e47454b9af566e769de) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/HydraulicBoundaryLocationProperties.cs (.../HydraulicBoundaryLocationProperties.cs) (revision bba9524cfdab4e69348fddab60efe718e7c1865b) @@ -25,14 +25,15 @@ using Core.Common.Utils.Attributes; using Ringtoets.Common.Data.Properties; using Ringtoets.HydraRing.Data; +using Ringtoets.Integration.Forms.PresentationObjects; namespace Ringtoets.Integration.Forms.PropertyClasses { /// /// ViewModel of for properties panel. /// [TypeConverter(typeof(ExpandableObjectConverter))] - public abstract class HydraulicBoundaryLocationProperties : ObjectProperties + public abstract class HydraulicBoundaryLocationProperties : ObjectProperties { [ResourcesCategory(typeof(Resources), "Categories_General")] [ResourcesDisplayName(typeof(Properties.Resources), "HydraulicBoundaryDatabase_Locations_Id_DisplayName")] @@ -41,7 +42,7 @@ { get { - return data.Id; + return data.HydraulicBoundaryLocation.Id; } } @@ -52,7 +53,7 @@ { get { - return data.Name; + return data.HydraulicBoundaryLocation.Name; } } @@ -63,7 +64,7 @@ { get { - return data.Location; + return data.HydraulicBoundaryLocation.Location; } } Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/WaveHeightLocationContextProperties.cs =================================================================== diff -u -r6f1e2e16c67292603f19489965183fa7176ff6af -rbba9524cfdab4e69348fddab60efe718e7c1865b --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/WaveHeightLocationContextProperties.cs (.../WaveHeightLocationContextProperties.cs) (revision 6f1e2e16c67292603f19489965183fa7176ff6af) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/WaveHeightLocationContextProperties.cs (.../WaveHeightLocationContextProperties.cs) (revision bba9524cfdab4e69348fddab60efe718e7c1865b) @@ -19,12 +19,14 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System.ComponentModel; using Core.Common.Base.Data; using Core.Common.Base.Geometry; using Core.Common.Gui.Attributes; using Core.Common.Utils; using Core.Common.Utils.Attributes; using Ringtoets.Common.Data.Properties; +using Ringtoets.Common.Forms.TypeConverters; using Ringtoets.HydraRing.Data; namespace Ringtoets.Integration.Forms.PropertyClasses @@ -65,11 +67,12 @@ [ResourcesCategory(typeof(Resources), "Categories_General")] [ResourcesDisplayName(typeof(Properties.Resources), "HydraulicBoundaryDatabase_Locations_WaveHeight_DisplayName")] [ResourcesDescription(typeof(Properties.Resources), "HydraulicBoundaryDatabase_Locations_WaveHeight_Description")] - public string WaveHeight + [TypeConverter(typeof(FailureMechanismSectionResultNoValueRoundedDoubleConverter))] + public RoundedDouble WaveHeight { get { - return double.IsNaN(data.WaveHeight) ? string.Empty : new RoundedDouble(2, data.WaveHeight).ToString(); + return new RoundedDouble(2, data.HydraulicBoundaryLocation.WaveHeight); } } @@ -81,7 +84,7 @@ { get { - return new EnumDisplayWrapper(data.WaveHeightCalculationConvergence).DisplayName; + return new EnumDisplayWrapper(data.HydraulicBoundaryLocation.WaveHeightCalculationConvergence).DisplayName; } } } Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/WaveHeightLocationsContextProperties.cs =================================================================== diff -u -r82c089ea04d564cd80d55a8e0f74a112efbe9c0f -rbba9524cfdab4e69348fddab60efe718e7c1865b --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/WaveHeightLocationsContextProperties.cs (.../WaveHeightLocationsContextProperties.cs) (revision 82c089ea04d564cd80d55a8e0f74a112efbe9c0f) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/WaveHeightLocationsContextProperties.cs (.../WaveHeightLocationsContextProperties.cs) (revision bba9524cfdab4e69348fddab60efe718e7c1865b) @@ -26,6 +26,7 @@ using Core.Common.Utils.Attributes; using Ringtoets.Common.Data.Properties; using Ringtoets.HydraRing.Data; +using Ringtoets.Integration.Forms.PresentationObjects; namespace Ringtoets.Integration.Forms.PropertyClasses { @@ -45,7 +46,7 @@ { return data.Locations.Select(loc => new WaveHeightLocationContextProperties { - Data = loc + Data = new WaveHeightLocationContext(data, loc) }).ToArray(); } } Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj =================================================================== diff -u -rd1c832128168938c7cb5ed4b1ac54382e0fc96fe -rbba9524cfdab4e69348fddab60efe718e7c1865b --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision d1c832128168938c7cb5ed4b1ac54382e0fc96fe) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision bba9524cfdab4e69348fddab60efe718e7c1865b) @@ -54,8 +54,10 @@ + + Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/HydraulicBoundaryLocationDesignWaterLevelRow.cs =================================================================== diff -u -r7057fbcd8621dc714af88e47454b9af566e769de -rbba9524cfdab4e69348fddab60efe718e7c1865b --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/HydraulicBoundaryLocationDesignWaterLevelRow.cs (.../HydraulicBoundaryLocationDesignWaterLevelRow.cs) (revision 7057fbcd8621dc714af88e47454b9af566e769de) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/HydraulicBoundaryLocationDesignWaterLevelRow.cs (.../HydraulicBoundaryLocationDesignWaterLevelRow.cs) (revision bba9524cfdab4e69348fddab60efe718e7c1865b) @@ -20,9 +20,11 @@ // All rights reserved. using System; +using System.ComponentModel; using Core.Common.Base.Data; using Core.Common.Base.Geometry; -using Ringtoets.HydraRing.Data; +using Ringtoets.Common.Forms.TypeConverters; +using Ringtoets.Integration.Forms.PresentationObjects; namespace Ringtoets.Integration.Forms.Views { @@ -31,25 +33,25 @@ /// internal class HydraulicBoundaryLocationDesignWaterLevelRow { - private readonly HydraulicBoundaryLocation hydraulicBoundaryLocation; + private readonly DesignWaterLevelLocationContext designWaterLevelLocationContext; /// /// Creates a new instance of . /// - /// The for this row. - /// Thrown when is null. - internal HydraulicBoundaryLocationDesignWaterLevelRow(HydraulicBoundaryLocation hydraulicBoundaryLocation) + /// The for this row. + /// Thrown when is null. + internal HydraulicBoundaryLocationDesignWaterLevelRow(DesignWaterLevelLocationContext designWaterLevelLocationContext) { - if (hydraulicBoundaryLocation == null) + if (designWaterLevelLocationContext == null) { - throw new ArgumentNullException("hydraulicBoundaryLocation"); + throw new ArgumentNullException("designWaterLevelLocationContext"); } - this.hydraulicBoundaryLocation = hydraulicBoundaryLocation; + this.designWaterLevelLocationContext = designWaterLevelLocationContext; } /// - /// Gets wether the is set to be calculated. + /// Gets whether the is set to be calculated. /// public bool ToCalculate { get; set; } @@ -60,7 +62,7 @@ { get { - return hydraulicBoundaryLocation.Name; + return designWaterLevelLocationContext.HydraulicBoundaryLocation.Name; } } @@ -71,7 +73,7 @@ { get { - return hydraulicBoundaryLocation.Id; + return designWaterLevelLocationContext.HydraulicBoundaryLocation.Id; } } @@ -82,29 +84,30 @@ { get { - return hydraulicBoundaryLocation.Location; + return designWaterLevelLocationContext.HydraulicBoundaryLocation.Location; } } /// /// Gets the . /// + [TypeConverter(typeof(FailureMechanismSectionResultNoValueRoundedDoubleConverter))] public RoundedDouble DesignWaterLevel { get { - return new RoundedDouble(2, hydraulicBoundaryLocation.DesignWaterLevel); + return new RoundedDouble(2, designWaterLevelLocationContext.HydraulicBoundaryLocation.DesignWaterLevel); } } /// /// Gets the . /// - public HydraulicBoundaryLocation HydraulicBoundaryLocation + public DesignWaterLevelLocationContext DesignWaterLevelLocationContext { get { - return hydraulicBoundaryLocation; + return designWaterLevelLocationContext; } } } Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/HydraulicBoundaryLocationDesignWaterLevelsView.cs =================================================================== diff -u -r7057fbcd8621dc714af88e47454b9af566e769de -rbba9524cfdab4e69348fddab60efe718e7c1865b --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/HydraulicBoundaryLocationDesignWaterLevelsView.cs (.../HydraulicBoundaryLocationDesignWaterLevelsView.cs) (revision 7057fbcd8621dc714af88e47454b9af566e769de) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/HydraulicBoundaryLocationDesignWaterLevelsView.cs (.../HydraulicBoundaryLocationDesignWaterLevelsView.cs) (revision bba9524cfdab4e69348fddab60efe718e7c1865b) @@ -80,10 +80,15 @@ UpdateDataGridViewDataSource(); assessmentSectionObserver.Observable = assessmentSection; - hydraulicBoundaryDatabaseObserver.Observable = assessmentSection != null ? assessmentSection.HydraulicBoundaryDatabase : null; + SetHydraulicBoundaryDatabaseObserver(); } } + private void SetHydraulicBoundaryDatabaseObserver() + { + hydraulicBoundaryDatabaseObserver.Observable = assessmentSection != null ? assessmentSection.HydraulicBoundaryDatabase : null; + } + public object Selection { get @@ -128,9 +133,13 @@ private void UpdateDataGridViewDataSource() { + SetHydraulicBoundaryDatabaseObserver(); + updatingDataSource = true; dataGridViewControl.SetDataSource(assessmentSection != null && assessmentSection.HydraulicBoundaryDatabase != null - ? assessmentSection.HydraulicBoundaryDatabase.Locations.Select(hl => new HydraulicBoundaryLocationDesignWaterLevelRow(hl)).ToArray() + ? assessmentSection.HydraulicBoundaryDatabase.Locations.Select( + hl => new HydraulicBoundaryLocationDesignWaterLevelRow( + new DesignWaterLevelLocationContext(assessmentSection.HydraulicBoundaryDatabase, hl))).ToArray() : null); RefreshDataGridView(); updatingDataSource = false; @@ -141,9 +150,9 @@ return from DataGridViewRow row in dataGridViewControl.Rows select (HydraulicBoundaryLocationDesignWaterLevelRow) row.DataBoundItem; } - private IEnumerable GetSelectedHydraulicBoundaryLocations() + private IEnumerable GetSelectedDesignWaterLevelLocationContext() { - return GetHydraulicBoundaryLocationDesignWaterLevelRows().Where(r => r.ToCalculate).Select(r => r.HydraulicBoundaryLocation); + return GetHydraulicBoundaryLocationDesignWaterLevelRows().Where(r => r.ToCalculate).Select(r => r.DesignWaterLevelLocationContext.HydraulicBoundaryLocation); } #region Event handling @@ -165,15 +174,15 @@ return; } - DesignWaterLevelLocationContext selection = CreateSelectedItemFromCurrentRow(); + HydraulicBoundaryLocationContext selection = CreateSelectedItemFromCurrentRow(); if ((ApplicationSelection.Selection == null && selection != null) || - (ApplicationSelection.Selection != null && !ApplicationSelection.Selection.Equals(selection))) + (ApplicationSelection.Selection != null && !ReferenceEquals(selection, ApplicationSelection.Selection))) { ApplicationSelection.Selection = selection; } } - private DesignWaterLevelLocationContext CreateSelectedItemFromCurrentRow() + private HydraulicBoundaryLocationContext CreateSelectedItemFromCurrentRow() { var currentRow = dataGridViewControl.CurrentRow; @@ -182,7 +191,7 @@ : null; return designWaterLevelRow != null - ? new DesignWaterLevelLocationContext(designWaterLevelRow.HydraulicBoundaryLocation) + ? designWaterLevelRow.DesignWaterLevelLocationContext : null; } @@ -204,7 +213,7 @@ { return; } - var locations = GetSelectedHydraulicBoundaryLocations(); + var locations = GetSelectedDesignWaterLevelLocationContext(); CalculationCommandHandler.CalculateDesignWaterLevels(locations); } Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs =================================================================== diff -u -r9c6ce5a4e3cb6fc92ba799df94f13c14a7a2635a -rbba9524cfdab4e69348fddab60efe718e7c1865b --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 9c6ce5a4e3cb6fc92ba799df94f13c14a7a2635a) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision bba9524cfdab4e69348fddab60efe718e7c1865b) @@ -261,10 +261,7 @@ { GetObjectPropertiesData = context => context.WrappedData.HydraulicBoundaryDatabase }; - yield return new PropertyInfo - { - GetObjectPropertiesData = context => context.WrappedData - }; + yield return new PropertyInfo(); yield return new PropertyInfo { GetObjectPropertiesData = context => context.WrappedData.HydraulicBoundaryDatabase @@ -1177,7 +1174,7 @@ BaseResources.Confirm, MessageBoxButtons.OKCancel); - return confirmation == DialogResult.OK; + return (confirmation == DialogResult.OK); } private static void ClearCalculations(IAssessmentSection nodeData) Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/DesignWaterLevelLocationContextTest.cs =================================================================== diff -u -rf108fdafb5fc608358b5088edd3192b58320b8da -rbba9524cfdab4e69348fddab60efe718e7c1865b --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/DesignWaterLevelLocationContextTest.cs (.../DesignWaterLevelLocationContextTest.cs) (revision f108fdafb5fc608358b5088edd3192b58320b8da) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/DesignWaterLevelLocationContextTest.cs (.../DesignWaterLevelLocationContextTest.cs) (revision bba9524cfdab4e69348fddab60efe718e7c1865b) @@ -19,7 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. -using Core.Common.Controls.PresentationObjects; +using System; using NUnit.Framework; using Ringtoets.HydraRing.Data; using Ringtoets.Integration.Forms.PresentationObjects; @@ -30,17 +30,48 @@ public class DesignWaterLevelLocationContextTest { [Test] - public void DefaultConstructor_ExpectedValues() + public void Constructor_NullHydraulicBoundariesLocation_ThrowsArgumentNullException() { // Setup + var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + + // Call + TestDelegate test = () => new DesignWaterLevelLocationContext(hydraulicBoundaryDatabase, null); + + // Assert + var paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("hydraulicBoundaryLocation", paramName); + } + + [Test] + public void Constructor_NullHydraulicBoundariesDatabase_ThrowsArgumentNullException() + { + // Setup var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "name", 2.0, 3.0); // Call - var presentationObject = new DesignWaterLevelLocationContext(hydraulicBoundaryLocation); + TestDelegate test = () => new DesignWaterLevelLocationContext(null, hydraulicBoundaryLocation); // Assert - Assert.IsInstanceOf>(presentationObject); - Assert.AreSame(hydraulicBoundaryLocation, presentationObject.WrappedData); + var paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("wrappedData", paramName); } + + [Test] + public void Constructor_ValidParameters_ExpectedValues() + { + // Setup + var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "name", 2.0, 3.0); + var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + hydraulicBoundaryDatabase.Locations.Add(hydraulicBoundaryLocation); + + // Call + var presentationObject = new DesignWaterLevelLocationContext(hydraulicBoundaryDatabase, hydraulicBoundaryLocation); + + // Assert + Assert.IsInstanceOf(presentationObject); + Assert.AreSame(hydraulicBoundaryDatabase, presentationObject.WrappedData); + Assert.AreSame(hydraulicBoundaryLocation, presentationObject.HydraulicBoundaryLocation); + } } } \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/HydraulicBoundaryLocationContextTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/HydraulicBoundaryLocationContextTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/HydraulicBoundaryLocationContextTest.cs (revision bba9524cfdab4e69348fddab60efe718e7c1865b) @@ -0,0 +1,84 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Core.Common.Controls.PresentationObjects; +using NUnit.Framework; +using Ringtoets.HydraRing.Data; +using Ringtoets.Integration.Forms.PresentationObjects; + +namespace Ringtoets.Integration.Forms.Test.PresentationObjects +{ + [TestFixture] + public class HydraulicBoundaryLocationContextTest + { + [Test] + public void Constructor_NullHydraulicBoundariesLocation_ThrowsArgumentNullException() + { + // Setup + var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + + // Call + TestDelegate test = () => new TestHydraulicBoundaryLocationContext(hydraulicBoundaryDatabase, null); + + // Assert + var paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("hydraulicBoundaryLocation", paramName); + } + + [Test] + public void Constructor_NullHydraulicBoundariesDatabase_ThrowsArgumentNullException() + { + // Setup + var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "name", 2.0, 3.0); + + // Call + TestDelegate test = () => new TestHydraulicBoundaryLocationContext(null, hydraulicBoundaryLocation); + + // Assert + var paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("wrappedData", paramName); + } + + [Test] + public void Constructor_ValidParameters_ExpectedValues() + { + // Setup + var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "name", 2.0, 3.0); + var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + hydraulicBoundaryDatabase.Locations.Add(hydraulicBoundaryLocation); + + // Call + var presentationObject = new TestHydraulicBoundaryLocationContext(hydraulicBoundaryDatabase, hydraulicBoundaryLocation); + + // Assert + Assert.IsInstanceOf>(presentationObject); + Assert.AreSame(hydraulicBoundaryDatabase, presentationObject.WrappedData); + Assert.AreSame(hydraulicBoundaryLocation, presentationObject.HydraulicBoundaryLocation); + } + + private class TestHydraulicBoundaryLocationContext : HydraulicBoundaryLocationContext + { + public TestHydraulicBoundaryLocationContext(HydraulicBoundaryDatabase wrappedData, HydraulicBoundaryLocation hydraulicBoundaryLocation) + : base(wrappedData, hydraulicBoundaryLocation) {} + } + } +} \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/WaveHeightLocationContextTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/WaveHeightLocationContextTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/WaveHeightLocationContextTest.cs (revision bba9524cfdab4e69348fddab60efe718e7c1865b) @@ -0,0 +1,77 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using NUnit.Framework; +using Ringtoets.HydraRing.Data; +using Ringtoets.Integration.Forms.PresentationObjects; + +namespace Ringtoets.Integration.Forms.Test.PresentationObjects +{ + [TestFixture] + public class WaveHeightLocationContextTest + { + [Test] + public void Constructor_NullHydraulicBoundariesLocation_ThrowsArgumentNullException() + { + // Setup + var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + + // Call + TestDelegate test = () => new WaveHeightLocationContext(hydraulicBoundaryDatabase, null); + + // Assert + var paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("hydraulicBoundaryLocation", paramName); + } + + [Test] + public void Constructor_NullHydraulicBoundariesDatabase_ThrowsArgumentNullException() + { + // Setup + var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "name", 2.0, 3.0); + + // Call + TestDelegate test = () => new WaveHeightLocationContext(null, hydraulicBoundaryLocation); + + // Assert + var paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("wrappedData", paramName); + } + + [Test] + public void Constructor_ValidParameters_ExpectedValues() + { + // Setup + var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "name", 2.0, 3.0); + var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + hydraulicBoundaryDatabase.Locations.Add(hydraulicBoundaryLocation); + + // Call + var presentationObject = new WaveHeightLocationContext(hydraulicBoundaryDatabase, hydraulicBoundaryLocation); + + // Assert + Assert.IsInstanceOf(presentationObject); + Assert.AreSame(hydraulicBoundaryDatabase, presentationObject.WrappedData); + Assert.AreSame(hydraulicBoundaryLocation, presentationObject.HydraulicBoundaryLocation); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/DesignWaterLevelLocationContextPropertiesTest.cs =================================================================== diff -u -r6f1e2e16c67292603f19489965183fa7176ff6af -rbba9524cfdab4e69348fddab60efe718e7c1865b --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/DesignWaterLevelLocationContextPropertiesTest.cs (.../DesignWaterLevelLocationContextPropertiesTest.cs) (revision 6f1e2e16c67292603f19489965183fa7176ff6af) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/DesignWaterLevelLocationContextPropertiesTest.cs (.../DesignWaterLevelLocationContextPropertiesTest.cs) (revision bba9524cfdab4e69348fddab60efe718e7c1865b) @@ -27,6 +27,7 @@ using Core.Common.Gui.PropertyBag; using NUnit.Framework; using Ringtoets.HydraRing.Data; +using Ringtoets.Integration.Forms.PresentationObjects; using Ringtoets.Integration.Forms.PropertyClasses; namespace Ringtoets.Integration.Forms.Test.PropertyClasses @@ -43,20 +44,22 @@ const double x = 567.0; const double y = 890.0; HydraulicBoundaryLocation hydraulicBoundaryLocation = new HydraulicBoundaryLocation(id, name, x, y); + var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + hydraulicBoundaryDatabase.Locations.Add(hydraulicBoundaryLocation); // Call DesignWaterLevelLocationContextProperties properties = new DesignWaterLevelLocationContextProperties { - Data = hydraulicBoundaryLocation + Data = new DesignWaterLevelLocationContext(hydraulicBoundaryDatabase, hydraulicBoundaryLocation) }; // Assert Assert.AreEqual(id, properties.Id); Assert.AreEqual(name, properties.Name); Point2D coordinates = new Point2D(x, y); Assert.AreEqual(coordinates, properties.Location); - Assert.AreEqual(string.Empty, properties.DesignWaterLevel); + Assert.IsNaN(properties.DesignWaterLevel); Assert.AreEqual("-", properties.Convergence); } @@ -74,20 +77,22 @@ { DesignWaterLevel = designWaterLevel }; + var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + hydraulicBoundaryDatabase.Locations.Add(hydraulicBoundaryLocation); // Call DesignWaterLevelLocationContextProperties properties = new DesignWaterLevelLocationContextProperties { - Data = hydraulicBoundaryLocation + Data = new DesignWaterLevelLocationContext(hydraulicBoundaryDatabase, hydraulicBoundaryLocation) }; // Assert Assert.AreEqual(id, properties.Id); Assert.AreEqual(name, properties.Name); Point2D coordinates = new Point2D(x, y); Assert.AreEqual(coordinates, properties.Location); - string expectedDesignWaterLevel = new RoundedDouble(2, designWaterLevel).ToString(); + var expectedDesignWaterLevel = new RoundedDouble(2, designWaterLevel); Assert.AreEqual(expectedDesignWaterLevel, properties.DesignWaterLevel); Assert.AreEqual("-", properties.Convergence); } @@ -97,10 +102,12 @@ { // Setup HydraulicBoundaryLocation hydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, "", 0.0, 0.0); + var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + hydraulicBoundaryDatabase.Locations.Add(hydraulicBoundaryLocation); DesignWaterLevelLocationContextProperties properties = new DesignWaterLevelLocationContextProperties { - Data = hydraulicBoundaryLocation + Data = new DesignWaterLevelLocationContext(hydraulicBoundaryDatabase, hydraulicBoundaryLocation) }; // Call Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/DesignWaterLevelLocationsContextPropertiesTest.cs =================================================================== diff -u -r82c089ea04d564cd80d55a8e0f74a112efbe9c0f -rbba9524cfdab4e69348fddab60efe718e7c1865b --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/DesignWaterLevelLocationsContextPropertiesTest.cs (.../DesignWaterLevelLocationsContextPropertiesTest.cs) (revision 82c089ea04d564cd80d55a8e0f74a112efbe9c0f) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/DesignWaterLevelLocationsContextPropertiesTest.cs (.../DesignWaterLevelLocationsContextPropertiesTest.cs) (revision bba9524cfdab4e69348fddab60efe718e7c1865b) @@ -71,7 +71,7 @@ Assert.AreEqual(hydraulicBoundaryLocation.Name, designWaterLevelLocationProperties.Name); Assert.AreEqual(hydraulicBoundaryLocation.Id, designWaterLevelLocationProperties.Id); Assert.AreEqual(hydraulicBoundaryLocation.Location, designWaterLevelLocationProperties.Location); - var expectedDesignWaterLevelValue = new RoundedDouble(2, designWaterLevel).ToString(); + var expectedDesignWaterLevelValue = new RoundedDouble(2, designWaterLevel); Assert.AreEqual(expectedDesignWaterLevelValue, designWaterLevelLocationProperties.DesignWaterLevel); } Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryLocationPropertiesTest.cs =================================================================== diff -u -r548f423e1200776f8b284393e16063d34363a2f6 -rbba9524cfdab4e69348fddab60efe718e7c1865b --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryLocationPropertiesTest.cs (.../HydraulicBoundaryLocationPropertiesTest.cs) (revision 548f423e1200776f8b284393e16063d34363a2f6) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryLocationPropertiesTest.cs (.../HydraulicBoundaryLocationPropertiesTest.cs) (revision bba9524cfdab4e69348fddab60efe718e7c1865b) @@ -23,8 +23,8 @@ using Core.Common.Base.Geometry; using Core.Common.Gui.PropertyBag; using NUnit.Framework; -using Rhino.Mocks; using Ringtoets.HydraRing.Data; +using Ringtoets.Integration.Forms.PresentationObjects; using Ringtoets.Integration.Forms.PropertyClasses; namespace Ringtoets.Integration.Forms.Test.PropertyClasses @@ -36,26 +36,19 @@ public void Constructor_DefaultArgumentValues_DoesNotThrowException() { // Setup - var mockRepository = new MockRepository(); - object[] hydraulicBoundaryLocationArguments = - { - 0, - "", - 0.0, - 0.0 - }; - var hydraulicBoundaryLocationMock = mockRepository.StrictMock(hydraulicBoundaryLocationArguments); - mockRepository.ReplayAll(); + var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, "", 0.0, 0.0); + var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + hydraulicBoundaryDatabase.Locations.Add(hydraulicBoundaryLocation); + var context = new TestHydraulicBoundaryLocationContext(hydraulicBoundaryDatabase, hydraulicBoundaryLocation); // Call TestDelegate test = () => new TestHydraulicBoundaryLocationProperties { - Data = hydraulicBoundaryLocationMock + Data = context }; // Assert Assert.DoesNotThrow(test); - mockRepository.VerifyAll(); } [Test] @@ -68,21 +61,21 @@ Point2D coordinates = new Point2D(x, y); const string name = ""; - var mockRepository = new MockRepository(); - var hydraulicBoundaryLocationMock = mockRepository.StrictMock(id, name, x, y); - mockRepository.ReplayAll(); + var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(id, name, x, y); + var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + hydraulicBoundaryDatabase.Locations.Add(hydraulicBoundaryLocation); + var context = new TestHydraulicBoundaryLocationContext(hydraulicBoundaryDatabase, hydraulicBoundaryLocation); // Call HydraulicBoundaryLocationProperties hydraulicBoundaryLocationProperties = new TestHydraulicBoundaryLocationProperties { - Data = hydraulicBoundaryLocationMock + Data = context }; // Assert Assert.AreEqual(id, hydraulicBoundaryLocationProperties.Id); Assert.AreEqual(name, hydraulicBoundaryLocationProperties.Name); Assert.AreEqual(coordinates, hydraulicBoundaryLocationProperties.Location); - mockRepository.VerifyAll(); } [Test] @@ -94,23 +87,17 @@ const long id = 1234L; const double x = 567.0; const double y = 890.0; - var mockRepository = new MockRepository(); - object[] hydraulicBoundaryLocationArguments = - { - id, - name, - x, - y - }; - var hydraulicBoundaryLocationMock = mockRepository.StrictMock(hydraulicBoundaryLocationArguments); - mockRepository.ReplayAll(); + var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(id, name, x, y); + var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + hydraulicBoundaryDatabase.Locations.Add(hydraulicBoundaryLocation); + var context = new TestHydraulicBoundaryLocationContext(hydraulicBoundaryDatabase, hydraulicBoundaryLocation); var expectedString = string.Format("{0} {1}", name, new Point2D(x, y)); // Call HydraulicBoundaryLocationProperties hydraulicBoundaryLocationProperties = new TestHydraulicBoundaryLocationProperties { - Data = hydraulicBoundaryLocationMock + Data = context }; // Assert @@ -121,13 +108,14 @@ public void PropertyAttributes_ReturnExpectedValues() { // Setup - var mockRepository = new MockRepository(); - var hydraulicBoundaryLocationMock = mockRepository.StrictMock(0, "", 0.0, 0.0); - mockRepository.ReplayAll(); + var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, "", 0.0, 0.0); + var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + hydraulicBoundaryDatabase.Locations.Add(hydraulicBoundaryLocation); + var context = new TestHydraulicBoundaryLocationContext(hydraulicBoundaryDatabase, hydraulicBoundaryLocation); var hydraulicBoundaryLocationProperties = new TestHydraulicBoundaryLocationProperties { - Data = hydraulicBoundaryLocationMock + Data = context }; var dynamicPropertyBag = new DynamicPropertyBag(hydraulicBoundaryLocationProperties); @@ -170,10 +158,14 @@ Assert.AreEqual(expectedCategory, locationProperty.Category); Assert.AreEqual(expectedLocationDisplayName, locationProperty.DisplayName); Assert.AreEqual(expectedLocationDescription, locationProperty.Description); - - mockRepository.VerifyAll(); } private class TestHydraulicBoundaryLocationProperties : HydraulicBoundaryLocationProperties {} + + private class TestHydraulicBoundaryLocationContext : HydraulicBoundaryLocationContext + { + public TestHydraulicBoundaryLocationContext(HydraulicBoundaryDatabase wrappedData, HydraulicBoundaryLocation hydraulicBoundaryLocation) + : base(wrappedData, hydraulicBoundaryLocation) {} + } } } \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/WaveHeightLocationContextPropertiesTest.cs =================================================================== diff -u -r6f1e2e16c67292603f19489965183fa7176ff6af -rbba9524cfdab4e69348fddab60efe718e7c1865b --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/WaveHeightLocationContextPropertiesTest.cs (.../WaveHeightLocationContextPropertiesTest.cs) (revision 6f1e2e16c67292603f19489965183fa7176ff6af) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/WaveHeightLocationContextPropertiesTest.cs (.../WaveHeightLocationContextPropertiesTest.cs) (revision bba9524cfdab4e69348fddab60efe718e7c1865b) @@ -27,6 +27,7 @@ using Core.Common.Gui.PropertyBag; using NUnit.Framework; using Ringtoets.HydraRing.Data; +using Ringtoets.Integration.Forms.PresentationObjects; using Ringtoets.Integration.Forms.PropertyClasses; namespace Ringtoets.Integration.Forms.Test.PropertyClasses @@ -44,19 +45,21 @@ const string name = ""; var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(id, name, x, y); + var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + hydraulicBoundaryDatabase.Locations.Add(hydraulicBoundaryLocation); // Call var properties = new WaveHeightLocationContextProperties { - Data = hydraulicBoundaryLocation + Data = new WaveHeightLocationContext(hydraulicBoundaryDatabase, hydraulicBoundaryLocation) }; // Assert Assert.AreEqual(id, properties.Id); Assert.AreEqual(name, properties.Name); Point2D coordinates = new Point2D(x, y); Assert.AreEqual(coordinates, properties.Location); - Assert.AreEqual(string.Empty, properties.WaveHeight); + Assert.IsNaN(properties.WaveHeight); Assert.AreEqual("-", properties.Convergence); } @@ -75,18 +78,21 @@ WaveHeight = waveHeight }; + var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + hydraulicBoundaryDatabase.Locations.Add(hydraulicBoundaryLocation); + // Call var properties = new WaveHeightLocationContextProperties { - Data = hydraulicBoundaryLocation + Data = new WaveHeightLocationContext(hydraulicBoundaryDatabase, hydraulicBoundaryLocation) }; // Assert Assert.AreEqual(id, properties.Id); Assert.AreEqual(name, properties.Name); Point2D coordinates = new Point2D(x, y); Assert.AreEqual(coordinates, properties.Location); - string expectedWaveHeight = new RoundedDouble(2, waveHeight).ToString(); + var expectedWaveHeight = new RoundedDouble(2, waveHeight); Assert.AreEqual(expectedWaveHeight, properties.WaveHeight); Assert.AreEqual("-", properties.Convergence); } @@ -96,9 +102,11 @@ { // Setup var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, "", 0.0, 0.0); + var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + hydraulicBoundaryDatabase.Locations.Add(hydraulicBoundaryLocation); var properties = new WaveHeightLocationContextProperties { - Data = hydraulicBoundaryLocation + Data = new WaveHeightLocationContext(hydraulicBoundaryDatabase, hydraulicBoundaryLocation) }; // Call Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/WaveHeightLocationsContextPropertiesTest.cs =================================================================== diff -u -r82c089ea04d564cd80d55a8e0f74a112efbe9c0f -rbba9524cfdab4e69348fddab60efe718e7c1865b --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/WaveHeightLocationsContextPropertiesTest.cs (.../WaveHeightLocationsContextPropertiesTest.cs) (revision 82c089ea04d564cd80d55a8e0f74a112efbe9c0f) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/WaveHeightLocationsContextPropertiesTest.cs (.../WaveHeightLocationsContextPropertiesTest.cs) (revision bba9524cfdab4e69348fddab60efe718e7c1865b) @@ -85,7 +85,7 @@ Assert.AreEqual(hydraulicBoundaryLocation.Name, waveHeightLocationProperties.Name); Assert.AreEqual(hydraulicBoundaryLocation.Id, waveHeightLocationProperties.Id); Assert.AreEqual(hydraulicBoundaryLocation.Location, waveHeightLocationProperties.Location); - var expectedWaveHeightValue = new RoundedDouble(2, waveHeight).ToString(); + var expectedWaveHeightValue = new RoundedDouble(2, waveHeight); Assert.AreEqual(expectedWaveHeightValue, waveHeightLocationProperties.WaveHeight); mockRepository.VerifyAll(); } Fisheye: Tag bba9524cfdab4e69348fddab60efe718e7c1865b refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyInfos/DesignWaterLevelLocationContextPropertyInfoTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj =================================================================== diff -u -r82c089ea04d564cd80d55a8e0f74a112efbe9c0f -rbba9524cfdab4e69348fddab60efe718e7c1865b --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 82c089ea04d564cd80d55a8e0f74a112efbe9c0f) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision bba9524cfdab4e69348fddab60efe718e7c1865b) @@ -73,6 +73,8 @@ + + @@ -84,7 +86,6 @@ - Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/HydraulicBoundaryLocationDesignWaterLevelRowTest.cs =================================================================== diff -u -rbbe059ff2ae57383fc40036c7ebb6054febdd7ba -rbba9524cfdab4e69348fddab60efe718e7c1865b --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/HydraulicBoundaryLocationDesignWaterLevelRowTest.cs (.../HydraulicBoundaryLocationDesignWaterLevelRowTest.cs) (revision bbe059ff2ae57383fc40036c7ebb6054febdd7ba) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/HydraulicBoundaryLocationDesignWaterLevelRowTest.cs (.../HydraulicBoundaryLocationDesignWaterLevelRowTest.cs) (revision bba9524cfdab4e69348fddab60efe718e7c1865b) @@ -24,6 +24,7 @@ using Core.Common.Base.Geometry; using NUnit.Framework; using Ringtoets.HydraRing.Data; +using Ringtoets.Integration.Forms.PresentationObjects; using Ringtoets.Integration.Forms.Views; namespace Ringtoets.Integration.Forms.Test.Views @@ -39,7 +40,7 @@ // Assert var paramName = Assert.Throws(test).ParamName; - Assert.AreEqual("hydraulicBoundaryLocation", paramName); + Assert.AreEqual("designWaterLevelLocationContext", paramName); } [Test] @@ -55,9 +56,13 @@ { DesignWaterLevel = designWaterLevel }; + var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + hydraulicBoundaryDatabase.Locations.Add(hydraulicBoundaryLocation); + var context = new DesignWaterLevelLocationContext(hydraulicBoundaryDatabase, hydraulicBoundaryLocation); + // Call - var row = new HydraulicBoundaryLocationDesignWaterLevelRow(hydraulicBoundaryLocation); + var row = new HydraulicBoundaryLocationDesignWaterLevelRow(context); // Assert Assert.AreEqual(id, row.Id); @@ -66,16 +71,21 @@ Assert.AreEqual(expectedDesignWaterLevel, row.DesignWaterLevel); var expectedPoint2D = new Point2D(coordinateX, coordinateY); Assert.AreEqual(expectedPoint2D, row.Location); - Assert.AreEqual(hydraulicBoundaryLocation, row.HydraulicBoundaryLocation); + Assert.AreEqual(context, row.DesignWaterLevelLocationContext); Assert.IsFalse(row.ToCalculate); } [Test] public void Constructor_Property_SetPropertyAsExpected() { // Setup - var row = new HydraulicBoundaryLocationDesignWaterLevelRow(new HydraulicBoundaryLocation(1, "LocationName", 1.0, 2.0)); + var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "LocationName", 1.0, 2.0); + var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + hydraulicBoundaryDatabase.Locations.Add(hydraulicBoundaryLocation); + var context = new DesignWaterLevelLocationContext(hydraulicBoundaryDatabase, hydraulicBoundaryLocation); + var row = new HydraulicBoundaryLocationDesignWaterLevelRow(context); + // Call row.ToCalculate = true; Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/HydraulicBoundaryLocationDesignWaterLevelsViewTest.cs =================================================================== diff -u -r7057fbcd8621dc714af88e47454b9af566e769de -rbba9524cfdab4e69348fddab60efe718e7c1865b --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/HydraulicBoundaryLocationDesignWaterLevelsViewTest.cs (.../HydraulicBoundaryLocationDesignWaterLevelsViewTest.cs) (revision 7057fbcd8621dc714af88e47454b9af566e769de) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/HydraulicBoundaryLocationDesignWaterLevelsViewTest.cs (.../HydraulicBoundaryLocationDesignWaterLevelsViewTest.cs) (revision bba9524cfdab4e69348fddab60efe718e7c1865b) @@ -151,7 +151,7 @@ Assert.AreEqual("1", cells[locationNameColumnIndex].FormattedValue); Assert.AreEqual("1", cells[locationIdColumnIndex].FormattedValue); Assert.AreEqual(new Point2D(1, 1).ToString(), cells[locationColumnIndex].FormattedValue); - Assert.AreEqual("NaN", cells[locationDesignWaterlevelColumnIndex].FormattedValue); + Assert.AreEqual("-", cells[locationDesignWaterlevelColumnIndex].FormattedValue); cells = rows[1].Cells; Assert.AreEqual(5, cells.Count); @@ -167,7 +167,7 @@ Assert.AreEqual("3", cells[locationNameColumnIndex].FormattedValue); Assert.AreEqual("3", cells[locationIdColumnIndex].FormattedValue); Assert.AreEqual(new Point2D(3, 3).ToString(), cells[locationColumnIndex].FormattedValue); - Assert.AreEqual("NaN", cells[locationDesignWaterlevelColumnIndex].FormattedValue); + Assert.AreEqual("-", cells[locationDesignWaterlevelColumnIndex].FormattedValue); } [Test] @@ -213,33 +213,35 @@ var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; var rows = dataGridView.Rows; Assert.AreEqual(3, rows.Count); - Assert.AreEqual("NaN", rows[0].Cells[locationDesignWaterlevelColumnIndex].FormattedValue); + Assert.AreEqual("-", rows[0].Cells[locationDesignWaterlevelColumnIndex].FormattedValue); Assert.AreEqual(1.23.ToString(CultureInfo.CurrentCulture), rows[1].Cells[locationDesignWaterlevelColumnIndex].FormattedValue); - Assert.AreEqual("NaN", rows[2].Cells[locationDesignWaterlevelColumnIndex].FormattedValue); + Assert.AreEqual("-", rows[2].Cells[locationDesignWaterlevelColumnIndex].FormattedValue); // Call assessmentSection.HydraulicBoundaryDatabase.Locations.ForEach(loc => loc.DesignWaterLevel = double.NaN); assessmentSection.NotifyObservers(); // Assert Assert.AreEqual(3, rows.Count); - Assert.AreEqual("NaN", rows[0].Cells[locationDesignWaterlevelColumnIndex].FormattedValue); - Assert.AreEqual("NaN", rows[1].Cells[locationDesignWaterlevelColumnIndex].FormattedValue); - Assert.AreEqual("NaN", rows[2].Cells[locationDesignWaterlevelColumnIndex].FormattedValue); + Assert.AreEqual("-", rows[0].Cells[locationDesignWaterlevelColumnIndex].FormattedValue); + Assert.AreEqual("-", rows[1].Cells[locationDesignWaterlevelColumnIndex].FormattedValue); + Assert.AreEqual("-", rows[2].Cells[locationDesignWaterlevelColumnIndex].FormattedValue); } [Test] public void HydraulicBoundaryLocationDesignWaterLevelsView_SelectingCellInRow_ApplicationSelectionCorrectlySynced() { // Setup var view = ShowFullyConfiguredHydraulicBoundaryLocationDesignWaterLevelsView(); - IAssessmentSection assessmentSection = (IAssessmentSection)view.Data; + IAssessmentSection assessmentSection = (IAssessmentSection) view.Data; var secondHydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations.Skip(1).First(); var mocks = new MockRepository(); var applicationSelectionMock = mocks.StrictMock(); applicationSelectionMock.Stub(asm => asm.Selection).Return(null); - applicationSelectionMock.Expect(asm => asm.Selection = new DesignWaterLevelLocationContext(secondHydraulicBoundaryLocation)); + applicationSelectionMock.Expect(asm => asm.Selection = new DesignWaterLevelLocationContext( + assessmentSection.HydraulicBoundaryDatabase, + secondHydraulicBoundaryLocation)); mocks.ReplayAll(); view.ApplicationSelection = applicationSelectionMock; @@ -259,18 +261,17 @@ { // Setup var view = ShowFullyConfiguredHydraulicBoundaryLocationDesignWaterLevelsView(); - IAssessmentSection assessmentSection = (IAssessmentSection)view.Data; - var secondHydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations.Skip(1).First(); + var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; + dataGridView.CurrentCell = dataGridView.Rows[1].Cells[locationNameColumnIndex]; + var mocks = new MockRepository(); var applicationSelectionMock = mocks.StrictMock(); - applicationSelectionMock.Stub(asm => asm.Selection).Return(new DesignWaterLevelLocationContext(secondHydraulicBoundaryLocation)); + applicationSelectionMock.Stub(asm => asm.Selection).Return(view.Selection); mocks.ReplayAll(); view.ApplicationSelection = applicationSelectionMock; - var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; - // Call dataGridView.CurrentCell = dataGridView.Rows[1].Cells[locationNameColumnIndex]; EventHelper.RaiseEvent(dataGridView, "CellClick", new DataGridViewCellEventArgs(locationNameColumnIndex, 0)); @@ -295,9 +296,8 @@ // Assert Assert.IsInstanceOf(selection); - - var dataRow = (HydraulicBoundaryLocationDesignWaterLevelRow) dataGridView.Rows[selectedRow].DataBoundItem; - Assert.AreSame(dataRow.HydraulicBoundaryLocation, ((DesignWaterLevelLocationContext) selection).WrappedData); + HydraulicBoundaryDatabase hydraulicBoundaryDatabase = ((IAssessmentSection) view.Data).HydraulicBoundaryDatabase; + Assert.AreSame(hydraulicBoundaryDatabase, ((DesignWaterLevelLocationContext) selection).WrappedData); } [Test] Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs =================================================================== diff -u -r82c089ea04d564cd80d55a8e0f74a112efbe9c0f -rbba9524cfdab4e69348fddab60efe718e7c1865b --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs (.../RingtoetsPluginTest.cs) (revision 82c089ea04d564cd80d55a8e0f74a112efbe9c0f) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs (.../RingtoetsPluginTest.cs) (revision bba9524cfdab4e69348fddab60efe718e7c1865b) @@ -249,7 +249,7 @@ var designWaterLevelLocationContextProperties = propertyInfos.Single(pi => pi.DataType == typeof(DesignWaterLevelLocationContext)); Assert.AreEqual(typeof(DesignWaterLevelLocationContextProperties), designWaterLevelLocationContextProperties.PropertyObjectType); Assert.IsNull(designWaterLevelLocationContextProperties.AdditionalDataCheck); - Assert.IsNotNull(designWaterLevelLocationContextProperties.GetObjectPropertiesData); + Assert.IsNull(designWaterLevelLocationContextProperties.GetObjectPropertiesData); Assert.IsNull(designWaterLevelLocationContextProperties.AfterCreate); var waveHeightLocationsContextProperties = propertyInfos.Single(pi => pi.DataType == typeof(WaveHeightLocationsContext));