Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/MacroStabilityInwardsGrid.cs =================================================================== diff -u -r9ca04c726ce0c9ce7c4bcc65d3fd2ba62ac918b1 -r99cac92e4eeb290856138296baab92ca7c09e0f7 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/MacroStabilityInwardsGrid.cs (.../MacroStabilityInwardsGrid.cs) (revision 9ca04c726ce0c9ce7c4bcc65d3fd2ba62ac918b1) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/MacroStabilityInwardsGrid.cs (.../MacroStabilityInwardsGrid.cs) (revision 99cac92e4eeb290856138296baab92ca7c09e0f7) @@ -116,6 +116,6 @@ /// /// Gets or sets the number of vertical points. /// - public int NumberOfVerticalpoints { get; set; } + public int NumberOfVerticalPoints { get; set; } } } \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -rfeb863dccfb07cb86ef8c26e3610129ac299553b -r99cac92e4eeb290856138296baab92ca7c09e0f7 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision feb863dccfb07cb86ef8c26e3610129ac299553b) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 99cac92e4eeb290856138296baab92ca7c09e0f7) @@ -100,6 +100,15 @@ } /// + /// Looks up a localized string similar to Grid. + /// + public static string Categories_Grid { + get { + return ResourceManager.GetString("Categories_Grid", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Semi-probabilistische parameters. /// public static string Categories_SemiProbabilisticParameters { @@ -298,6 +307,24 @@ } /// + /// Looks up a localized string similar to De linker grid eigenschappen.. + /// + public static string LeftGrid_Description { + get { + return ResourceManager.GetString("LeftGrid_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Linker grid. + /// + public static string LeftGrid_DisplayName { + get { + return ResourceManager.GetString("LeftGrid_DisplayName", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Naam. /// public static string MacroStabilityInwardsCalculation_Name_DisplayName { @@ -684,6 +711,42 @@ } /// + /// Looks up a localized string similar to Aantal punten waarmee het grid wordt samengesteld in horizontale richting.. + /// + public static string NumberOfHorizontalPoints_Description { + get { + return ResourceManager.GetString("NumberOfHorizontalPoints_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Aantal horizontale punten. + /// + public static string NumberOfHorizontalPoints_DisplayName { + get { + return ResourceManager.GetString("NumberOfHorizontalPoints_DisplayName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Aantal punten waarmee het grid wordt samengesteld in verticale richting.. + /// + public static string NumberOfVerticalPoints_Description { + get { + return ResourceManager.GetString("NumberOfVerticalPoints_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Aantal verticale punten. + /// + public static string NumberOfVerticalPoints_DisplayName { + get { + return ResourceManager.GetString("NumberOfVerticalPoints_DisplayName", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Offsets PL 1 eigenschappen.. /// public static string Offsets_Description { @@ -828,6 +891,24 @@ } /// + /// Looks up a localized string similar to De rechter grid eigenschappen.. + /// + public static string RightGrid_Description { + get { + return ResourceManager.GetString("RightGrid_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Rechter grid. + /// + public static string RightGrid_DisplayName { + get { + return ResourceManager.GetString("RightGrid_DisplayName", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Minimale diepte van het berekende glijvlak ten opzichte van het maaiveld.. /// public static string SlipPlaneMinimumDepth_Description { @@ -1191,6 +1272,60 @@ } /// + /// Looks up a localized string similar to Horizontale coordinaat van de linker kant van het rekengrid.. + /// + public static string XLeft_Description { + get { + return ResourceManager.GetString("XLeft_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to X links [m]. + /// + public static string XLeft_DisplayName { + get { + return ResourceManager.GetString("XLeft_DisplayName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Horizontale coordinaat van de rechter kant van het rekengrid.. + /// + public static string XRight_Description { + get { + return ResourceManager.GetString("XRight_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to X rechts [m]. + /// + public static string XRight_DisplayName { + get { + return ResourceManager.GetString("XRight_DisplayName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Verticale coordinaat van de onderkant van het rekengrid.. + /// + public static string ZBottom_Description { + get { + return ResourceManager.GetString("ZBottom_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Z onder [m+NAP]. + /// + public static string ZBottom_DisplayName { + get { + return ResourceManager.GetString("ZBottom_DisplayName", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Z-coordinaat (hoogte) van het middelpunt van de drainage.. /// public static string ZCoordinateDrainageConstruction_Description { @@ -1207,5 +1342,23 @@ return ResourceManager.GetString("ZCoordinateDrainageConstruction_DisplayName", resourceCulture); } } + + /// + /// Looks up a localized string similar to Verticale coordinaat van de bovenkant van het rekengrid.. + /// + public static string ZTop_Description { + get { + return ResourceManager.GetString("ZTop_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Z boven [m+NAP]. + /// + public static string ZTop_DisplayName { + get { + return ResourceManager.GetString("ZTop_DisplayName", resourceCulture); + } + } } } Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Properties/Resources.resx =================================================================== diff -u -rfeb863dccfb07cb86ef8c26e3610129ac299553b -r99cac92e4eeb290856138296baab92ca7c09e0f7 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Properties/Resources.resx (.../Resources.resx) (revision feb863dccfb07cb86ef8c26e3610129ac299553b) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Properties/Resources.resx (.../Resources.resx) (revision 99cac92e4eeb290856138296baab92ca7c09e0f7) @@ -454,6 +454,9 @@ Minimale glijvlaklengte [m] + + Grid + Rekengrid automatisch bepalen of handmatig invoeren? @@ -466,12 +469,36 @@ Rekengrids + + De linker grid eigenschappen. + + + Linker grid + Sta automatische aanpassing van het grid toe? Verplaats grid + + Aantal punten waarmee het grid wordt samengesteld in horizontale richting. + + + Aantal horizontale punten + + + Aantal punten waarmee het grid wordt samengesteld in verticale richting. + + + Aantal verticale punten + + + De rechter grid eigenschappen. + + + Rechter grid + Bepaling raaklijnen op basis van grondlaagscheidingen of handmatig? @@ -490,4 +517,28 @@ Tangentlijn Z-boven [m+NAP] + + Horizontale coordinaat van de linker kant van het rekengrid. + + + X links [m] + + + Horizontale coordinaat van de rechter kant van het rekengrid. + + + X rechts [m] + + + Verticale coordinaat van de onderkant van het rekengrid. + + + Z onder [m+NAP] + + + Verticale coordinaat van de bovenkant van het rekengrid. + + + Z boven [m+NAP] + \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/MacroStabilityInwardsDrainageProperties.cs =================================================================== diff -u -r1ab5c5f5743797918f2c11a57035d0eb8b49049c -r99cac92e4eeb290856138296baab92ca7c09e0f7 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/MacroStabilityInwardsDrainageProperties.cs (.../MacroStabilityInwardsDrainageProperties.cs) (revision 1ab5c5f5743797918f2c11a57035d0eb8b49049c) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/MacroStabilityInwardsDrainageProperties.cs (.../MacroStabilityInwardsDrainageProperties.cs) (revision 99cac92e4eeb290856138296baab92ca7c09e0f7) @@ -46,7 +46,7 @@ /// /// Creates a new instance of . /// - /// The data of the properties + /// The data of the properties. /// The handler responsible for handling effects of a property change. /// Thrown when any parameter is null. public MacroStabilityInwardsDrainageProperties(MacroStabilityInwardsInput data, IObservablePropertyChangeHandler handler) Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/MacroStabilityInwardsGridProperties.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/MacroStabilityInwardsGridProperties.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/MacroStabilityInwardsGridProperties.cs (revision 99cac92e4eeb290856138296baab92ca7c09e0f7) @@ -0,0 +1,169 @@ +// Copyright (C) Stichting Deltares 2017. 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.Base.Data; +using Core.Common.Gui.Attributes; +using Core.Common.Gui.PropertyBag; +using Core.Common.Utils.Attributes; +using Ringtoets.Common.Forms.ChangeHandlers; +using Ringtoets.Common.Forms.PropertyClasses; +using Ringtoets.MacroStabilityInwards.Data; +using Ringtoets.MacroStabilityInwards.Forms.Properties; + +namespace Ringtoets.MacroStabilityInwards.Forms.PropertyClasses +{ + /// + /// ViewModel of properties for properties panel. + /// + public class MacroStabilityInwardsGridProperties : ObjectProperties + { + private const int xLeftPropertyIndex = 1; + private const int xRightPropertyIndex = 2; + private const int zTopPropertyIndex = 3; + private const int zBottomPropertyIndex = 4; + private const int numberOfHorizontalPointsPropertyIndex = 5; + private const int numberOfVerticalPointsPropertyIndex = 6; + + private readonly IObservablePropertyChangeHandler propertyChangeHandler; + + /// + /// Creates a new instance of . + /// + /// The data of the properties. + /// The handler responsible for handling effects of a property change. + /// Thrown when any parameter is null. + public MacroStabilityInwardsGridProperties(MacroStabilityInwardsGrid data, IObservablePropertyChangeHandler handler) + { + if (data == null) + { + throw new ArgumentNullException(nameof(data)); + } + if (handler == null) + { + throw new ArgumentNullException(nameof(handler)); + } + this.data = data; + propertyChangeHandler = handler; + } + + [PropertyOrder(xLeftPropertyIndex)] + [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_Grid))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.XLeft_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.XLeft_Description))] + public RoundedDouble XLeft + { + get + { + return data.XLeft; + } + set + { + PropertyChangeHelper.ChangePropertyAndNotify(() => data.XLeft = value, propertyChangeHandler); + } + } + + [PropertyOrder(xRightPropertyIndex)] + [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_Grid))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.XRight_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.XRight_Description))] + public RoundedDouble XRight + { + get + { + return data.XRight; + } + set + { + PropertyChangeHelper.ChangePropertyAndNotify(() => data.XRight = value, propertyChangeHandler); + } + } + + [PropertyOrder(zTopPropertyIndex)] + [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_Grid))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.ZTop_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.ZTop_Description))] + public RoundedDouble ZTop + { + get + { + return data.ZTop; + } + set + { + PropertyChangeHelper.ChangePropertyAndNotify(() => data.ZTop = value, propertyChangeHandler); + } + } + + [PropertyOrder(zBottomPropertyIndex)] + [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_Grid))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.ZBottom_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.ZBottom_Description))] + public RoundedDouble ZBottom + { + get + { + return data.ZBottom; + } + set + { + PropertyChangeHelper.ChangePropertyAndNotify(() => data.ZBottom = value, propertyChangeHandler); + } + } + + [PropertyOrder(numberOfHorizontalPointsPropertyIndex)] + [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_Grid))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.NumberOfHorizontalPoints_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.NumberOfHorizontalPoints_Description))] + public int NumberOfHorizontalPoints + { + get + { + return data.NumberOfHorizontalPoints; + } + set + { + PropertyChangeHelper.ChangePropertyAndNotify(() => data.NumberOfHorizontalPoints = value, propertyChangeHandler); + } + } + + [PropertyOrder(numberOfVerticalPointsPropertyIndex)] + [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_Grid))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.NumberOfVerticalPoints_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.NumberOfVerticalPoints_Description))] + public int NumberOfVerticalPoints + { + get + { + return data.NumberOfVerticalPoints; + } + set + { + PropertyChangeHelper.ChangePropertyAndNotify(() => data.NumberOfVerticalPoints = value, propertyChangeHandler); + } + } + + public override string ToString() + { + return string.Empty; + } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/MacroStabilityInwardsGridSettingsProperties.cs =================================================================== diff -u -rfeb863dccfb07cb86ef8c26e3610129ac299553b -r99cac92e4eeb290856138296baab92ca7c09e0f7 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/MacroStabilityInwardsGridSettingsProperties.cs (.../MacroStabilityInwardsGridSettingsProperties.cs) (revision feb863dccfb07cb86ef8c26e3610129ac299553b) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/MacroStabilityInwardsGridSettingsProperties.cs (.../MacroStabilityInwardsGridSettingsProperties.cs) (revision 99cac92e4eeb290856138296baab92ca7c09e0f7) @@ -35,7 +35,7 @@ namespace Ringtoets.MacroStabilityInwards.Forms.PropertyClasses { /// - /// ViewModel of drainage properties in for properties panel. + /// ViewModel of grid settings properties in for properties panel. /// public class MacroStabilityInwardsGridSettingsProperties : ObjectProperties { @@ -44,13 +44,15 @@ private const int tangentLineDeterminationPropertyIndex = 3; private const int tangentLineZTopPropertyIndex = 4; private const int tangentLineZBottomPropertyIndex = 5; + private const int leftGridPropertyIndex = 6; + private const int rightGridPropertyIndex = 7; private readonly IObservablePropertyChangeHandler propertyChangeHandler; /// /// Creates a new instance of . /// - /// The data of the properties + /// The data of the properties. /// The handler responsible for handling effects of a property change. /// Thrown when any parameter is null. public MacroStabilityInwardsGridSettingsProperties(MacroStabilityInwardsInput data, IObservablePropertyChangeHandler handler) @@ -150,6 +152,32 @@ } } + [PropertyOrder(leftGridPropertyIndex)] + [ResourcesCategory(typeof(Resources), nameof(Resources.GridSettings_DisplayName))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.LeftGrid_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.LeftGrid_Description))] + [TypeConverter(typeof(ExpandableObjectConverter))] + public MacroStabilityInwardsGridProperties LeftGrid + { + get + { + return new MacroStabilityInwardsGridProperties(data.LeftGrid, propertyChangeHandler); + } + } + + [PropertyOrder(rightGridPropertyIndex)] + [ResourcesCategory(typeof(Resources), nameof(Resources.GridSettings_DisplayName))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.RightGrid_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.RightGrid_Description))] + [TypeConverter(typeof(ExpandableObjectConverter))] + public MacroStabilityInwardsGridProperties RightGrid + { + get + { + return new MacroStabilityInwardsGridProperties(data.RightGrid, propertyChangeHandler); + } + } + public override string ToString() { return string.Empty; Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/MacroStabilityInwardsOffsetProperties.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/MacroStabilityInwardsOffsetProperties.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/MacroStabilityInwardsOffsetProperties.cs (revision 99cac92e4eeb290856138296baab92ca7c09e0f7) @@ -0,0 +1,163 @@ +// Copyright (C) Stichting Deltares 2017. 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.Base.Data; +using Core.Common.Gui.Attributes; +using Core.Common.Gui.PropertyBag; +using Core.Common.Utils.Attributes; +using Ringtoets.Common.Forms.ChangeHandlers; +using Ringtoets.Common.Forms.PropertyClasses; +using Ringtoets.MacroStabilityInwards.Data; +using Ringtoets.MacroStabilityInwards.Forms.PresentationObjects; +using Ringtoets.MacroStabilityInwards.Forms.Properties; + +namespace Ringtoets.MacroStabilityInwards.Forms.PropertyClasses +{ + /// + /// ViewModel of offset properties in for properties panel. + /// + public class MacroStabilityInwardsOffsetProperties : ObjectProperties + { + private const int useDefaultOffsetPropertyIndex = 1; + private const int phreaticLineOffsetBelowDikeTopAtRiverPropertyIndex = 2; + private const int phreaticLineOffsetBelowDikeTopAtPolderPropertyIndex = 3; + private const int phreaticLineOffsetBelowShoulderBaseInsidePropertyIndex = 4; + private const int phreaticLineOffsetBelowDikeToeAtPolderPropertyIndex = 5; + + private readonly IObservablePropertyChangeHandler propertyChangeHandler; + + /// + /// Creates a new instance of . + /// + /// The data of the properties. + /// The handler responsible for handling effects of a property change. + /// Thrown when any parameter is null. + public MacroStabilityInwardsOffsetProperties(MacroStabilityInwardsInput data, IObservablePropertyChangeHandler handler) + { + if (data == null) + { + throw new ArgumentNullException(nameof(data)); + } + if (handler == null) + { + throw new ArgumentNullException(nameof(handler)); + } + this.data = data; + propertyChangeHandler = handler; + } + + [PropertyOrder(useDefaultOffsetPropertyIndex)] + [ResourcesCategory(typeof(Resources), nameof(Resources.Offsets_DisplayName))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.UseDefaultOffset_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.UseDefaultOffset_Description))] + public bool UseDefaultOffset + { + get + { + return data.UseDefaultOffset; + } + set + { + PropertyChangeHelper.ChangePropertyAndNotify(() => data.UseDefaultOffset = value, propertyChangeHandler); + } + } + + [DynamicReadOnly] + [PropertyOrder(phreaticLineOffsetBelowDikeTopAtRiverPropertyIndex)] + [ResourcesCategory(typeof(Resources), nameof(Resources.Offsets_DisplayName))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.PhreaticLineOffsetBelowDikeTopAtRiver_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.PhreaticLineOffsetBelowDikeTopAtRiver_Description))] + public RoundedDouble PhreaticLineOffsetBelowDikeTopAtRiver + { + get + { + return data.PhreaticLineOffsetBelowDikeTopAtRiver; + } + set + { + PropertyChangeHelper.ChangePropertyAndNotify(() => data.PhreaticLineOffsetBelowDikeTopAtRiver = value, propertyChangeHandler); + } + } + + [DynamicReadOnly] + [PropertyOrder(phreaticLineOffsetBelowDikeTopAtPolderPropertyIndex)] + [ResourcesCategory(typeof(Resources), nameof(Resources.Offsets_DisplayName))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.PhreaticLineOffsetBelowDikeTopAtPolder_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.PhreaticLineOffsetBelowDikeTopAtPolder_Description))] + public RoundedDouble PhreaticLineOffsetBelowDikeTopAtPolder + { + get + { + return data.PhreaticLineOffsetBelowDikeTopAtPolder; + } + set + { + PropertyChangeHelper.ChangePropertyAndNotify(() => data.PhreaticLineOffsetBelowDikeTopAtPolder = value, propertyChangeHandler); + } + } + + [DynamicReadOnly] + [PropertyOrder(phreaticLineOffsetBelowShoulderBaseInsidePropertyIndex)] + [ResourcesCategory(typeof(Resources), nameof(Resources.Offsets_DisplayName))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.PhreaticLineOffsetBelowShoulderBaseInside_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.PhreaticLineOffsetBelowShoulderBaseInside_Description))] + public RoundedDouble PhreaticLineOffsetBelowShoulderBaseInside + { + get + { + return data.PhreaticLineOffsetBelowShoulderBaseInside; + } + set + { + PropertyChangeHelper.ChangePropertyAndNotify(() => data.PhreaticLineOffsetBelowShoulderBaseInside = value, propertyChangeHandler); + } + } + + [DynamicReadOnly] + [PropertyOrder(phreaticLineOffsetBelowDikeToeAtPolderPropertyIndex)] + [ResourcesCategory(typeof(Resources), nameof(Resources.Offsets_DisplayName))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.PhreaticLineOffsetBelowDikeToeAtPolder_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.PhreaticLineOffsetBelowDikeToeAtPolder_Description))] + public RoundedDouble PhreaticLineOffsetBelowDikeToeAtPolder + { + get + { + return data.PhreaticLineOffsetBelowDikeToeAtPolder; + } + set + { + PropertyChangeHelper.ChangePropertyAndNotify(() => data.PhreaticLineOffsetBelowDikeToeAtPolder = value, propertyChangeHandler); + } + } + + [DynamicReadOnlyValidationMethod] + public bool DynamicReadOnlyValidationMethod(string propertyName) + { + return !UseDefaultOffset; + } + + public override string ToString() + { + return string.Empty; + } + } +} \ No newline at end of file Fisheye: Tag 99cac92e4eeb290856138296baab92ca7c09e0f7 refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/MacroStabilityInwardsOffsetsProperties.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/MacroStabilityInwardsWaterStressesProperties.cs =================================================================== diff -u -r5df0d352c9b7b04b440c800f2786d4a5d98cde0a -r99cac92e4eeb290856138296baab92ca7c09e0f7 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/MacroStabilityInwardsWaterStressesProperties.cs (.../MacroStabilityInwardsWaterStressesProperties.cs) (revision 5df0d352c9b7b04b440c800f2786d4a5d98cde0a) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/MacroStabilityInwardsWaterStressesProperties.cs (.../MacroStabilityInwardsWaterStressesProperties.cs) (revision 99cac92e4eeb290856138296baab92ca7c09e0f7) @@ -58,7 +58,7 @@ /// /// Creates a new instance of . /// - /// The data of the properties + /// The data of the properties. /// The handler responsible for handling effects of a property change. /// Thrown when any parameter is null. public MacroStabilityInwardsWaterStressesProperties(MacroStabilityInwardsInput data, IObservablePropertyChangeHandler handler) @@ -157,11 +157,11 @@ [ResourcesDisplayName(typeof(Resources), nameof(Resources.Offsets_DisplayName))] [ResourcesDescription(typeof(Resources), nameof(Resources.Offsets_Description))] [TypeConverter(typeof(ExpandableObjectConverter))] - public MacroStabilityInwardsOffsetsProperties Offsets + public MacroStabilityInwardsOffsetProperties Offsets { get { - return new MacroStabilityInwardsOffsetsProperties(data, propertyChangeHandler); + return new MacroStabilityInwardsOffsetProperties(data, propertyChangeHandler); } } Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Ringtoets.MacroStabilityInwards.Forms.csproj =================================================================== diff -u -rfeb863dccfb07cb86ef8c26e3610129ac299553b -r99cac92e4eeb290856138296baab92ca7c09e0f7 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Ringtoets.MacroStabilityInwards.Forms.csproj (.../Ringtoets.MacroStabilityInwards.Forms.csproj) (revision feb863dccfb07cb86ef8c26e3610129ac299553b) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Ringtoets.MacroStabilityInwards.Forms.csproj (.../Ringtoets.MacroStabilityInwards.Forms.csproj) (revision 99cac92e4eeb290856138296baab92ca7c09e0f7) @@ -67,9 +67,10 @@ + - + Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/MacroStabilityInwardsGridTest.cs =================================================================== diff -u -r8f4fac13cbc95c6e32fc0d0d517ceb887c9690ab -r99cac92e4eeb290856138296baab92ca7c09e0f7 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/MacroStabilityInwardsGridTest.cs (.../MacroStabilityInwardsGridTest.cs) (revision 8f4fac13cbc95c6e32fc0d0d517ceb887c9690ab) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/MacroStabilityInwardsGridTest.cs (.../MacroStabilityInwardsGridTest.cs) (revision 99cac92e4eeb290856138296baab92ca7c09e0f7) @@ -48,7 +48,7 @@ Assert.AreEqual(2, grid.ZBottom.NumberOfDecimalPlaces); Assert.AreEqual(0, grid.NumberOfHorizontalPoints); - Assert.AreEqual(0, grid.NumberOfVerticalpoints); + Assert.AreEqual(0, grid.NumberOfVerticalPoints); } [Test] Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsGridPropertiesTest.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsGridPropertiesTest.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsGridPropertiesTest.cs (revision 99cac92e4eeb290856138296baab92ca7c09e0f7) @@ -0,0 +1,322 @@ +// Copyright (C) Stichting Deltares 2017. 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 System.ComponentModel; +using Core.Common.Base; +using Core.Common.Base.Data; +using Core.Common.Gui.PropertyBag; +using Core.Common.TestUtil; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Forms.ChangeHandlers; +using Ringtoets.Common.Forms.PropertyClasses; +using Ringtoets.Common.Forms.TestUtil; +using Ringtoets.MacroStabilityInwards.Data; +using Ringtoets.MacroStabilityInwards.Forms.PropertyClasses; + +namespace Ringtoets.MacroStabilityInwards.Forms.Test.PropertyClasses +{ + [TestFixture] + public class MacroStabilityInwardsGridPropertiesTest + { + private const int expectedXLeftPropertyIndex = 0; + private const int expectedXRightPropertyIndex = 1; + private const int expectedZTopPropertyIndex = 2; + private const int expectedZBottomPropertyIndex = 3; + private const int expectedNumberOfHorizontalPointsPropertyIndex = 4; + private const int expectedNumberOfVerticalPointsPropertyIndex = 5; + + [Test] + public void Constructor_ExpectedValues() + { + // Setup + var mocks = new MockRepository(); + var changeHandler = mocks.Stub(); + mocks.ReplayAll(); + + var data = new MacroStabilityInwardsGrid(); + + // Call + var properties = new MacroStabilityInwardsGridProperties(data, changeHandler); + + // Assert + Assert.IsInstanceOf>(properties); + Assert.AreSame(data, properties.Data); + mocks.VerifyAll(); + } + + [Test] + public void Constructor_DataNull_ThrowsArgumentNullException() + { + // Setup + var mocks = new MockRepository(); + var changeHandler = mocks.Stub(); + mocks.ReplayAll(); + + // Call + TestDelegate call = () => new MacroStabilityInwardsGridProperties(null, changeHandler); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("data", exception.ParamName); + mocks.VerifyAll(); + } + + [Test] + public void Constructor_HandlerNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new MacroStabilityInwardsGridProperties(new MacroStabilityInwardsGrid(), null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("handler", exception.ParamName); + } + + [Test] + public void Constructor_ValidData_PropertiesHaveExpectedAttributesValues() + { + // Setup + var mocks = new MockRepository(); + var changeHandler = mocks.Stub(); + mocks.ReplayAll(); + + var grid = new MacroStabilityInwardsGrid(); + + // Call + var properties = new MacroStabilityInwardsGridProperties(grid, changeHandler); + + // Assert + PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); + + Assert.AreEqual(6, dynamicProperties.Count); + + const string gridCategory = "Grid"; + + PropertyDescriptor xLeftProperty = dynamicProperties[expectedXLeftPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties( + xLeftProperty, + gridCategory, + "X links [m]", + "Horizontale coordinaat van de linker kant van het rekengrid."); + + PropertyDescriptor xRightProperty = dynamicProperties[expectedXRightPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties( + xRightProperty, + gridCategory, + "X rechts [m]", + "Horizontale coordinaat van de rechter kant van het rekengrid."); + + PropertyDescriptor zTopProperty = dynamicProperties[expectedZTopPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties( + zTopProperty, + gridCategory, + "Z boven [m+NAP]", + "Verticale coordinaat van de bovenkant van het rekengrid."); + + PropertyDescriptor zBottomProperty = dynamicProperties[expectedZBottomPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties( + zBottomProperty, + gridCategory, + "Z onder [m+NAP]", + "Verticale coordinaat van de onderkant van het rekengrid."); + + PropertyDescriptor numberOfHorizontalPointsProperty = dynamicProperties[expectedNumberOfHorizontalPointsPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties( + numberOfHorizontalPointsProperty, + gridCategory, + "Aantal horizontale punten", + "Aantal punten waarmee het grid wordt samengesteld in horizontale richting."); + + PropertyDescriptor numberOfVerticalPointsProperty = dynamicProperties[expectedNumberOfVerticalPointsPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties( + numberOfVerticalPointsProperty, + gridCategory, + "Aantal verticale punten", + "Aantal punten waarmee het grid wordt samengesteld in verticale richting."); + + mocks.VerifyAll(); + } + + [Test] + public void GetProperties_WithData_ReturnExpectedValues() + { + // Setup + var mocks = new MockRepository(); + var changeHandler = mocks.Stub(); + mocks.ReplayAll(); + + var grid = new MacroStabilityInwardsGrid(); + + // Call + var properties = new MacroStabilityInwardsGridProperties(grid, changeHandler); + + // Assert + Assert.AreEqual(grid.XLeft, properties.XLeft); + Assert.AreEqual(grid.XRight, properties.XRight); + Assert.AreEqual(grid.ZTop, properties.ZTop); + Assert.AreEqual(grid.ZBottom, properties.ZBottom); + Assert.AreEqual(grid.NumberOfHorizontalPoints, properties.NumberOfHorizontalPoints); + Assert.AreEqual(grid.NumberOfVerticalPoints, properties.NumberOfVerticalPoints); + mocks.VerifyAll(); + } + + [Test] + public void GivenPropertiesWithData_WhenChangingProperties_ThenPropertiesSetOnGrid() + { + // Given + var calculationItem = new MacroStabilityInwardsCalculationScenario(new GeneralMacroStabilityInwardsInput()); + MacroStabilityInwardsInput input = calculationItem.InputParameters; + MacroStabilityInwardsGrid grid = input.LeftGrid; + + var handler = new ObservablePropertyChangeHandler(calculationItem, input); + var properties = new MacroStabilityInwardsGridProperties(grid, handler); + + var random = new Random(); + double xLeft = random.Next(); + double xRight = random.Next(); + double zTop = random.Next(); + double zBottom = random.Next(); + int numberOfHorizontalPoints = random.Next(); + int numberOfVerticalPoints = random.Next(); + + // When + properties.XLeft = (RoundedDouble) xLeft; + properties.XRight = (RoundedDouble) xRight; + properties.ZTop = (RoundedDouble) zTop; + properties.ZBottom = (RoundedDouble) zBottom; + properties.NumberOfHorizontalPoints = numberOfHorizontalPoints; + properties.NumberOfVerticalPoints = numberOfVerticalPoints; + + // Then + Assert.AreEqual(xLeft, grid.XLeft); + Assert.AreEqual(xRight, grid.XRight); + Assert.AreEqual(zTop, grid.ZTop); + Assert.AreEqual(zBottom, grid.ZBottom); + Assert.AreEqual(numberOfHorizontalPoints, grid.NumberOfHorizontalPoints); + Assert.AreEqual(numberOfVerticalPoints, grid.NumberOfVerticalPoints); + } + + [Test] + public void XLeft_SetValidValue_SetsValueAndUpdatesObservers() + { + // Setup + var calculation = new MacroStabilityInwardsCalculationScenario(new GeneralMacroStabilityInwardsInput()); + + // Call & Assert + SetPropertyAndVerifyNotifcationsForCalculation(properties => properties.XLeft = (RoundedDouble) 1, calculation); + } + + [Test] + public void XRight_SetValidValue_SetsValueAndUpdatesObservers() + { + // Setup + var calculation = new MacroStabilityInwardsCalculationScenario(new GeneralMacroStabilityInwardsInput()); + + // Call & Assert + SetPropertyAndVerifyNotifcationsForCalculation(properties => properties.XRight = (RoundedDouble) 1, calculation); + } + + [Test] + public void ZTop_SetValidValue_SetsValueAndUpdatesObservers() + { + // Setup + var calculation = new MacroStabilityInwardsCalculationScenario(new GeneralMacroStabilityInwardsInput()); + + // Call & Assert + SetPropertyAndVerifyNotifcationsForCalculation(properties => properties.ZTop = (RoundedDouble) 1, calculation); + } + + [Test] + public void ZBottom_SetValidValue_SetsValueAndUpdatesObservers() + { + // Setup + var calculation = new MacroStabilityInwardsCalculationScenario(new GeneralMacroStabilityInwardsInput()); + + // Call & Assert + SetPropertyAndVerifyNotifcationsForCalculation(properties => properties.ZBottom = (RoundedDouble) 1, calculation); + } + + [Test] + public void NumberOfHorizontalPoints_SetValidValue_SetsValueAndUpdatesObservers() + { + // Setup + var calculation = new MacroStabilityInwardsCalculationScenario(new GeneralMacroStabilityInwardsInput()); + + // Call & Assert + SetPropertyAndVerifyNotifcationsForCalculation(properties => properties.NumberOfHorizontalPoints = 1, calculation); + } + + [Test] + public void NumberOfVerticalPoints_SetValidValue_SetsValueAndUpdatesObservers() + { + // Setup + var calculation = new MacroStabilityInwardsCalculationScenario(new GeneralMacroStabilityInwardsInput()); + + // Call & Assert + SetPropertyAndVerifyNotifcationsForCalculation(properties => properties.NumberOfVerticalPoints = 1, calculation); + } + + [Test] + public void ToString_Always_ReturnEmptyString() + { + // Setup + var mocks = new MockRepository(); + var changeHandler = mocks.Stub(); + mocks.ReplayAll(); + + var properties = new MacroStabilityInwardsGridProperties(new MacroStabilityInwardsGrid(), changeHandler); + + // Call + string toString = properties.ToString(); + + // Assert + Assert.AreEqual(string.Empty, toString); + } + + private static void SetPropertyAndVerifyNotifcationsForCalculation(Action setProperty, + MacroStabilityInwardsCalculation calculation) + { + // Setup + var mocks = new MockRepository(); + var observable = mocks.StrictMock(); + observable.Expect(o => o.NotifyObservers()); + mocks.ReplayAll(); + + MacroStabilityInwardsGrid grid = calculation.InputParameters.LeftGrid; + + var handler = new SetPropertyValueAfterConfirmationParameterTester(new[] + { + observable + }); + + var properties = new MacroStabilityInwardsGridProperties(grid, handler); + + // Call + setProperty(properties); + + // Assert + Assert.IsTrue(handler.Called); + mocks.VerifyAll(); + } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsGridSettingsPropertiesTest.cs =================================================================== diff -u -rfeb863dccfb07cb86ef8c26e3610129ac299553b -r99cac92e4eeb290856138296baab92ca7c09e0f7 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsGridSettingsPropertiesTest.cs (.../MacroStabilityInwardsGridSettingsPropertiesTest.cs) (revision feb863dccfb07cb86ef8c26e3610129ac299553b) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsGridSettingsPropertiesTest.cs (.../MacroStabilityInwardsGridSettingsPropertiesTest.cs) (revision 99cac92e4eeb290856138296baab92ca7c09e0f7) @@ -44,6 +44,8 @@ private const int expectedTangentLineDeterminationPropertyIndex = 2; private const int expectedTangentLineZTopPropertyIndex = 3; private const int expectedTangentLineZBottomPropertyIndex = 4; + private const int expectedLeftGridPropertyIndex = 5; + private const int expectedRightGridPropertyIndex = 6; [Test] public void Constructor_ExpectedValues() @@ -109,7 +111,7 @@ // Assert PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); - Assert.AreEqual(5, dynamicProperties.Count); + Assert.AreEqual(7, dynamicProperties.Count); const string calculationGridsCategory = "Rekengrids"; @@ -150,6 +152,24 @@ "Tangentlijn Z-onder [m+NAP]", "Verticale coordinaat van de onderste raaklijn."); + PropertyDescriptor leftGridProperty = dynamicProperties[expectedLeftGridPropertyIndex]; + Assert.AreEqual(typeof(ExpandableObjectConverter), leftGridProperty.Converter.GetType()); + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties( + leftGridProperty, + calculationGridsCategory, + "Linker grid", + "De linker grid eigenschappen.", + true); + + PropertyDescriptor rightGridProperty = dynamicProperties[expectedRightGridPropertyIndex]; + Assert.AreEqual(typeof(ExpandableObjectConverter), rightGridProperty.Converter.GetType()); + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties( + rightGridProperty, + calculationGridsCategory, + "Rechter grid", + "De rechter grid eigenschappen.", + true); + mocks.VerifyAll(); } @@ -172,6 +192,9 @@ Assert.AreEqual(input.TangentLineDetermination, properties.TangentLineDetermination); Assert.AreEqual(input.TangentLineZTop, properties.TangentLineZTop); Assert.AreEqual(input.TangentLineZBottom, properties.TangentLineZBottom); + + Assert.AreSame(input.LeftGrid, properties.LeftGrid.Data); + Assert.AreSame(input.RightGrid, properties.RightGrid.Data); mocks.VerifyAll(); } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsOffsetPropertiesTest.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsOffsetPropertiesTest.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsOffsetPropertiesTest.cs (revision 99cac92e4eeb290856138296baab92ca7c09e0f7) @@ -0,0 +1,334 @@ +// Copyright (C) Stichting Deltares 2017. 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 System.ComponentModel; +using Core.Common.Base; +using Core.Common.Base.Data; +using Core.Common.Gui.PropertyBag; +using Core.Common.TestUtil; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Forms.ChangeHandlers; +using Ringtoets.Common.Forms.PropertyClasses; +using Ringtoets.Common.Forms.TestUtil; +using Ringtoets.MacroStabilityInwards.Data; +using Ringtoets.MacroStabilityInwards.Forms.PropertyClasses; + +namespace Ringtoets.MacroStabilityInwards.Forms.Test.PropertyClasses +{ + [TestFixture] + public class MacroStabilityInwardsOffsetPropertiesTest + { + private const int expectedUseDefaultOffsetPropertyIndex = 0; + private const int expectedPhreaticLineOffsetBelowDikeTopAtRiverPropertyIndex = 1; + private const int expectedPhreaticLineOffsetBelowDikeTopAtPolderPropertyIndex = 2; + private const int expectedPhreaticLineOffsetBelowShoulderBaseInsidePropertyIndex = 3; + private const int expectedPhreaticLineOffsetBelowDikeToeAtPolderPropertyIndex = 4; + + [Test] + public void Constructor_ExpectedValues() + { + // Setup + var mocks = new MockRepository(); + var changeHandler = mocks.Stub(); + mocks.ReplayAll(); + + var input = new MacroStabilityInwardsInput(new GeneralMacroStabilityInwardsInput()); + + // Call + var properties = new MacroStabilityInwardsOffsetProperties(input, changeHandler); + + // Assert + Assert.IsInstanceOf>(properties); + Assert.AreSame(input, properties.Data); + mocks.VerifyAll(); + } + + [Test] + public void Constructor_DataNull_ThrowsArgumentNullException() + { + // Setup + var mocks = new MockRepository(); + var changeHandler = mocks.Stub(); + mocks.ReplayAll(); + + // Call + TestDelegate call = () => new MacroStabilityInwardsOffsetProperties(null, changeHandler); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("data", exception.ParamName); + mocks.VerifyAll(); + } + + [Test] + public void Constructor_HandlerNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new MacroStabilityInwardsOffsetProperties(new MacroStabilityInwardsInput(new GeneralMacroStabilityInwardsInput()), + null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("handler", exception.ParamName); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void Constructor_ValidData_PropertiesHaveExpectedAttributesValues(bool useDefaultOffset) + { + // Setup + var mocks = new MockRepository(); + var changeHandler = mocks.Stub(); + mocks.ReplayAll(); + + var input = new MacroStabilityInwardsInput(new GeneralMacroStabilityInwardsInput()) + { + UseDefaultOffset = useDefaultOffset + }; + + // Call + var properties = new MacroStabilityInwardsOffsetProperties(input, changeHandler); + + // Assert + PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); + + Assert.AreEqual(5, dynamicProperties.Count); + + const string offsetCategory = "Offsets PL 1"; + + PropertyDescriptor useDefaultOffsetProperty = dynamicProperties[expectedUseDefaultOffsetPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties( + useDefaultOffsetProperty, + offsetCategory, + "Gebruik default waarden voor offsets van PL 1", + "Gebruik standaard waterstandsverschillen voor het bepalen van de freatische lijn?"); + + PropertyDescriptor phreaticLineOffsetBelowDikeTopAtRiverProperty = dynamicProperties[expectedPhreaticLineOffsetBelowDikeTopAtRiverPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties( + phreaticLineOffsetBelowDikeTopAtRiverProperty, + offsetCategory, + "PL 1 offset onder buitenkruin [m]", + "Waterstandsverschil tussen toetspeil en de freatische lijn onder kruin buitentalud.", + !useDefaultOffset); + + PropertyDescriptor phreaticLineOffsetBelowDikeTopAtPolderProperty = dynamicProperties[expectedPhreaticLineOffsetBelowDikeTopAtPolderPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties( + phreaticLineOffsetBelowDikeTopAtPolderProperty, + offsetCategory, + "PL 1 offset onder binnenkruin [m]", + "Waterstandsverschil tussen toetspeil en de freatische lijn onder kruin binnentalud.", + !useDefaultOffset); + + PropertyDescriptor phreaticLineOffsetBelowShoulderBaseInsideProperty = dynamicProperties[expectedPhreaticLineOffsetBelowShoulderBaseInsidePropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties( + phreaticLineOffsetBelowShoulderBaseInsideProperty, + offsetCategory, + "PL 1 offset onder insteek binnenberm [m]", + "Waterstandsverschil tussen het maaiveld en de freatische lijn onder insteek binnenberm.", + !useDefaultOffset); + + PropertyDescriptor phreaticLineOffsetBelowDikeToeAtPolderProperty = dynamicProperties[expectedPhreaticLineOffsetBelowDikeToeAtPolderPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties( + phreaticLineOffsetBelowDikeToeAtPolderProperty, + offsetCategory, + "PL 1 offset onder teen dijk binnenwaarts [m]", + "Waterstandsverschil tussen het maaiveld en de freatische lijn onder teen dijk binnenwaarts.", + !useDefaultOffset); + + mocks.VerifyAll(); + } + + [Test] + public void GetProperties_WithData_ReturnExpectedValues() + { + // Setup + var mocks = new MockRepository(); + var changeHandler = mocks.Stub(); + mocks.ReplayAll(); + + var input = new MacroStabilityInwardsInput(new GeneralMacroStabilityInwardsInput()); + + // Call + var properties = new MacroStabilityInwardsOffsetProperties(input, changeHandler); + + // Assert + Assert.AreEqual(input.UseDefaultOffset, properties.UseDefaultOffset); + Assert.AreEqual(input.PhreaticLineOffsetBelowDikeTopAtRiver, properties.PhreaticLineOffsetBelowDikeTopAtRiver); + Assert.AreEqual(input.PhreaticLineOffsetBelowDikeTopAtPolder, properties.PhreaticLineOffsetBelowDikeTopAtPolder); + Assert.AreEqual(input.PhreaticLineOffsetBelowShoulderBaseInside, properties.PhreaticLineOffsetBelowShoulderBaseInside); + Assert.AreEqual(input.PhreaticLineOffsetBelowDikeToeAtPolder, properties.PhreaticLineOffsetBelowDikeToeAtPolder); + mocks.VerifyAll(); + } + + [Test] + public void GivenPropertiesWithData_WhenChangingProperties_ThenPropertiesSetOnInput() + { + // Given + var calculationItem = new MacroStabilityInwardsCalculationScenario(new GeneralMacroStabilityInwardsInput()); + MacroStabilityInwardsInput input = calculationItem.InputParameters; + + var handler = new ObservablePropertyChangeHandler(calculationItem, input); + var properties = new MacroStabilityInwardsOffsetProperties(input, handler); + + var random = new Random(); + bool useDefaultOffset = random.NextBoolean(); + double phreaticLineOffsetBelowDikeTopAtRiver = random.Next(); + double phreaticLineOffsetBelowDikeTopAtPolder = random.Next(); + double phreaticLineOffsetBelowShoulderBaseInside = random.Next(); + double phreaticLineOffsetBelowDikeToeAtPolder = random.Next(); + + // When + properties.UseDefaultOffset = useDefaultOffset; + properties.PhreaticLineOffsetBelowDikeTopAtRiver = (RoundedDouble) phreaticLineOffsetBelowDikeTopAtRiver; + properties.PhreaticLineOffsetBelowDikeTopAtPolder = (RoundedDouble) phreaticLineOffsetBelowDikeTopAtPolder; + properties.PhreaticLineOffsetBelowShoulderBaseInside = (RoundedDouble) phreaticLineOffsetBelowShoulderBaseInside; + properties.PhreaticLineOffsetBelowDikeToeAtPolder = (RoundedDouble) phreaticLineOffsetBelowDikeToeAtPolder; + + // Then + Assert.AreEqual(useDefaultOffset, input.UseDefaultOffset); + Assert.AreEqual(phreaticLineOffsetBelowDikeTopAtRiver, input.PhreaticLineOffsetBelowDikeTopAtRiver.Value); + Assert.AreEqual(phreaticLineOffsetBelowDikeTopAtPolder, input.PhreaticLineOffsetBelowDikeTopAtPolder.Value); + Assert.AreEqual(phreaticLineOffsetBelowShoulderBaseInside, input.PhreaticLineOffsetBelowShoulderBaseInside.Value); + Assert.AreEqual(phreaticLineOffsetBelowDikeToeAtPolder, input.PhreaticLineOffsetBelowDikeToeAtPolder.Value); + } + + [Test] + public void UseDefaultOffset_SetValidValue_SetsValueAndUpdatesObservers() + { + // Setup + var calculation = new MacroStabilityInwardsCalculationScenario(new GeneralMacroStabilityInwardsInput()); + + // Call & Assert + SetPropertyAndVerifyNotifcationsForCalculation(properties => properties.UseDefaultOffset = true, calculation); + } + + [Test] + public void PhreaticLineOffsetBelowDikeTopAtRiver_SetValidValue_SetsValueAndUpdatesObservers() + { + // Setup + var calculation = new MacroStabilityInwardsCalculationScenario(new GeneralMacroStabilityInwardsInput()); + + // Call & Assert + SetPropertyAndVerifyNotifcationsForCalculation(properties => properties.PhreaticLineOffsetBelowDikeTopAtRiver = (RoundedDouble) 1, calculation); + } + + [Test] + public void PhreaticLineOffsetBelowDikeTopAtPolder_SetValidValue_SetsValueAndUpdatesObservers() + { + // Setup + var calculation = new MacroStabilityInwardsCalculationScenario(new GeneralMacroStabilityInwardsInput()); + + // Call & Assert + SetPropertyAndVerifyNotifcationsForCalculation(properties => properties.PhreaticLineOffsetBelowDikeTopAtPolder = (RoundedDouble) 1, calculation); + } + + [Test] + public void PhreaticLineOffsetBelowShoulderBaseInside_SetValidValue_SetsValueAndUpdatesObservers() + { + // Setup + var calculation = new MacroStabilityInwardsCalculationScenario(new GeneralMacroStabilityInwardsInput()); + + // Call & Assert + SetPropertyAndVerifyNotifcationsForCalculation(properties => properties.PhreaticLineOffsetBelowShoulderBaseInside = (RoundedDouble) 1, calculation); + } + + [Test] + public void PhreaticLineOffsetBelowDikeToeAtPolder_SetValidValue_SetsValueAndUpdatesObservers() + { + // Setup + var calculation = new MacroStabilityInwardsCalculationScenario(new GeneralMacroStabilityInwardsInput()); + + // Call & Assert + SetPropertyAndVerifyNotifcationsForCalculation(properties => properties.PhreaticLineOffsetBelowDikeToeAtPolder = (RoundedDouble) 1, calculation); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void DynamicReadOnlyValidationMethod_Always_DependsDrainageConstructionPresent(bool useDefaultOffset) + { + // Setup + var mocks = new MockRepository(); + var handler = mocks.Stub(); + mocks.ReplayAll(); + + var input = new MacroStabilityInwardsInput(new GeneralMacroStabilityInwardsInput()) + { + UseDefaultOffset = useDefaultOffset + }; + + var properties = new MacroStabilityInwardsOffsetProperties(input, handler); + + // Call + bool result = properties.DynamicReadOnlyValidationMethod(""); + + // Assert + Assert.AreEqual(!useDefaultOffset, result); + } + + [Test] + public void ToString_Always_ReturnEmptyString() + { + // Setup + var mocks = new MockRepository(); + var changeHandler = mocks.Stub(); + mocks.ReplayAll(); + + var input = new MacroStabilityInwardsInput(new GeneralMacroStabilityInwardsInput()); + var properties = new MacroStabilityInwardsOffsetProperties(input, changeHandler); + + // Call + string toString = properties.ToString(); + + // Assert + Assert.AreEqual(string.Empty, toString); + } + + private static void SetPropertyAndVerifyNotifcationsForCalculation(Action setProperty, + MacroStabilityInwardsCalculation calculation) + { + // Setup + var mocks = new MockRepository(); + var observable = mocks.StrictMock(); + observable.Expect(o => o.NotifyObservers()); + mocks.ReplayAll(); + + MacroStabilityInwardsInput input = calculation.InputParameters; + + var handler = new SetPropertyValueAfterConfirmationParameterTester(new[] + { + observable + }); + + var properties = new MacroStabilityInwardsOffsetProperties(input, handler); + + // Call + setProperty(properties); + + // Assert + Assert.IsTrue(handler.Called); + mocks.VerifyAll(); + } + } +} \ No newline at end of file Fisheye: Tag 99cac92e4eeb290856138296baab92ca7c09e0f7 refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsOffsetsPropertiesTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Ringtoets.MacroStabilityInwards.Forms.Test.csproj =================================================================== diff -u -rfeb863dccfb07cb86ef8c26e3610129ac299553b -r99cac92e4eeb290856138296baab92ca7c09e0f7 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Ringtoets.MacroStabilityInwards.Forms.Test.csproj (.../Ringtoets.MacroStabilityInwards.Forms.Test.csproj) (revision feb863dccfb07cb86ef8c26e3610129ac299553b) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Ringtoets.MacroStabilityInwards.Forms.Test.csproj (.../Ringtoets.MacroStabilityInwards.Forms.Test.csproj) (revision 99cac92e4eeb290856138296baab92ca7c09e0f7) @@ -70,8 +70,9 @@ + - +