Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/MacroStabilityInwardsSoilLayerUnderSurfaceLine.cs =================================================================== diff -u -r78382ec129ddc7537096860680cef36f3796700d -rc85b5e367887a96d602dfb7a0b46073b6eef84da --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/MacroStabilityInwardsSoilLayerUnderSurfaceLine.cs (.../MacroStabilityInwardsSoilLayerUnderSurfaceLine.cs) (revision 78382ec129ddc7537096860680cef36f3796700d) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/MacroStabilityInwardsSoilLayerUnderSurfaceLine.cs (.../MacroStabilityInwardsSoilLayerUnderSurfaceLine.cs) (revision c85b5e367887a96d602dfb7a0b46073b6eef84da) @@ -38,7 +38,7 @@ /// The outer ring of the geometry of the soil layer. /// The properties of the soil layer. /// Thrown when any parameter is null. - public MacroStabilityInwardsSoilLayerUnderSurfaceLine(Point2D[] outerRing, SoilLayerProperties properties) + public MacroStabilityInwardsSoilLayerUnderSurfaceLine(Point2D[] outerRing, MacroStabilityInwardsSoilLayerProperties properties) : this(outerRing, Enumerable.Empty(), properties) {} /// @@ -48,7 +48,7 @@ /// The holes of the geometry of the soil layer. /// The properties of the soil layer. /// Thrown when any parameter is null. - public MacroStabilityInwardsSoilLayerUnderSurfaceLine(Point2D[] outerRing, IEnumerable holes, SoilLayerProperties properties) + public MacroStabilityInwardsSoilLayerUnderSurfaceLine(Point2D[] outerRing, IEnumerable holes, MacroStabilityInwardsSoilLayerProperties properties) { if (outerRing == null) { @@ -80,6 +80,6 @@ /// /// Gets the properties of the soil layer. /// - public SoilLayerProperties Properties { get; } + public MacroStabilityInwardsSoilLayerProperties Properties { get; } } } \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/MacroStabilityInwardsSoilProfileUnderSurfaceLineFactory.cs =================================================================== diff -u -r78382ec129ddc7537096860680cef36f3796700d -rc85b5e367887a96d602dfb7a0b46073b6eef84da --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/MacroStabilityInwardsSoilProfileUnderSurfaceLineFactory.cs (.../MacroStabilityInwardsSoilProfileUnderSurfaceLineFactory.cs) (revision 78382ec129ddc7537096860680cef36f3796700d) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/MacroStabilityInwardsSoilProfileUnderSurfaceLineFactory.cs (.../MacroStabilityInwardsSoilProfileUnderSurfaceLineFactory.cs) (revision c85b5e367887a96d602dfb7a0b46073b6eef84da) @@ -133,15 +133,15 @@ private class TempSoilLayerGeometry { - public TempSoilLayerGeometry(Point2D[] outerLoop, SoilLayerProperties properties) + public TempSoilLayerGeometry(Point2D[] outerLoop, MacroStabilityInwardsSoilLayerProperties properties) { OuterLoop = outerLoop; Properties = properties; InnerLoops = Enumerable.Empty(); } public Point2D[] OuterLoop { get; } - public SoilLayerProperties Properties { get; } + public MacroStabilityInwardsSoilLayerProperties Properties { get; } public IEnumerable InnerLoops { get; } } } Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PresentationObjects/MacroStabilityInwardsStochasticSoilModelCollectionContext.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PresentationObjects/MacroStabilityInwardsStochasticSoilModelCollectionContext.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PresentationObjects/MacroStabilityInwardsStochasticSoilModelCollectionContext.cs (revision c85b5e367887a96d602dfb7a0b46073b6eef84da) @@ -0,0 +1,71 @@ +// 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.Controls.PresentationObjects; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.MacroStabilityInwards.Data; +using Ringtoets.MacroStabilityInwards.Data.SoilProfile; + +namespace Ringtoets.MacroStabilityInwards.Forms.PresentationObjects +{ + /// + /// The presentation object for . + /// + public class MacroStabilityInwardsStochasticSoilModelCollectionContext : ObservableWrappedObjectContextBase + { + /// + /// Creates a new instance of . + /// + /// The stochastic soil models to wrap. + /// The failure mechanism. + /// The assessment section. + /// Thrown when any input argument is null. + public MacroStabilityInwardsStochasticSoilModelCollectionContext(MacroStabilityInwardsStochasticSoilModelCollection wrappedStochasticSoilModels, + MacroStabilityInwardsFailureMechanism failureMechanism, + IAssessmentSection assessmentSection) + : base(wrappedStochasticSoilModels) + { + if (failureMechanism == null) + { + throw new ArgumentNullException(nameof(failureMechanism)); + } + + if (assessmentSection == null) + { + throw new ArgumentNullException(nameof(assessmentSection)); + } + + FailureMechanism = failureMechanism; + AssessmentSection = assessmentSection; + } + + /// + /// Gets the failure mechanism which the context belongs to. + /// + public MacroStabilityInwardsFailureMechanism FailureMechanism { get; private set; } + + /// + /// Gets the assessment section which the context belongs to. + /// + public IAssessmentSection AssessmentSection { get; private set; } + } +} \ No newline at end of file Fisheye: Tag c85b5e367887a96d602dfb7a0b46073b6eef84da refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PresentationObjects/StochasticSoilModelCollectionContext.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/MacroStabilityInwardsStochasticSoilModelCollectionProperties.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/MacroStabilityInwardsStochasticSoilModelCollectionProperties.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/MacroStabilityInwardsStochasticSoilModelCollectionProperties.cs (revision c85b5e367887a96d602dfb7a0b46073b6eef84da) @@ -0,0 +1,61 @@ +// 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.Gui.PropertyBag; +using Core.Common.Utils.Attributes; +using Ringtoets.MacroStabilityInwards.Data.SoilProfile; +using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; + +namespace Ringtoets.MacroStabilityInwards.Forms.PropertyClasses +{ + /// + /// ViewModel of for properties panel. + /// + public class MacroStabilityInwardsStochasticSoilModelCollectionProperties : ObjectProperties + { + /// + /// Creates a new instance of . + /// + /// The collection for which the properties are shown. + /// Thrown when + /// is null. + public MacroStabilityInwardsStochasticSoilModelCollectionProperties(MacroStabilityInwardsStochasticSoilModelCollection collection) + { + if (collection == null) + { + throw new ArgumentNullException(nameof(collection)); + } + data = collection; + } + + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_General))] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.ObservableCollectionWithSourcePath_SourcePath_DisplayName))] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.StochasticSoilModelCollection_SourcePath_Description))] + public string SourcePath + { + get + { + return data.SourcePath; + } + } + } +} \ No newline at end of file Fisheye: Tag c85b5e367887a96d602dfb7a0b46073b6eef84da refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/StochasticSoilModelCollectionProperties.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Ringtoets.MacroStabilityInwards.Forms.csproj =================================================================== diff -u -r7b513e5e4b0d15ba13e161b4c5a2e1097f58b8fd -rc85b5e367887a96d602dfb7a0b46073b6eef84da --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Ringtoets.MacroStabilityInwards.Forms.csproj (.../Ringtoets.MacroStabilityInwards.Forms.csproj) (revision 7b513e5e4b0d15ba13e161b4c5a2e1097f58b8fd) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Ringtoets.MacroStabilityInwards.Forms.csproj (.../Ringtoets.MacroStabilityInwards.Forms.csproj) (revision c85b5e367887a96d602dfb7a0b46073b6eef84da) @@ -58,7 +58,7 @@ - + True @@ -75,7 +75,7 @@ - + Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/SoilProfiles/MacroStabilityInwardsSoilLayerTransformer.cs =================================================================== diff -u -r6f54c941b22c5be826b3e1b0853a3fcad29ee87b -rc85b5e367887a96d602dfb7a0b46073b6eef84da --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/SoilProfiles/MacroStabilityInwardsSoilLayerTransformer.cs (.../MacroStabilityInwardsSoilLayerTransformer.cs) (revision 6f54c941b22c5be826b3e1b0853a3fcad29ee87b) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/SoilProfiles/MacroStabilityInwardsSoilLayerTransformer.cs (.../MacroStabilityInwardsSoilLayerTransformer.cs) (revision c85b5e367887a96d602dfb7a0b46073b6eef84da) @@ -95,7 +95,7 @@ return layer; } - private static void SetProperties(SoilLayerBase soilLayer, SoilLayerProperties properties) + private static void SetProperties(SoilLayerBase soilLayer, MacroStabilityInwardsSoilLayerProperties properties) { try { Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Plugin/MacroStabilityInwardsPlugin.cs =================================================================== diff -u -rd619624819b7200ac55b357b0a0c54d198fc20e4 -rc85b5e367887a96d602dfb7a0b46073b6eef84da --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Plugin/MacroStabilityInwardsPlugin.cs (.../MacroStabilityInwardsPlugin.cs) (revision d619624819b7200ac55b357b0a0c54d198fc20e4) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Plugin/MacroStabilityInwardsPlugin.cs (.../MacroStabilityInwardsPlugin.cs) (revision c85b5e367887a96d602dfb7a0b46073b6eef84da) @@ -80,9 +80,9 @@ CreateInstance = context => new MacroStabilityInwardsSurfaceLineCollectionProperties(context.WrappedData) }; yield return new PropertyInfo(); - yield return new PropertyInfo + yield return new PropertyInfo { - CreateInstance = context => new StochasticSoilModelCollectionProperties(context.WrappedData) + CreateInstance = context => new MacroStabilityInwardsStochasticSoilModelCollectionProperties(context.WrappedData) }; yield return new PropertyInfo { @@ -111,7 +111,7 @@ VerifyUpdates = context => VerifySurfaceLineUpdates(context, Resources.MacroStabilityInwardsPlugin_VerifySurfaceLineImports_When_importing_surface_lines_calculation_output_will_be_cleared_confirm) }; - yield return new ImportInfo + yield return new ImportInfo { Name = RingtoetsCommonDataResources.StochasticSoilModelCollection_TypeDescriptor, Category = RingtoetsCommonFormsResources.Ringtoets_Category, @@ -167,7 +167,7 @@ VerifyUpdates = context => VerifySurfaceLineUpdates(context, Resources.MacroStabilityInwardsPlugin_VerifySurfaceLineUpdates_When_updating_surface_lines_definitions_assigned_to_calculation_output_will_be_cleared_confirm) }; - yield return new UpdateInfo + yield return new UpdateInfo { Name = RingtoetsCommonDataResources.StochasticSoilModelCollection_TypeDescriptor, Category = RingtoetsCommonFormsResources.Ringtoets_Category, @@ -300,7 +300,7 @@ .Build() }; - yield return new TreeNodeInfo + yield return new TreeNodeInfo { Text = stochasticSoilModelContext => RingtoetsCommonDataResources.StochasticSoilModelCollection_TypeDescriptor, Image = stochasticSoilModelContext => RingtoetsCommonFormsResources.GeneralFolderIcon, @@ -370,7 +370,7 @@ } } - private bool VerifyStochasticSoilModelUpdates(StochasticSoilModelCollectionContext context, string query) + private bool VerifyStochasticSoilModelUpdates(MacroStabilityInwardsStochasticSoilModelCollectionContext context, string query) { var changeHandler = new FailureMechanismCalculationChangeHandler(context.FailureMechanism, query, @@ -580,9 +580,9 @@ #endregion - #region StochasticSoilModelCollectionContext TreeNodeInfo + #region MacroStabilityInwardsStochasticSoilModelCollectionContext TreeNodeInfo - private ContextMenuStrip StochasticSoilModelCollectionContextContextMenuStrip(StochasticSoilModelCollectionContext nodeData, object parentData, TreeViewControl treeViewControl) + private ContextMenuStrip StochasticSoilModelCollectionContextContextMenuStrip(MacroStabilityInwardsStochasticSoilModelCollectionContext nodeData, object parentData, TreeViewControl treeViewControl) { return Gui.Get(nodeData, treeViewControl) .AddImportItem() @@ -685,7 +685,7 @@ { new FailureMechanismSectionsContext(failureMechanism, assessmentSection), new MacroStabilityInwardsSurfaceLinesContext(failureMechanism.SurfaceLines, failureMechanism, assessmentSection), - new StochasticSoilModelCollectionContext(failureMechanism.StochasticSoilModels, failureMechanism, assessmentSection), + new MacroStabilityInwardsStochasticSoilModelCollectionContext(failureMechanism.StochasticSoilModels, failureMechanism, assessmentSection), failureMechanism.InputComments }; } Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/MacroStabilityInwardsSoilLayer1D.cs =================================================================== diff -u -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b -rc85b5e367887a96d602dfb7a0b46073b6eef84da --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/MacroStabilityInwardsSoilLayer1D.cs (.../MacroStabilityInwardsSoilLayer1D.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/MacroStabilityInwardsSoilLayer1D.cs (.../MacroStabilityInwardsSoilLayer1D.cs) (revision c85b5e367887a96d602dfb7a0b46073b6eef84da) @@ -33,13 +33,13 @@ public MacroStabilityInwardsSoilLayer1D(double top) { Top = top; - Properties = new SoilLayerProperties(); + Properties = new MacroStabilityInwardsSoilLayerProperties(); } /// /// Gets the properties of the . /// - public SoilLayerProperties Properties { get; } + public MacroStabilityInwardsSoilLayerProperties Properties { get; } /// /// Gets the top level of the . Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/MacroStabilityInwardsSoilLayer2D.cs =================================================================== diff -u -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b -rc85b5e367887a96d602dfb7a0b46073b6eef84da --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/MacroStabilityInwardsSoilLayer2D.cs (.../MacroStabilityInwardsSoilLayer2D.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/MacroStabilityInwardsSoilLayer2D.cs (.../MacroStabilityInwardsSoilLayer2D.cs) (revision c85b5e367887a96d602dfb7a0b46073b6eef84da) @@ -47,15 +47,15 @@ { throw new ArgumentNullException(nameof(holes)); } - Properties = new SoilLayerProperties(); + Properties = new MacroStabilityInwardsSoilLayerProperties(); OuterRing = outerRing; Holes = holes.ToArray(); } /// /// Gets the properties of the . /// - public SoilLayerProperties Properties { get; } + public MacroStabilityInwardsSoilLayerProperties Properties { get; } /// /// Gets the outer ring of the polygon with holes describing the surface of the . Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/MacroStabilityInwardsSoilLayerProperties.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/MacroStabilityInwardsSoilLayerProperties.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/MacroStabilityInwardsSoilLayerProperties.cs (revision c85b5e367887a96d602dfb7a0b46073b6eef84da) @@ -0,0 +1,264 @@ +// 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.Drawing; + +namespace Ringtoets.MacroStabilityInwards.Primitives +{ + /// + /// Properties of a soil layer. + /// + public class MacroStabilityInwardsSoilLayerProperties + { + private string materialName = string.Empty; + + /// + /// Creates a new instance of . + /// + public MacroStabilityInwardsSoilLayerProperties() + { + ShearStrengthModel = MacroStabilityInwardsShearStrengthModel.None; + } + + /// + /// Gets or sets a value indicating whether the layer is an aquifer. + /// + public bool IsAquifer { get; set; } + + /// + /// Gets or sets the name of the material that was assigned to the layer. + /// + /// Thrown when is null. + public string MaterialName + { + get + { + return materialName; + } + set + { + if (value == null) + { + throw new ArgumentNullException(nameof(value)); + } + materialName = value; + } + } + + /// + /// Gets or sets the that was used to represent the layer. + /// + public Color Color { get; set; } + + /// + /// Gets or sets a value indicating whether to use POP for the layer. + /// + public bool UsePop { get; set; } + + /// + /// Gets or sets the shear strength model to use for the layer. + /// + public MacroStabilityInwardsShearStrengthModel ShearStrengthModel { get; set; } + + /// + /// Gets or sets the mean of the distribution for the volumic weight of the layer above the phreatic level. + /// [kN/m³] + /// + public double AbovePhreaticLevelMean { get; set; } = double.NaN; + + /// + /// Gets or sets the deviation of the distribution for the volumic weight of the layer above the phreatic level. + /// [kN/m³] + /// + public double AbovePhreaticLevelDeviation { get; set; } = double.NaN; + + /// + /// Gets or sets the mean of the distribution for the volumic weight of the layer below the phreatic level. + /// [kN/m³] + /// + public double BelowPhreaticLevelMean { get; set; } = double.NaN; + + /// + /// Gets or sets the deviation of the distribution for the volumic weight of the layer below the phreatic level. + /// [kN/m³] + /// + public double BelowPhreaticLevelDeviation { get; set; } = double.NaN; + + /// + /// Gets or sets the mean of the distribution for the cohesion. + /// [kN/m³] + /// + public double CohesionMean { get; set; } = double.NaN; + + /// + /// Gets or sets the deviation of the distribution for the cohesion. + /// [kN/m³] + /// + public double CohesionDeviation { get; set; } = double.NaN; + + /// + /// Gets or sets the shift of the distribution for the cohesion. + /// [kN/m³] + /// + public double CohesionShift { get; set; } = double.NaN; + + /// + /// Gets or sets the mean of the distribution for the friction angle + /// [°] + /// + public double FrictionAngleMean { get; set; } = double.NaN; + + /// + /// Gets or sets the deviation of the distribution for the friction angle. + /// [°] + /// + public double FrictionAngleDeviation { get; set; } = double.NaN; + + /// + /// Gets or sets the shift of the distribution for the friction angle. + /// [°] + /// + public double FrictionAngleShift { get; set; } = double.NaN; + + /// + /// Gets or sets the mean of the distribution for the ratio of shear strength S + /// [-] + /// + public double ShearStrengthRatioMean { get; set; } = double.NaN; + + /// + /// Gets or sets the deviation of the distribution for the ratio of shear strength S. + /// [-] + /// + public double ShearStrengthRatioDeviation { get; set; } = double.NaN; + + /// + /// Gets or sets the shift of the distribution for the ratio of shear strength S. + /// [-] + /// + public double ShearStrengthRatioShift { get; set; } = double.NaN; + + /// + /// Gets or sets the mean of the distribution for the strength increase exponent (m) + /// [-] + /// + public double StrengthIncreaseExponentMean { get; set; } = double.NaN; + + /// + /// Gets or sets the deviation of the distribution for the strength increase exponent (m). + /// [-] + /// + public double StrengthIncreaseExponentDeviation { get; set; } = double.NaN; + + /// + /// Gets or sets the shift of the distribution for the strength increase exponent (m). + /// [-] + /// + public double StrengthIncreaseExponentShift { get; set; } = double.NaN; + + /// + /// Gets or sets the mean of the distribution for the POP + /// [kN/m²] + /// + public double PopMean { get; set; } = double.NaN; + + /// + /// Gets or sets the deviation of the distribution for the POP. + /// [kN/m²] + /// + public double PopDeviation { get; set; } = double.NaN; + + /// + /// Gets or sets the shift of the distribution for the POP. + /// [kN/m²] + /// + public double PopShift { get; set; } = double.NaN; + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) return false; + if (ReferenceEquals(this, obj)) return true; + if (obj.GetType() != GetType()) return false; + return Equals((MacroStabilityInwardsSoilLayerProperties) obj); + } + + public override int GetHashCode() + { + unchecked + { + int hashCode = StringComparer.InvariantCulture.GetHashCode(materialName); + hashCode = (hashCode * 397) ^ IsAquifer.GetHashCode(); + hashCode = (hashCode * 397) ^ Color.GetHashCode(); + hashCode = (hashCode * 397) ^ UsePop.GetHashCode(); + hashCode = (hashCode * 397) ^ (int) ShearStrengthModel; + hashCode = (hashCode * 397) ^ AbovePhreaticLevelMean.GetHashCode(); + hashCode = (hashCode * 397) ^ AbovePhreaticLevelDeviation.GetHashCode(); + hashCode = (hashCode * 397) ^ BelowPhreaticLevelMean.GetHashCode(); + hashCode = (hashCode * 397) ^ BelowPhreaticLevelDeviation.GetHashCode(); + hashCode = (hashCode * 397) ^ CohesionMean.GetHashCode(); + hashCode = (hashCode * 397) ^ CohesionDeviation.GetHashCode(); + hashCode = (hashCode * 397) ^ CohesionShift.GetHashCode(); + hashCode = (hashCode * 397) ^ FrictionAngleMean.GetHashCode(); + hashCode = (hashCode * 397) ^ FrictionAngleDeviation.GetHashCode(); + hashCode = (hashCode * 397) ^ FrictionAngleShift.GetHashCode(); + hashCode = (hashCode * 397) ^ ShearStrengthRatioMean.GetHashCode(); + hashCode = (hashCode * 397) ^ ShearStrengthRatioDeviation.GetHashCode(); + hashCode = (hashCode * 397) ^ ShearStrengthRatioShift.GetHashCode(); + hashCode = (hashCode * 397) ^ StrengthIncreaseExponentMean.GetHashCode(); + hashCode = (hashCode * 397) ^ StrengthIncreaseExponentDeviation.GetHashCode(); + hashCode = (hashCode * 397) ^ StrengthIncreaseExponentShift.GetHashCode(); + hashCode = (hashCode * 397) ^ PopMean.GetHashCode(); + hashCode = (hashCode * 397) ^ PopDeviation.GetHashCode(); + hashCode = (hashCode * 397) ^ PopShift.GetHashCode(); + return hashCode; + } + } + + private bool Equals(MacroStabilityInwardsSoilLayerProperties other) + { + return string.Equals(materialName, other.materialName, StringComparison.InvariantCulture) + && IsAquifer == other.IsAquifer + && Color.ToArgb().Equals(other.Color.ToArgb()) + && UsePop == other.UsePop + && ShearStrengthModel == other.ShearStrengthModel + && AbovePhreaticLevelMean.Equals(other.AbovePhreaticLevelMean) + && AbovePhreaticLevelDeviation.Equals(other.AbovePhreaticLevelDeviation) + && BelowPhreaticLevelMean.Equals(other.BelowPhreaticLevelMean) + && BelowPhreaticLevelDeviation.Equals(other.BelowPhreaticLevelDeviation) + && CohesionMean.Equals(other.CohesionMean) + && CohesionDeviation.Equals(other.CohesionDeviation) + && CohesionShift.Equals(other.CohesionShift) + && FrictionAngleMean.Equals(other.FrictionAngleMean) + && FrictionAngleDeviation.Equals(other.FrictionAngleDeviation) + && FrictionAngleShift.Equals(other.FrictionAngleShift) + && ShearStrengthRatioMean.Equals(other.ShearStrengthRatioMean) + && ShearStrengthRatioDeviation.Equals(other.ShearStrengthRatioDeviation) + && ShearStrengthRatioShift.Equals(other.ShearStrengthRatioShift) + && StrengthIncreaseExponentMean.Equals(other.StrengthIncreaseExponentMean) + && StrengthIncreaseExponentDeviation.Equals(other.StrengthIncreaseExponentDeviation) + && StrengthIncreaseExponentShift.Equals(other.StrengthIncreaseExponentShift) + && PopMean.Equals(other.PopMean) + && PopDeviation.Equals(other.PopDeviation) + && PopShift.Equals(other.PopShift); + } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/Ringtoets.MacroStabilityInwards.Primitives.csproj =================================================================== diff -u -r74be63b9f6ac8bc60a6754667a3bcee0485853a0 -rc85b5e367887a96d602dfb7a0b46073b6eef84da --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/Ringtoets.MacroStabilityInwards.Primitives.csproj (.../Ringtoets.MacroStabilityInwards.Primitives.csproj) (revision 74be63b9f6ac8bc60a6754667a3bcee0485853a0) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/Ringtoets.MacroStabilityInwards.Primitives.csproj (.../Ringtoets.MacroStabilityInwards.Primitives.csproj) (revision c85b5e367887a96d602dfb7a0b46073b6eef84da) @@ -56,7 +56,7 @@ - + Fisheye: Tag c85b5e367887a96d602dfb7a0b46073b6eef84da refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/SoilLayerProperties.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilProfile/MacroStabilityInwardsSoilLayerUnderSurfaceLineTest.cs =================================================================== diff -u -r78382ec129ddc7537096860680cef36f3796700d -rc85b5e367887a96d602dfb7a0b46073b6eef84da --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilProfile/MacroStabilityInwardsSoilLayerUnderSurfaceLineTest.cs (.../MacroStabilityInwardsSoilLayerUnderSurfaceLineTest.cs) (revision 78382ec129ddc7537096860680cef36f3796700d) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilProfile/MacroStabilityInwardsSoilLayerUnderSurfaceLineTest.cs (.../MacroStabilityInwardsSoilLayerUnderSurfaceLineTest.cs) (revision c85b5e367887a96d602dfb7a0b46073b6eef84da) @@ -36,7 +36,7 @@ public void Constructor_WithoutOuterRingWithHolesAndProperties_ThrowsArgumentNullException() { // Call - TestDelegate test = () => new MacroStabilityInwardsSoilLayerUnderSurfaceLine(null, Enumerable.Empty(), new SoilLayerProperties()); + TestDelegate test = () => new MacroStabilityInwardsSoilLayerUnderSurfaceLine(null, Enumerable.Empty(), new MacroStabilityInwardsSoilLayerProperties()); // Assert var exception = Assert.Throws(test); @@ -47,7 +47,7 @@ public void Constructor_WithoutHolesWithOuterRingAndProperties_ThrowsArgumentNullException() { // Call - TestDelegate test = () => new MacroStabilityInwardsSoilLayerUnderSurfaceLine(new Point2D[0], null, new SoilLayerProperties()); + TestDelegate test = () => new MacroStabilityInwardsSoilLayerUnderSurfaceLine(new Point2D[0], null, new MacroStabilityInwardsSoilLayerProperties()); // Assert var exception = Assert.Throws(test); @@ -69,7 +69,7 @@ public void Constructor_WithoutOuterRingWithProperties_ThrowsArgumentNullException() { // Call - TestDelegate test = () => new MacroStabilityInwardsSoilLayerUnderSurfaceLine(null, new SoilLayerProperties()); + TestDelegate test = () => new MacroStabilityInwardsSoilLayerUnderSurfaceLine(null, new MacroStabilityInwardsSoilLayerProperties()); // Assert var exception = Assert.Throws(test); @@ -93,7 +93,7 @@ // Call var outerRing = new Point2D[0]; IEnumerable holes = Enumerable.Empty(); - var properties = new SoilLayerProperties(); + var properties = new MacroStabilityInwardsSoilLayerProperties(); // Setup var layer = new MacroStabilityInwardsSoilLayerUnderSurfaceLine(outerRing, holes, properties); @@ -109,7 +109,7 @@ { // Call var outerRing = new Point2D[0]; - var properties = new SoilLayerProperties(); + var properties = new MacroStabilityInwardsSoilLayerProperties(); // Setup var layer = new MacroStabilityInwardsSoilLayerUnderSurfaceLine(outerRing, properties); Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PresentationObjects/MacroStabilityInwardsStochasticSoilModelCollectionContextTest.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PresentationObjects/MacroStabilityInwardsStochasticSoilModelCollectionContextTest.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PresentationObjects/MacroStabilityInwardsStochasticSoilModelCollectionContextTest.cs (revision c85b5e367887a96d602dfb7a0b46073b6eef84da) @@ -0,0 +1,90 @@ +// 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.Controls.PresentationObjects; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.MacroStabilityInwards.Data; +using Ringtoets.MacroStabilityInwards.Data.SoilProfile; +using Ringtoets.MacroStabilityInwards.Forms.PresentationObjects; + +namespace Ringtoets.MacroStabilityInwards.Forms.Test.PresentationObjects +{ + [TestFixture] + public class MacroStabilityInwardsStochasticSoilModelCollectionContextTest + { + [Test] + public void ParameteredConstructor_DefaultValues() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + var failureMechanism = new MacroStabilityInwardsFailureMechanism(); + + // Call + var context = new MacroStabilityInwardsStochasticSoilModelCollectionContext(failureMechanism.StochasticSoilModels, failureMechanism, assessmentSection); + + // Assert + Assert.IsInstanceOf>(context); + Assert.AreSame(failureMechanism.StochasticSoilModels, context.WrappedData); + Assert.AreSame(failureMechanism, context.FailureMechanism); + Assert.AreSame(assessmentSection, context.AssessmentSection); + mocks.VerifyAll(); + } + + [Test] + public void ParameteredConstructor_FailureMechanismNull_ThrowsArgumentNullException() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + var stochasticSoilModels = new MacroStabilityInwardsStochasticSoilModelCollection(); + + // Call + TestDelegate test = () => new MacroStabilityInwardsStochasticSoilModelCollectionContext(stochasticSoilModels, null, assessmentSection); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("failureMechanism", exception.ParamName); + mocks.VerifyAll(); + } + + [Test] + public void ParameteredConstructor_AssessmentSectionNull_ThrowsArgumentNullException() + { + // Setup + var failureMechanism = new MacroStabilityInwardsFailureMechanism(); + + // Call + TestDelegate test = () => new MacroStabilityInwardsStochasticSoilModelCollectionContext(failureMechanism.StochasticSoilModels, failureMechanism, null); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("assessmentSection", exception.ParamName); + } + } +} \ No newline at end of file Fisheye: Tag c85b5e367887a96d602dfb7a0b46073b6eef84da refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PresentationObjects/StochasticSoilModelCollectionContextTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsStochasticSoilModelCollectionPropertiesTest.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsStochasticSoilModelCollectionPropertiesTest.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsStochasticSoilModelCollectionPropertiesTest.cs (revision c85b5e367887a96d602dfb7a0b46073b6eef84da) @@ -0,0 +1,87 @@ +// 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 System.Linq; +using Core.Common.Gui.PropertyBag; +using Core.Common.TestUtil; +using NUnit.Framework; +using Ringtoets.MacroStabilityInwards.Data.SoilProfile; +using Ringtoets.MacroStabilityInwards.Forms.PropertyClasses; + +namespace Ringtoets.MacroStabilityInwards.Forms.Test.PropertyClasses +{ + [TestFixture] + public class MacroStabilityInwardsStochasticSoilModelCollectionPropertiesTest + { + [Test] + public void Constructor_WithoutCollection_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => new MacroStabilityInwardsStochasticSoilModelCollectionProperties(null); + + // Assert + string paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("collection", paramName); + } + + [Test] + public void Constructor_WithData_ReturnExpectedValues() + { + // Setup + const string someFilePath = "location/to/a/file"; + var collection = new MacroStabilityInwardsStochasticSoilModelCollection(); + collection.AddRange(Enumerable.Empty(), someFilePath); + + // Call + var properties = new MacroStabilityInwardsStochasticSoilModelCollectionProperties(collection); + + // Assert + Assert.IsInstanceOf>(properties); + Assert.AreSame(collection, properties.Data); + Assert.AreEqual(someFilePath, properties.SourcePath); + } + + [Test] + public void Constructor_WithData_PropertiesHaveExpectedAttributesValues() + { + // Setup + var collection = new MacroStabilityInwardsStochasticSoilModelCollection(); + + // Call + var properties = new MacroStabilityInwardsStochasticSoilModelCollectionProperties(collection); + + // Assert + PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); + Assert.AreEqual(1, dynamicProperties.Count); + + PropertyDescriptor stochasticSoilModelSourcePathProperty = dynamicProperties[0]; + Assert.IsNotNull(stochasticSoilModelSourcePathProperty); + Assert.IsTrue(stochasticSoilModelSourcePathProperty.IsReadOnly); + Assert.AreEqual("Algemeen", stochasticSoilModelSourcePathProperty.Category); + Assert.AreEqual("Bronlocatie", stochasticSoilModelSourcePathProperty.DisplayName); + Assert.AreEqual( + "De locatie van het bestand waaruit de stochastische ondergrondmodellen zijn geïmporteerd.", + stochasticSoilModelSourcePathProperty.Description); + } + } +} \ No newline at end of file Fisheye: Tag c85b5e367887a96d602dfb7a0b46073b6eef84da refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/StochasticSoilModelCollectionPropertiesTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Ringtoets.MacroStabilityInwards.Forms.Test.csproj =================================================================== diff -u -r7b513e5e4b0d15ba13e161b4c5a2e1097f58b8fd -rc85b5e367887a96d602dfb7a0b46073b6eef84da --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Ringtoets.MacroStabilityInwards.Forms.Test.csproj (.../Ringtoets.MacroStabilityInwards.Forms.Test.csproj) (revision 7b513e5e4b0d15ba13e161b4c5a2e1097f58b8fd) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Ringtoets.MacroStabilityInwards.Forms.Test.csproj (.../Ringtoets.MacroStabilityInwards.Forms.Test.csproj) (revision c85b5e367887a96d602dfb7a0b46073b6eef84da) @@ -67,7 +67,7 @@ - + @@ -79,7 +79,7 @@ - + Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/SoilProfiles/MacroStabilityInwardsSoilLayerTransformerTest.cs =================================================================== diff -u -re46922a39166f62578f01b338db68a820a5fd448 -rc85b5e367887a96d602dfb7a0b46073b6eef84da --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/SoilProfiles/MacroStabilityInwardsSoilLayerTransformerTest.cs (.../MacroStabilityInwardsSoilLayerTransformerTest.cs) (revision e46922a39166f62578f01b338db68a820a5fd448) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/SoilProfiles/MacroStabilityInwardsSoilLayerTransformerTest.cs (.../MacroStabilityInwardsSoilLayerTransformerTest.cs) (revision c85b5e367887a96d602dfb7a0b46073b6eef84da) @@ -105,7 +105,7 @@ // Assert Assert.AreEqual(top, soilLayer1D.Top); - SoilLayerProperties properties = soilLayer1D.Properties; + MacroStabilityInwardsSoilLayerProperties properties = soilLayer1D.Properties; Assert.AreEqual(isAquifer, properties.IsAquifer); Assert.AreEqual(materialName, properties.MaterialName); Assert.AreEqual(color, properties.Color); @@ -220,7 +220,7 @@ MacroStabilityInwardsSoilLayer2D soilLayer2D = MacroStabilityInwardsSoilLayerTransformer.Transform(layer); // Assert - SoilLayerProperties properties = soilLayer2D.Properties; + MacroStabilityInwardsSoilLayerProperties properties = soilLayer2D.Properties; Assert.AreEqual(isAquifer, properties.IsAquifer); Assert.AreEqual(materialName, properties.MaterialName); Assert.AreEqual(color, properties.Color); Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/ImportInfos/MacroStabilityInwardsStochasticSoilModelCollectionContextImportInfoTest.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/ImportInfos/MacroStabilityInwardsStochasticSoilModelCollectionContextImportInfoTest.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/ImportInfos/MacroStabilityInwardsStochasticSoilModelCollectionContextImportInfoTest.cs (revision c85b5e367887a96d602dfb7a0b46073b6eef84da) @@ -0,0 +1,245 @@ +// 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.Drawing; +using System.Linq; +using Core.Common.Base.IO; +using Core.Common.Gui; +using Core.Common.Gui.Forms.MainWindow; +using Core.Common.Gui.Plugin; +using Core.Common.TestUtil; +using Core.Common.Utils; +using NUnit.Extensions.Forms; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.IO.SoilProfile; +using Ringtoets.MacroStabilityInwards.Data; +using Ringtoets.MacroStabilityInwards.Data.SoilProfile; +using Ringtoets.MacroStabilityInwards.Forms.PresentationObjects; +using Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil; +using FormsResources = Ringtoets.MacroStabilityInwards.Forms.Properties.Resources; + +namespace Ringtoets.MacroStabilityInwards.Plugin.Test.ImportInfos +{ + [TestFixture] + public class MacroStabilityInwardsStochasticSoilModelCollectionContextImportInfoTest : NUnitFormTest + { + private ImportInfo importInfo; + private MacroStabilityInwardsPlugin plugin; + + [Test] + public void Name_Always_ReturnExpectedName() + { + // Call + string name = importInfo.Name; + + // Assert + Assert.AreEqual("Stochastische ondergrondmodellen", name); + } + + [Test] + public void Category_Always_ReturnExpectedCategory() + { + // Call + string category = importInfo.Category; + + // Assert + Assert.AreEqual("Algemeen", category); + } + + [Test] + public void Image_Always_ReturnExpectedIcon() + { + // Call + Image image = importInfo.Image; + + // Assert + TestHelper.AssertImagesAreEqual(FormsResources.SoilProfileIcon, image); + } + + [Test] + public void IsEnabled_ReferenceLineNull_ReturnFalse() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + var failureMechanism = new MacroStabilityInwardsFailureMechanism(); + + var context = new MacroStabilityInwardsStochasticSoilModelCollectionContext(failureMechanism.StochasticSoilModels, failureMechanism, assessmentSection); + + // Call + bool isEnabled = importInfo.IsEnabled(context); + + // Assert + Assert.IsFalse(isEnabled); + mocks.VerifyAll(); + } + + [Test] + public void IsEnabled_ReferenceLineSet_ReturnTrue() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + assessmentSection.ReferenceLine = new ReferenceLine(); + + var failureMechanism = new MacroStabilityInwardsFailureMechanism(); + + var context = new MacroStabilityInwardsStochasticSoilModelCollectionContext(failureMechanism.StochasticSoilModels, failureMechanism, assessmentSection); + + // Call + bool isEnabled = importInfo.IsEnabled(context); + + // Assert + Assert.IsTrue(isEnabled); + mocks.VerifyAll(); + } + + [Test] + public void FileFilterGenerator_Always_ReturnExpectedFileFilter() + { + // Call + FileFilterGenerator fileFilterGenerator = importInfo.FileFilterGenerator; + + // Assert + Assert.AreEqual("D-Soil Model bestand (*.soil)|*.soil", fileFilterGenerator.Filter); + } + + [Test] + public void VerifyUpdates_CalculationWithoutOutputs_ReturnsTrue() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + + var mainWindow = mocks.Stub(); + var gui = mocks.Stub(); + gui.Stub(g => g.MainWindow).Return(mainWindow); + mocks.ReplayAll(); + + plugin.Gui = gui; + + var failureMechanism = new MacroStabilityInwardsFailureMechanism(); + failureMechanism.CalculationsGroup.Children.Add(new MacroStabilityInwardsCalculationScenario()); + + var stochasticSoilModelCollection = new MacroStabilityInwardsStochasticSoilModelCollection(); + var context = new MacroStabilityInwardsStochasticSoilModelCollectionContext(stochasticSoilModelCollection, failureMechanism, assessmentSection); + + // Call + bool updatesVerified = importInfo.VerifyUpdates(context); + + // Assert + Assert.IsTrue(updatesVerified); + mocks.VerifyAll(); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void VerifyUpdates_CalculationWithOutputs_AlwaysReturnsExpectedInquiryMessage(bool isActionConfirmed) + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + + var mainWindow = mocks.Stub(); + var gui = mocks.Stub(); + gui.Stub(g => g.MainWindow).Return(mainWindow); + mocks.ReplayAll(); + + plugin.Gui = gui; + + var failureMechanism = new MacroStabilityInwardsFailureMechanism(); + var calculationWithOutput = new MacroStabilityInwardsCalculationScenario + { + Output = new TestMacroStabilityInwardsOutput() + }; + failureMechanism.CalculationsGroup.Children.Add(calculationWithOutput); + + var stochasticSoilModelCollection = new MacroStabilityInwardsStochasticSoilModelCollection(); + var context = new MacroStabilityInwardsStochasticSoilModelCollectionContext(stochasticSoilModelCollection, failureMechanism, assessmentSection); + + string textBoxMessage = null; + DialogBoxHandler = (name, wnd) => + { + var helper = new MessageBoxTester(wnd); + textBoxMessage = helper.Text; + + if (isActionConfirmed) + { + helper.ClickOk(); + } + else + { + helper.ClickCancel(); + } + }; + + // Call + bool updatesVerified = importInfo.VerifyUpdates(context); + + // Assert + string expectedInquiryMessage = "Als u stochastische ondergrondmodellen importeert, " + + "dan worden alle rekenresultaten van dit toetsspoor verwijderd." + + $"{Environment.NewLine}{Environment.NewLine}Weet u zeker dat u wilt doorgaan?"; + Assert.AreEqual(expectedInquiryMessage, textBoxMessage); + Assert.AreEqual(isActionConfirmed, updatesVerified); + mocks.VerifyAll(); + } + + [Test] + public void CreateFileImporter_Always_ReturnFileImporter() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + var failureMechanism = new MacroStabilityInwardsFailureMechanism(); + + var importTarget = new MacroStabilityInwardsStochasticSoilModelCollectionContext(failureMechanism.StochasticSoilModels, failureMechanism, assessmentSection); + + // Call + IFileImporter importer = importInfo.CreateFileImporter(importTarget, ""); + + // Assert + Assert.IsInstanceOf>(importer); + mocks.VerifyAll(); + } + + public override void Setup() + { + plugin = new MacroStabilityInwardsPlugin(); + importInfo = plugin.GetImportInfos().First(i => i.DataType == typeof(MacroStabilityInwardsStochasticSoilModelCollectionContext)); + } + + public override void TearDown() + { + plugin.Dispose(); + } + } +} \ No newline at end of file Fisheye: Tag c85b5e367887a96d602dfb7a0b46073b6eef84da refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/ImportInfos/StochasticSoilModelCollectionContextImportInfoTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/MacroStabilityInwardsPluginTest.cs =================================================================== diff -u -r7b513e5e4b0d15ba13e161b4c5a2e1097f58b8fd -rc85b5e367887a96d602dfb7a0b46073b6eef84da --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/MacroStabilityInwardsPluginTest.cs (.../MacroStabilityInwardsPluginTest.cs) (revision 7b513e5e4b0d15ba13e161b4c5a2e1097f58b8fd) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/MacroStabilityInwardsPluginTest.cs (.../MacroStabilityInwardsPluginTest.cs) (revision c85b5e367887a96d602dfb7a0b46073b6eef84da) @@ -89,8 +89,8 @@ PluginTestHelper.AssertPropertyInfoDefined( propertyInfos, - typeof(StochasticSoilModelCollectionContext), - typeof(StochasticSoilModelCollectionProperties)); + typeof(MacroStabilityInwardsStochasticSoilModelCollectionContext), + typeof(MacroStabilityInwardsStochasticSoilModelCollectionProperties)); PluginTestHelper.AssertPropertyInfoDefined( propertyInfos, @@ -117,7 +117,7 @@ Assert.AreEqual(13, treeNodeInfos.Length); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(MacroStabilityInwardsSurfaceLinesContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(MacroStabilityInwardsSurfaceLine))); - Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(StochasticSoilModelCollectionContext))); + Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(MacroStabilityInwardsStochasticSoilModelCollectionContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(MacroStabilityInwardsStochasticSoilModel))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(MacroStabilityInwardsStochasticSoilProfile))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(MacroStabilityInwardsCalculationScenarioContext))); @@ -186,7 +186,7 @@ // Assert Assert.AreEqual(2, updateInfos.Length); Assert.AreEqual(1, updateInfos.Count(updateInfo => updateInfo.DataType == typeof(MacroStabilityInwardsSurfaceLinesContext))); - Assert.AreEqual(1, updateInfos.Count(updateInfo => updateInfo.DataType == typeof(StochasticSoilModelCollectionContext))); + Assert.AreEqual(1, updateInfos.Count(updateInfo => updateInfo.DataType == typeof(MacroStabilityInwardsStochasticSoilModelCollectionContext))); } } @@ -202,7 +202,7 @@ // Assert Assert.AreEqual(3, importInfos.Length); Assert.IsTrue(importInfos.Any(i => i.DataType == typeof(MacroStabilityInwardsSurfaceLinesContext))); - Assert.IsTrue(importInfos.Any(i => i.DataType == typeof(StochasticSoilModelCollectionContext))); + Assert.IsTrue(importInfos.Any(i => i.DataType == typeof(MacroStabilityInwardsStochasticSoilModelCollectionContext))); Assert.IsTrue(importInfos.Any(i => i.DataType == typeof(MacroStabilityInwardsCalculationGroupContext))); } } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/PropertyInfos/MacroStabilityInwardsStochasticSoilModelCollectionContextPropertyInfoTest.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/PropertyInfos/MacroStabilityInwardsStochasticSoilModelCollectionContextPropertyInfoTest.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/PropertyInfos/MacroStabilityInwardsStochasticSoilModelCollectionContextPropertyInfoTest.cs (revision c85b5e367887a96d602dfb7a0b46073b6eef84da) @@ -0,0 +1,85 @@ +// 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.Linq; +using Core.Common.Gui.Plugin; +using Core.Common.Gui.PropertyBag; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.MacroStabilityInwards.Data; +using Ringtoets.MacroStabilityInwards.Data.SoilProfile; +using Ringtoets.MacroStabilityInwards.Forms.PresentationObjects; +using Ringtoets.MacroStabilityInwards.Forms.PropertyClasses; + +namespace Ringtoets.MacroStabilityInwards.Plugin.Test.PropertyInfos +{ + [TestFixture] + public class MacroStabilityInwardsStochasticSoilModelCollectionContextPropertyInfoTest + { + private MacroStabilityInwardsPlugin plugin; + private PropertyInfo info; + + [SetUp] + public void SetUp() + { + plugin = new MacroStabilityInwardsPlugin(); + info = plugin.GetPropertyInfos().First(tni => tni.PropertyObjectType == typeof(MacroStabilityInwardsStochasticSoilModelCollectionProperties)); + } + + [TearDown] + public void TearDown() + { + plugin.Dispose(); + } + + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Assert + Assert.AreEqual(typeof(MacroStabilityInwardsStochasticSoilModelCollectionContext), info.DataType); + Assert.AreEqual(typeof(MacroStabilityInwardsStochasticSoilModelCollectionProperties), info.PropertyObjectType); + } + + [Test] + public void CreateInstance_Always_NewPropertiesWithInputContextAsData() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + var failureMechanism = new MacroStabilityInwardsFailureMechanism(); + + var collection = new MacroStabilityInwardsStochasticSoilModelCollection(); + var context = new MacroStabilityInwardsStochasticSoilModelCollectionContext(collection, failureMechanism, assessmentSection); + + // Call + IObjectProperties objectProperties = info.CreateInstance(context); + + // Assert + Assert.IsInstanceOf(objectProperties); + Assert.AreSame(collection, objectProperties.Data); + + mocks.VerifyAll(); + } + } +} \ No newline at end of file Fisheye: Tag c85b5e367887a96d602dfb7a0b46073b6eef84da refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/PropertyInfos/StochasticSoilModelCollectionContextPropertyInfoTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/Ringtoets.MacroStabilityInwards.Plugin.Test.csproj =================================================================== diff -u -r41ae2ae5761506a2e5e51266b382c3c73354f3cb -rc85b5e367887a96d602dfb7a0b46073b6eef84da --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/Ringtoets.MacroStabilityInwards.Plugin.Test.csproj (.../Ringtoets.MacroStabilityInwards.Plugin.Test.csproj) (revision 41ae2ae5761506a2e5e51266b382c3c73354f3cb) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/Ringtoets.MacroStabilityInwards.Plugin.Test.csproj (.../Ringtoets.MacroStabilityInwards.Plugin.Test.csproj) (revision c85b5e367887a96d602dfb7a0b46073b6eef84da) @@ -75,13 +75,13 @@ - + - + @@ -94,11 +94,11 @@ - - - + + + - + Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/MacroStabilityInwardsFailureMechanismContextTreeNodeInfoTest.cs =================================================================== diff -u -rd619624819b7200ac55b357b0a0c54d198fc20e4 -rc85b5e367887a96d602dfb7a0b46073b6eef84da --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/MacroStabilityInwardsFailureMechanismContextTreeNodeInfoTest.cs (.../MacroStabilityInwardsFailureMechanismContextTreeNodeInfoTest.cs) (revision d619624819b7200ac55b357b0a0c54d198fc20e4) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/MacroStabilityInwardsFailureMechanismContextTreeNodeInfoTest.cs (.../MacroStabilityInwardsFailureMechanismContextTreeNodeInfoTest.cs) (revision c85b5e367887a96d602dfb7a0b46073b6eef84da) @@ -152,7 +152,7 @@ Assert.AreSame(failureMechanism, surfaceLinesContext.FailureMechanism); Assert.AreSame(assessmentSection, surfaceLinesContext.AssessmentSection); - var stochasticSoilModelContext = (StochasticSoilModelCollectionContext) inputsFolder.Contents[2]; + var stochasticSoilModelContext = (MacroStabilityInwardsStochasticSoilModelCollectionContext) inputsFolder.Contents[2]; Assert.AreSame(failureMechanism, stochasticSoilModelContext.FailureMechanism); Assert.AreSame(failureMechanism, stochasticSoilModelContext.FailureMechanism); Assert.AreSame(assessmentSection, stochasticSoilModelContext.AssessmentSection); Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/MacroStabilityInwardsStochasticSoilModelCollectionContextTreeNodeInfoTest.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/MacroStabilityInwardsStochasticSoilModelCollectionContextTreeNodeInfoTest.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/MacroStabilityInwardsStochasticSoilModelCollectionContextTreeNodeInfoTest.cs (revision c85b5e367887a96d602dfb7a0b46073b6eef84da) @@ -0,0 +1,259 @@ +// 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.Collections.Generic; +using System.Drawing; +using System.Linq; +using Core.Common.Controls.TreeView; +using Core.Common.Gui; +using Core.Common.Gui.ContextMenu; +using Core.Common.TestUtil; +using NUnit.Extensions.Forms; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.MacroStabilityInwards.Data; +using Ringtoets.MacroStabilityInwards.Data.SoilProfile; +using Ringtoets.MacroStabilityInwards.Forms.PresentationObjects; +using Ringtoets.MacroStabilityInwards.Primitives; +using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; + +namespace Ringtoets.MacroStabilityInwards.Plugin.Test.TreeNodeInfos +{ + [TestFixture] + public class MacroStabilityInwardsStochasticSoilModelCollectionContextTreeNodeInfoTest : NUnitFormTest + { + private MockRepository mocks; + private MacroStabilityInwardsPlugin plugin; + private TreeNodeInfo info; + + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Setup + mocks.ReplayAll(); + + // Assert + Assert.IsNotNull(info.Text); + Assert.IsNotNull(info.ForeColor); + Assert.IsNotNull(info.Image); + Assert.IsNotNull(info.ContextMenuStrip); + Assert.IsNull(info.EnsureVisibleOnCreate); + Assert.IsNull(info.ExpandOnCreate); + Assert.IsNotNull(info.ChildNodeObjects); + Assert.IsNull(info.CanRename); + Assert.IsNull(info.OnNodeRenamed); + Assert.IsNull(info.CanRemove); + Assert.IsNull(info.OnNodeRemoved); + Assert.IsNull(info.CanCheck); + Assert.IsNull(info.IsChecked); + Assert.IsNull(info.OnNodeChecked); + Assert.IsNull(info.CanDrag); + Assert.IsNull(info.CanDrop); + Assert.IsNull(info.CanInsert); + Assert.IsNull(info.OnDrop); + } + + [Test] + public void Text_Always_ReturnsTextFromResource() + { + // Setup + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + var failureMechanism = new MacroStabilityInwardsFailureMechanism(); + + var stochasticSoilModelCollectionContext = new MacroStabilityInwardsStochasticSoilModelCollectionContext( + failureMechanism.StochasticSoilModels, + failureMechanism, + assessmentSection); + + // Call + string text = info.Text(stochasticSoilModelCollectionContext); + + // Assert + Assert.AreEqual("Stochastische ondergrondmodellen", text); + } + + [Test] + public void Image_Always_ReturnsSetImage() + { + // Setup + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + var failureMechanism = new MacroStabilityInwardsFailureMechanism(); + + var stochasticSoilModelCollectionContext = new MacroStabilityInwardsStochasticSoilModelCollectionContext( + failureMechanism.StochasticSoilModels, + failureMechanism, + assessmentSection); + + // Call + Image image = info.Image(stochasticSoilModelCollectionContext); + + // Assert + TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.GeneralFolderIcon, image); + } + + [Test] + public void ForeColor_CollectionWithoutSoilProfiles_ReturnsGrayText() + { + // Setup + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + var failureMechanism = new MacroStabilityInwardsFailureMechanism(); + + var stochasticSoilModelCollectionContext = new MacroStabilityInwardsStochasticSoilModelCollectionContext( + failureMechanism.StochasticSoilModels, + failureMechanism, + assessmentSection); + + // Call + Color foreColor = info.ForeColor(stochasticSoilModelCollectionContext); + + // Assert + Assert.AreEqual(Color.FromKnownColor(KnownColor.GrayText), foreColor); + } + + [Test] + public void ForeColor_CollectionWithSoilProfiles_ReturnsControlText() + { + // Setup + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + var failureMechanism = new MacroStabilityInwardsFailureMechanism(); + failureMechanism.StochasticSoilModels.AddRange(new[] + { + new MacroStabilityInwardsStochasticSoilModel("Name") + }, "path"); + + var stochasticSoilModelCollectionContext = new MacroStabilityInwardsStochasticSoilModelCollectionContext( + failureMechanism.StochasticSoilModels, + failureMechanism, + assessmentSection); + + // Call + Color foreColor = info.ForeColor(stochasticSoilModelCollectionContext); + + // Assert + Assert.AreEqual(Color.FromKnownColor(KnownColor.ControlText), foreColor); + } + + [Test] + public void ChildNodeObjects_Always_ReturnsChildrenOfData() + { + // Setup + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + var soilProfile1 = new MacroStabilityInwardsSoilProfile1D("soilProfile1", 0, new List + { + new MacroStabilityInwardsSoilLayer1D(10) + }); + var soilProfile2 = new MacroStabilityInwardsSoilProfile1D("soilProfile2", 0, new List + { + new MacroStabilityInwardsSoilLayer1D(10) + }); + var stochasticSoilProfile1 = new MacroStabilityInwardsStochasticSoilProfile(1.0, soilProfile1); + var stochasticSoilProfile2 = new MacroStabilityInwardsStochasticSoilProfile(1.0, soilProfile2); + + var stochasticSoilModel = new MacroStabilityInwardsStochasticSoilModel("Name"); + stochasticSoilModel.StochasticSoilProfiles.Add(stochasticSoilProfile1); + stochasticSoilModel.StochasticSoilProfiles.Add(stochasticSoilProfile2); + + var failureMechanism = new MacroStabilityInwardsFailureMechanism(); + var stochasticSoilModelCollectionContext = new MacroStabilityInwardsStochasticSoilModelCollectionContext( + failureMechanism.StochasticSoilModels, + failureMechanism, + assessmentSection); + failureMechanism.StochasticSoilModels.AddRange(new[] + { + stochasticSoilModel + }, "path"); + + // Call + object[] objects = info.ChildNodeObjects(stochasticSoilModelCollectionContext); + + // Assert + CollectionAssert.AreEqual(new[] + { + stochasticSoilModel + }, objects); + } + + [Test] + public void ContextMenuStrip_Always_CallsBuilder() + { + // Setup + var assessmentSection = mocks.Stub(); + + var menuBuilder = mocks.StrictMock(); + using (mocks.Ordered()) + { + menuBuilder.Expect(mb => mb.AddImportItem()).Return(menuBuilder); + menuBuilder.Expect(mb => mb.AddUpdateItem()).Return(menuBuilder); + menuBuilder.Expect(mb => mb.AddSeparator()).Return(menuBuilder); + menuBuilder.Expect(mb => mb.AddCollapseAllItem()).Return(menuBuilder); + menuBuilder.Expect(mb => mb.AddExpandAllItem()).Return(menuBuilder); + menuBuilder.Expect(mb => mb.AddSeparator()).Return(menuBuilder); + menuBuilder.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilder); + menuBuilder.Expect(mb => mb.Build()).Return(null); + } + + using (var treeViewControl = new TreeViewControl()) + { + var context = new MacroStabilityInwardsStochasticSoilModelCollectionContext( + new MacroStabilityInwardsStochasticSoilModelCollection(), + new MacroStabilityInwardsFailureMechanism(), + assessmentSection); + var gui = mocks.Stub(); + + gui.Stub(g => g.Get(context, treeViewControl)).Return(menuBuilder); + mocks.ReplayAll(); + + plugin.Gui = gui; + + // Call + info.ContextMenuStrip(context, null, treeViewControl); + } + // Assert + // Assert expectancies are called in TearDown() + } + + public override void Setup() + { + mocks = new MockRepository(); + plugin = new MacroStabilityInwardsPlugin(); + info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(MacroStabilityInwardsStochasticSoilModelCollectionContext)); + } + + public override void TearDown() + { + plugin.Dispose(); + mocks.VerifyAll(); + + base.TearDown(); + } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/MacroStabilityInwardsStochasticSoilModelTreeNodeInfoTest.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/MacroStabilityInwardsStochasticSoilModelTreeNodeInfoTest.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/MacroStabilityInwardsStochasticSoilModelTreeNodeInfoTest.cs (revision c85b5e367887a96d602dfb7a0b46073b6eef84da) @@ -0,0 +1,173 @@ +// 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.Collections.Generic; +using System.Drawing; +using System.Linq; +using Core.Common.Controls.TreeView; +using Core.Common.Gui; +using Core.Common.Gui.ContextMenu; +using Core.Common.TestUtil; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.MacroStabilityInwards.Data.SoilProfile; +using Ringtoets.MacroStabilityInwards.Primitives; +using FormsResources = Ringtoets.MacroStabilityInwards.Forms.Properties.Resources; + +namespace Ringtoets.MacroStabilityInwards.Plugin.Test.TreeNodeInfos +{ + [TestFixture] + public class MacroStabilityInwardsStochasticSoilModelTreeNodeInfoTest + { + private MacroStabilityInwardsPlugin plugin; + private TreeNodeInfo info; + + [SetUp] + public void SetUp() + { + plugin = new MacroStabilityInwardsPlugin(); + info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(MacroStabilityInwardsStochasticSoilModel)); + } + + [TearDown] + public void TearDown() + { + plugin.Dispose(); + } + + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Assert + Assert.IsNotNull(info.Text); + Assert.IsNull(info.ForeColor); + Assert.IsNotNull(info.Image); + Assert.IsNotNull(info.ContextMenuStrip); + Assert.IsNull(info.EnsureVisibleOnCreate); + Assert.IsNull(info.ExpandOnCreate); + Assert.IsNotNull(info.ChildNodeObjects); + Assert.IsNull(info.CanRename); + Assert.IsNull(info.OnNodeRenamed); + Assert.IsNull(info.CanRemove); + Assert.IsNull(info.OnNodeRemoved); + Assert.IsNull(info.CanCheck); + Assert.IsNull(info.IsChecked); + Assert.IsNull(info.OnNodeChecked); + Assert.IsNull(info.CanDrag); + Assert.IsNull(info.CanDrop); + Assert.IsNull(info.CanInsert); + Assert.IsNull(info.OnDrop); + } + + [Test] + public void Text_Always_ReturnsTextFromResource() + { + // Setup + const string name = "test test 123"; + var model = new MacroStabilityInwardsStochasticSoilModel(name); + + // Call + string text = info.Text(model); + + // Assert + Assert.AreEqual(name, text); + } + + [Test] + public void Image_Always_ReturnsSetImage() + { + // Setup + var model = new MacroStabilityInwardsStochasticSoilModel("A"); + + // Call + Image image = info.Image(model); + + // Assert + TestHelper.AssertImagesAreEqual(FormsResources.StochasticSoilModelIcon, image); + } + + [Test] + public void ChildNodeObjects_Always_ReturnsChildrenOfData() + { + // Setup + var stochasticSoilProfile1 = new MacroStabilityInwardsStochasticSoilProfile( + 1.0, + new MacroStabilityInwardsSoilProfile1D("soilProfile1", 0, new List + { + new MacroStabilityInwardsSoilLayer1D(10) + })); + var stochasticSoilProfile2 = new MacroStabilityInwardsStochasticSoilProfile( + 1.0, + new MacroStabilityInwardsSoilProfile1D("soilProfile2", 0, new List + { + new MacroStabilityInwardsSoilLayer1D(10) + })); + + var stochasticSoilModel = new MacroStabilityInwardsStochasticSoilModel("Name"); + stochasticSoilModel.StochasticSoilProfiles.Add(stochasticSoilProfile1); + stochasticSoilModel.StochasticSoilProfiles.Add(stochasticSoilProfile2); + + // Call + object[] objects = info.ChildNodeObjects(stochasticSoilModel); + + // Assert + var expectedChildren = new[] + { + stochasticSoilProfile1, + stochasticSoilProfile2 + }; + CollectionAssert.AreEqual(expectedChildren, objects); + } + + [Test] + public void ContextMenuStrip_Always_CallsBuilder() + { + // Setup + var model = new MacroStabilityInwardsStochasticSoilModel("A"); + + var mocks = new MockRepository(); + + var menuBuilder = mocks.StrictMock(); + using (mocks.Ordered()) + { + menuBuilder.Expect(mb => mb.AddCollapseAllItem()).Return(menuBuilder); + menuBuilder.Expect(mb => mb.AddExpandAllItem()).Return(menuBuilder); + menuBuilder.Expect(mb => mb.AddSeparator()).Return(menuBuilder); + menuBuilder.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilder); + menuBuilder.Expect(mb => mb.Build()).Return(null); + } + + using (var treeViewControl = new TreeViewControl()) + { + var gui = mocks.Stub(); + gui.Stub(g => g.Get(model, treeViewControl)).Return(menuBuilder); + mocks.ReplayAll(); + + plugin.Gui = gui; + + // Call + info.ContextMenuStrip(model, null, treeViewControl); + } + // Assert + mocks.VerifyAll(); + } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/MacroStabilityInwardsStochasticSoilProfileTreeNodeInfoTest.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/MacroStabilityInwardsStochasticSoilProfileTreeNodeInfoTest.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/MacroStabilityInwardsStochasticSoilProfileTreeNodeInfoTest.cs (revision c85b5e367887a96d602dfb7a0b46073b6eef84da) @@ -0,0 +1,142 @@ +// 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.Drawing; +using System.Linq; +using Core.Common.Controls.TreeView; +using Core.Common.Gui; +using Core.Common.Gui.ContextMenu; +using Core.Common.TestUtil; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.MacroStabilityInwards.Data.SoilProfile; +using Ringtoets.MacroStabilityInwards.Forms.Properties; +using Ringtoets.MacroStabilityInwards.Primitives; + +namespace Ringtoets.MacroStabilityInwards.Plugin.Test.TreeNodeInfos +{ + [TestFixture] + public class MacroStabilityInwardsStochasticSoilProfileTreeNodeInfoTest + { + private MacroStabilityInwardsPlugin plugin; + private TreeNodeInfo info; + + [SetUp] + public void SetUp() + { + plugin = new MacroStabilityInwardsPlugin(); + info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(MacroStabilityInwardsStochasticSoilProfile)); + } + + [TearDown] + public void TearDown() + { + plugin.Dispose(); + } + + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Assert + Assert.IsNotNull(info.Text); + Assert.IsNull(info.ForeColor); + Assert.IsNotNull(info.Image); + Assert.IsNotNull(info.ContextMenuStrip); + Assert.IsNull(info.EnsureVisibleOnCreate); + Assert.IsNull(info.ExpandOnCreate); + Assert.IsNull(info.ChildNodeObjects); + Assert.IsNull(info.CanRename); + Assert.IsNull(info.OnNodeRenamed); + Assert.IsNull(info.CanRemove); + Assert.IsNull(info.OnNodeRemoved); + Assert.IsNull(info.CanCheck); + Assert.IsNull(info.IsChecked); + Assert.IsNull(info.OnNodeChecked); + Assert.IsNull(info.CanDrag); + Assert.IsNull(info.CanDrop); + Assert.IsNull(info.CanInsert); + Assert.IsNull(info.OnDrop); + } + + [Test] + public void Text_Always_ReturnsName() + { + // Setup + const string testName = "ttt"; + + var stochasticSoilProfile = new MacroStabilityInwardsStochasticSoilProfile( + 0.1, + new MacroStabilityInwardsSoilProfile1D(testName, 0, new[] + { + new MacroStabilityInwardsSoilLayer1D(10) + })); + + // Call + string text = info.Text(stochasticSoilProfile); + + // Assert + Assert.AreEqual(testName, text); + } + + [Test] + public void Image_Always_ReturnsSetImage() + { + // Setup + var stochasticSoilProfile = new MacroStabilityInwardsStochasticSoilProfile( + 0.1, + new MacroStabilityInwardsSoilProfile1D("", 0, new[] + { + new MacroStabilityInwardsSoilLayer1D(10) + })); + + // Call + Image image = info.Image(stochasticSoilProfile); + + // Assert + TestHelper.AssertImagesAreEqual(Resources.SoilProfileIcon, image); + } + + [Test] + public void ContextMenuStrip_Always_CallsBuilder() + { + // Setup + var mocks = new MockRepository(); + var menuBuilder = mocks.StrictMock(); + + menuBuilder.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilder); + menuBuilder.Expect(mb => mb.Build()).Return(null); + + using (var treeViewControl = new TreeViewControl()) + { + var gui = mocks.Stub(); + gui.Stub(g => g.Get(null, treeViewControl)).Return(menuBuilder); + mocks.ReplayAll(); + + plugin.Gui = gui; + + // Call + info.ContextMenuStrip(null, null, treeViewControl); + } + // Assert + mocks.VerifyAll(); + } + } +} \ No newline at end of file Fisheye: Tag c85b5e367887a96d602dfb7a0b46073b6eef84da refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/StochasticSoilModelCollectionContextTreeNodeInfoTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c85b5e367887a96d602dfb7a0b46073b6eef84da refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/StochasticSoilModelTreeNodeInfoTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c85b5e367887a96d602dfb7a0b46073b6eef84da refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/StochasticSoilProfileTreeNodeInfoTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/UpdateInfos/MacroStabilityInwardsStochasticSoilModelCollectionContextUpdateInfoTest.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/UpdateInfos/MacroStabilityInwardsStochasticSoilModelCollectionContextUpdateInfoTest.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/UpdateInfos/MacroStabilityInwardsStochasticSoilModelCollectionContextUpdateInfoTest.cs (revision c85b5e367887a96d602dfb7a0b46073b6eef84da) @@ -0,0 +1,274 @@ +// 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.Drawing; +using System.Linq; +using Core.Common.Base.IO; +using Core.Common.Gui; +using Core.Common.Gui.Forms.MainWindow; +using Core.Common.Gui.Plugin; +using Core.Common.TestUtil; +using Core.Common.Utils; +using NUnit.Extensions.Forms; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.IO.SoilProfile; +using Ringtoets.MacroStabilityInwards.Data; +using Ringtoets.MacroStabilityInwards.Data.SoilProfile; +using Ringtoets.MacroStabilityInwards.Data.TestUtil; +using Ringtoets.MacroStabilityInwards.Forms.PresentationObjects; +using Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil; +using FormsResources = Ringtoets.MacroStabilityInwards.Forms.Properties.Resources; + +namespace Ringtoets.MacroStabilityInwards.Plugin.Test.UpdateInfos +{ + [TestFixture] + public class MacroStabilityInwardsStochasticSoilModelCollectionContextUpdateInfoTest : NUnitFormTest + { + private UpdateInfo updateInfo; + private MacroStabilityInwardsPlugin plugin; + + [Test] + public void Name_Always_ReturnExpectedName() + { + // Call + string name = updateInfo.Name; + + // Assert + Assert.AreEqual("Stochastische ondergrondmodellen", name); + } + + [Test] + public void Category_Always_ReturnExpectedCategory() + { + // Call + string category = updateInfo.Category; + + // Assert + Assert.AreEqual("Algemeen", category); + } + + [Test] + public void Image_Always_ReturnExpectedIcon() + { + // Call + Image image = updateInfo.Image; + + // Assert + TestHelper.AssertImagesAreEqual(FormsResources.SoilProfileIcon, image); + } + + [Test] + public void IsEnabled_SoilModelCollectionSourcePathNull_ReturnFalse() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + var failureMechanism = new MacroStabilityInwardsFailureMechanism(); + var stochasticSoilModel = new MacroStabilityInwardsStochasticSoilModelCollection(); + + var context = new MacroStabilityInwardsStochasticSoilModelCollectionContext(stochasticSoilModel, failureMechanism, assessmentSection); + + // Call + bool isEnabled = updateInfo.IsEnabled(context); + + // Assert + Assert.IsFalse(isEnabled); + mocks.VerifyAll(); + } + + [Test] + public void IsEnabled_SoilModelCollectionSourcePathSet_ReturnTrue() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + var failureMechanism = new MacroStabilityInwardsFailureMechanism(); + var stochasticSoilModel = new MacroStabilityInwardsStochasticSoilModelCollection(); + stochasticSoilModel.AddRange(Enumerable.Empty(), "some/path"); + + var context = new MacroStabilityInwardsStochasticSoilModelCollectionContext(stochasticSoilModel, failureMechanism, assessmentSection); + + // Call + bool isEnabled = updateInfo.IsEnabled(context); + + // Assert + Assert.IsTrue(isEnabled); + mocks.VerifyAll(); + } + + [Test] + public void FileFilterGenerator_Always_ReturnExpectedFileFilter() + { + // Call + FileFilterGenerator fileFilterGenerator = updateInfo.FileFilterGenerator; + + // Assert + Assert.AreEqual("D-Soil Model bestand (*.soil)|*.soil", fileFilterGenerator.Filter); + } + + [Test] + public void VerifyUpdates_CalculationWithoutOutputs_ReturnsTrue() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + + var mainWindow = mocks.Stub(); + var gui = mocks.Stub(); + gui.Stub(g => g.MainWindow).Return(mainWindow); + mocks.ReplayAll(); + + plugin.Gui = gui; + + var failureMechanism = new MacroStabilityInwardsFailureMechanism(); + failureMechanism.CalculationsGroup.Children.Add(new MacroStabilityInwardsCalculationScenario()); + + var stochasticSoilModelCollection = new MacroStabilityInwardsStochasticSoilModelCollection(); + var context = new MacroStabilityInwardsStochasticSoilModelCollectionContext(stochasticSoilModelCollection, failureMechanism, assessmentSection); + + // Call + bool updatesVerified = updateInfo.VerifyUpdates(context); + + // Assert + Assert.IsTrue(updatesVerified); + mocks.VerifyAll(); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void VerifyUpdates_CalculationWithOutputs_AlwaysReturnsExpectedInquiryMessage(bool isActionConfirmed) + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + + var mainWindow = mocks.Stub(); + var gui = mocks.Stub(); + gui.Stub(g => g.MainWindow).Return(mainWindow); + mocks.ReplayAll(); + + plugin.Gui = gui; + + var failureMechanism = new MacroStabilityInwardsFailureMechanism(); + var calculationWithOutput = new MacroStabilityInwardsCalculationScenario + { + Output = new TestMacroStabilityInwardsOutput() + }; + failureMechanism.CalculationsGroup.Children.Add(calculationWithOutput); + + var stochasticSoilModelCollection = new MacroStabilityInwardsStochasticSoilModelCollection(); + var context = new MacroStabilityInwardsStochasticSoilModelCollectionContext(stochasticSoilModelCollection, failureMechanism, assessmentSection); + + string textBoxMessage = null; + DialogBoxHandler = (name, wnd) => + { + var helper = new MessageBoxTester(wnd); + textBoxMessage = helper.Text; + + if (isActionConfirmed) + { + helper.ClickOk(); + } + else + { + helper.ClickCancel(); + } + }; + + // Call + bool updatesVerified = updateInfo.VerifyUpdates(context); + + // Assert + string expectedInquiryMessage = "Als ondergrondschematisaties wijzigen door het bijwerken, " + + "dan worden de resultaten van berekeningen die deze ondergrondschematisaties gebruiken " + + $"verwijderd.{Environment.NewLine}{Environment.NewLine}Weet u zeker dat u wilt doorgaan?"; + Assert.AreEqual(expectedInquiryMessage, textBoxMessage); + Assert.AreEqual(isActionConfirmed, updatesVerified); + mocks.VerifyAll(); + } + + [Test] + public void CurrentPath_StochasticSoilModelCollectionHasPathSet_ReturnsExpectedPath() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + const string expectedFilePath = "some/path"; + var stochasticSoilModelCollection = new MacroStabilityInwardsStochasticSoilModelCollection(); + stochasticSoilModelCollection.AddRange(new[] + { + new TestStochasticSoilModel() + }, expectedFilePath); + + var failureMechanism = new MacroStabilityInwardsFailureMechanism(); + + var context = new MacroStabilityInwardsStochasticSoilModelCollectionContext(stochasticSoilModelCollection, failureMechanism, assessmentSection); + + // Call + string currentPath = updateInfo.CurrentPath(context); + + // Assert + Assert.AreEqual(expectedFilePath, currentPath); + mocks.VerifyAll(); + } + + [Test] + public void CreateFileImporter_Always_ReturnFileImporter() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + var failureMechanism = new MacroStabilityInwardsFailureMechanism(); + + var importTarget = new MacroStabilityInwardsStochasticSoilModelCollectionContext(failureMechanism.StochasticSoilModels, failureMechanism, assessmentSection); + + // Call + IFileImporter importer = updateInfo.CreateFileImporter(importTarget, ""); + + // Assert + Assert.IsInstanceOf>(importer); + mocks.VerifyAll(); + } + + public override void Setup() + { + plugin = new MacroStabilityInwardsPlugin(); + updateInfo = plugin.GetUpdateInfos().First(i => i.DataType == typeof(MacroStabilityInwardsStochasticSoilModelCollectionContext)); + } + + public override void TearDown() + { + plugin.Dispose(); + } + } +} \ No newline at end of file Fisheye: Tag c85b5e367887a96d602dfb7a0b46073b6eef84da refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/UpdateInfos/StochasticSoilModelCollectionContextUpdateInfoTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/MacroStabilityInwardsSoilLayerPropertiesTest.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/MacroStabilityInwardsSoilLayerPropertiesTest.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/MacroStabilityInwardsSoilLayerPropertiesTest.cs (revision c85b5e367887a96d602dfb7a0b46073b6eef84da) @@ -0,0 +1,274 @@ +// 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.Collections.Generic; +using System.Drawing; +using System.Linq; +using Core.Common.TestUtil; +using NUnit.Framework; + +namespace Ringtoets.MacroStabilityInwards.Primitives.Test +{ + [TestFixture] + public class MacroStabilityInwardsSoilLayerPropertiesTest + { + [Test] + public void DefaultConstructor_DefaultValuesSet() + { + // Call + var properties = new MacroStabilityInwardsSoilLayerProperties(); + + // Assert + Assert.IsFalse(properties.IsAquifer); + Assert.IsEmpty(properties.MaterialName); + Assert.AreEqual(Color.Empty, properties.Color); + + Assert.IsFalse(properties.UsePop); + Assert.AreEqual(MacroStabilityInwardsShearStrengthModel.None, properties.ShearStrengthModel); + + Assert.IsNaN(properties.AbovePhreaticLevelMean); + Assert.IsNaN(properties.AbovePhreaticLevelDeviation); + + Assert.IsNaN(properties.BelowPhreaticLevelMean); + Assert.IsNaN(properties.BelowPhreaticLevelDeviation); + + Assert.IsNaN(properties.CohesionMean); + Assert.IsNaN(properties.CohesionDeviation); + Assert.IsNaN(properties.CohesionShift); + + Assert.IsNaN(properties.FrictionAngleMean); + Assert.IsNaN(properties.FrictionAngleDeviation); + Assert.IsNaN(properties.FrictionAngleShift); + + Assert.IsNaN(properties.ShearStrengthRatioMean); + Assert.IsNaN(properties.ShearStrengthRatioDeviation); + Assert.IsNaN(properties.ShearStrengthRatioShift); + + Assert.IsNaN(properties.StrengthIncreaseExponentMean); + Assert.IsNaN(properties.StrengthIncreaseExponentDeviation); + Assert.IsNaN(properties.StrengthIncreaseExponentShift); + + Assert.IsNaN(properties.PopMean); + Assert.IsNaN(properties.PopDeviation); + Assert.IsNaN(properties.PopShift); + } + + [Test] + public void MaterialName_Null_ThrowsArgumentNullException() + { + // Setup + var layer = new MacroStabilityInwardsSoilLayerProperties(); + + // Call + TestDelegate test = () => layer.MaterialName = null; + + // Assert + string paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("value", paramName); + } + + [Test] + [TestCase("")] + [TestCase("A name")] + public void MaterialName_NotNullValue_ValueSet(string materialName) + { + // Setup + var layer = new MacroStabilityInwardsSoilLayerProperties(); + + // Call + layer.MaterialName = materialName; + + // Assert + Assert.AreEqual(materialName, layer.MaterialName); + } + + [Test] + public void GetHashCode_EqualProperties_AreEqual() + { + // Setup + MacroStabilityInwardsSoilLayerProperties propertiesA = CreateRandomProperties(21); + MacroStabilityInwardsSoilLayerProperties propertiesB = CreateRandomProperties(21); + + // Precondition + Assert.AreEqual(propertiesA, propertiesB); + Assert.AreEqual(propertiesB, propertiesA); + + // Call & Assert + Assert.AreEqual(propertiesA.GetHashCode(), propertiesB.GetHashCode()); + Assert.AreEqual(propertiesB.GetHashCode(), propertiesA.GetHashCode()); + } + + [Test] + public void Equals_DifferentType_ReturnsFalse() + { + // Setup + MacroStabilityInwardsSoilLayerProperties layer = CreateRandomProperties(21); + + // Call + bool areEqual = layer.Equals(new object()); + + // Assert + Assert.IsFalse(areEqual); + } + + [Test] + public void Equals_Null_ReturnsFalse() + { + // Setup + MacroStabilityInwardsSoilLayerProperties layer = CreateRandomProperties(21); + + // Call + bool areEqual = layer.Equals(null); + + // Assert + Assert.IsFalse(areEqual); + } + + [Test] + [TestCaseSource(nameof(ChangeSingleProperties))] + public void Equals_ChangeSingleProperty_ReturnsFalse(Action changeProperty) + { + // Setup + MacroStabilityInwardsSoilLayerProperties layer = CreateRandomProperties(21); + MacroStabilityInwardsSoilLayerProperties layerToChange = CreateRandomProperties(21); + + changeProperty(layerToChange); + + // Call + bool areEqualOne = layer.Equals(layerToChange); + bool areEqualTwo = layerToChange.Equals(layer); + + // Assert + Assert.IsFalse(areEqualOne); + Assert.IsFalse(areEqualTwo); + } + + [Test] + [TestCaseSource(nameof(PropertiesCombinations))] + public void Equals_DifferentScenarios_ReturnsExpectedResult(MacroStabilityInwardsSoilLayerProperties layer, MacroStabilityInwardsSoilLayerProperties otherLayer, bool expectedEqual) + { + // Call + bool areEqualOne = layer.Equals(otherLayer); + bool areEqualTwo = otherLayer.Equals(layer); + + // Assert + Assert.AreEqual(expectedEqual, areEqualOne); + Assert.AreEqual(expectedEqual, areEqualTwo); + } + + private static IEnumerable ChangeSingleProperties() + { + yield return new TestCaseData(new Action(lp => lp.ShearStrengthModel = (MacroStabilityInwardsShearStrengthModel) 9)); + yield return new TestCaseData(new Action(lp => lp.MaterialName = "interesting")); + yield return new TestCaseData(new Action(lp => lp.IsAquifer = !lp.IsAquifer)); + yield return new TestCaseData(new Action(lp => lp.UsePop = !lp.UsePop)); + yield return new TestCaseData(new Action(lp => lp.Color = lp.Color.ToArgb().Equals(Color.Aqua.ToArgb()) ? Color.Bisque : Color.Aqua)); + yield return new TestCaseData(new Action(lp => lp.AbovePhreaticLevelMean = 1.0 - lp.AbovePhreaticLevelMean)); + yield return new TestCaseData(new Action(lp => lp.AbovePhreaticLevelDeviation = 1.0 - lp.AbovePhreaticLevelDeviation)); + yield return new TestCaseData(new Action(lp => lp.BelowPhreaticLevelMean = 1.0 - lp.BelowPhreaticLevelMean)); + yield return new TestCaseData(new Action(lp => lp.BelowPhreaticLevelDeviation = 1.0 - lp.BelowPhreaticLevelDeviation)); + yield return new TestCaseData(new Action(lp => lp.CohesionMean = 1.0 - lp.CohesionMean)); + yield return new TestCaseData(new Action(lp => lp.CohesionDeviation = 1.0 - lp.CohesionDeviation)); + yield return new TestCaseData(new Action(lp => lp.CohesionShift = 1.0 - lp.CohesionShift)); + yield return new TestCaseData(new Action(lp => lp.FrictionAngleMean = 1.0 - lp.FrictionAngleMean)); + yield return new TestCaseData(new Action(lp => lp.FrictionAngleDeviation = 1.0 - lp.FrictionAngleDeviation)); + yield return new TestCaseData(new Action(lp => lp.FrictionAngleShift = 1.0 - lp.FrictionAngleShift)); + yield return new TestCaseData(new Action(lp => lp.ShearStrengthRatioMean = 1.0 - lp.ShearStrengthRatioMean)); + yield return new TestCaseData(new Action(lp => lp.ShearStrengthRatioDeviation = 1.0 - lp.ShearStrengthRatioDeviation)); + yield return new TestCaseData(new Action(lp => lp.ShearStrengthRatioShift = 1.0 - lp.ShearStrengthRatioShift)); + yield return new TestCaseData(new Action(lp => lp.StrengthIncreaseExponentMean = 1.0 - lp.StrengthIncreaseExponentMean)); + yield return new TestCaseData(new Action(lp => lp.StrengthIncreaseExponentDeviation = 1.0 - lp.StrengthIncreaseExponentDeviation)); + yield return new TestCaseData(new Action(lp => lp.StrengthIncreaseExponentShift = 1.0 - lp.StrengthIncreaseExponentShift)); + yield return new TestCaseData(new Action(lp => lp.PopMean = 1.0 - lp.PopMean)); + yield return new TestCaseData(new Action(lp => lp.PopDeviation = 1.0 - lp.PopDeviation)); + yield return new TestCaseData(new Action(lp => lp.PopShift = 1.0 - lp.PopShift)); + } + + private static TestCaseData[] PropertiesCombinations() + { + MacroStabilityInwardsSoilLayerProperties propertiesA = CreateRandomProperties(21); + MacroStabilityInwardsSoilLayerProperties propertiesB = CreateRandomProperties(21); + MacroStabilityInwardsSoilLayerProperties propertiesC = CreateRandomProperties(73); + MacroStabilityInwardsSoilLayerProperties propertiesD = CreateRandomProperties(21); + + return new[] + { + new TestCaseData(propertiesA, propertiesA, true) + { + TestName = "Equals_LayerALayerA_True" + }, + new TestCaseData(propertiesA, propertiesB, true) + { + TestName = "Equals_LayerALayerB_True" + }, + new TestCaseData(propertiesB, propertiesD, true) + { + TestName = "Equals_LayerBLayerD_True" + }, + new TestCaseData(propertiesA, propertiesD, true) + { + TestName = "Equals_LayerALayerD_True" + }, + new TestCaseData(propertiesB, propertiesC, false) + { + TestName = "Equals_LayerBLayerC_False" + }, + new TestCaseData(propertiesA, propertiesC, false) + { + TestName = "Equals_LayerALayerC_False" + } + }; + } + + private static MacroStabilityInwardsSoilLayerProperties CreateRandomProperties(int randomSeed) + { + var random = new Random(randomSeed); + return new MacroStabilityInwardsSoilLayerProperties + { + MaterialName = string.Join("", Enumerable.Repeat('x', random.Next(0, 40))), + Color = Color.FromKnownColor(random.NextEnumValue()), + IsAquifer = random.NextBoolean(), + UsePop = random.NextBoolean(), + ShearStrengthModel = random.NextEnumValue(), + AbovePhreaticLevelMean = random.NextDouble(), + AbovePhreaticLevelDeviation = random.NextDouble(), + BelowPhreaticLevelMean = random.NextDouble(), + BelowPhreaticLevelDeviation = random.NextDouble(), + CohesionMean = random.NextDouble(), + CohesionDeviation = random.NextDouble(), + CohesionShift = random.NextDouble(), + FrictionAngleMean = random.NextDouble(), + FrictionAngleDeviation = random.NextDouble(), + FrictionAngleShift = random.NextDouble(), + ShearStrengthRatioMean = random.NextDouble(), + ShearStrengthRatioDeviation = random.NextDouble(), + ShearStrengthRatioShift = random.NextDouble(), + StrengthIncreaseExponentMean = random.NextDouble(), + StrengthIncreaseExponentDeviation = random.NextDouble(), + StrengthIncreaseExponentShift = random.NextDouble(), + PopMean = random.NextDouble(), + PopDeviation = random.NextDouble(), + PopShift = random.NextDouble() + }; + } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/Ringtoets.MacroStabilityInwards.Primitives.Test.csproj =================================================================== diff -u -r7b7bd75dc1c1327386c9be96b5d480565bb8ecd6 -rc85b5e367887a96d602dfb7a0b46073b6eef84da --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/Ringtoets.MacroStabilityInwards.Primitives.Test.csproj (.../Ringtoets.MacroStabilityInwards.Primitives.Test.csproj) (revision 7b7bd75dc1c1327386c9be96b5d480565bb8ecd6) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/Ringtoets.MacroStabilityInwards.Primitives.Test.csproj (.../Ringtoets.MacroStabilityInwards.Primitives.Test.csproj) (revision c85b5e367887a96d602dfb7a0b46073b6eef84da) @@ -60,7 +60,7 @@ - + Fisheye: Tag c85b5e367887a96d602dfb7a0b46073b6eef84da refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/SoilLayerPropertiesTest.cs'. Fisheye: No comparison available. Pass `N' to diff?