Index: Core/Common/test/Core.Common.TestUtil.Test/TestHelperTest.cs =================================================================== diff -u -r564a695798dd77c0b90bba14c902c6caefb7786f -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Core/Common/test/Core.Common.TestUtil.Test/TestHelperTest.cs (.../TestHelperTest.cs) (revision 564a695798dd77c0b90bba14c902c6caefb7786f) +++ Core/Common/test/Core.Common.TestUtil.Test/TestHelperTest.cs (.../TestHelperTest.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -24,6 +24,7 @@ using System.ComponentModel; using System.Drawing; using System.IO; +using System.Linq; using System.Security.AccessControl; using System.Windows.Forms; using Core.Common.TestUtil.Test.Properties; @@ -1084,24 +1085,12 @@ public void AssertCollectionsAreEqual_ExpectedCollectionNull_ThrowsException() { // Setup - var objectA = new object(); - var objectB = new object(); - var objectC = new object(); - var objectD = new object(); - var mocks = new MockRepository(); var comparer = mocks.Stub>(); mocks.ReplayAll(); // Call - TestDelegate test = () => TestHelper.AssertCollectionsAreEqual(null, - new[] - { - objectA, - objectB, - objectC, - objectD - }, comparer); + TestDelegate test = () => TestHelper.AssertCollectionsAreEqual(null, Enumerable.Empty(), comparer); // Assert Assert.Throws(test); @@ -1112,23 +1101,12 @@ public void AssertCollectionsAreEqual_ActualCollectionNull_ThrowsException() { // Setup - var objectA = new object(); - var objectB = new object(); - var objectC = new object(); - var objectD = new object(); - var mocks = new MockRepository(); var comparer = mocks.Stub>(); mocks.ReplayAll(); // Call - TestDelegate test = () => TestHelper.AssertCollectionsAreEqual(new[] - { - objectA, - objectB, - objectC, - objectD - }, null, comparer); + TestDelegate test = () => TestHelper.AssertCollectionsAreEqual(Enumerable.Empty(), null, comparer); // Assert Assert.Throws(test); Index: Core/Common/test/Core.Common.TestUtil/TestHelper.cs =================================================================== diff -u -r564a695798dd77c0b90bba14c902c6caefb7786f -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Core/Common/test/Core.Common.TestUtil/TestHelper.cs (.../TestHelper.cs) (revision 564a695798dd77c0b90bba14c902c6caefb7786f) +++ Core/Common/test/Core.Common.TestUtil/TestHelper.cs (.../TestHelper.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -494,6 +494,7 @@ /// and are equal. /// Thrown when either: /// + /// Any parameter is null. /// has more or less elements than ; /// contains an element at a position that is not equal to the /// element in at that position. Index: Core/Common/test/Core.Common.Utils.Test/FileFilterGeneratorTest.cs =================================================================== diff -u -rfc6082ddc5f58833e31d6b824ef078e22730e834 -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Core/Common/test/Core.Common.Utils.Test/FileFilterGeneratorTest.cs (.../FileFilterGeneratorTest.cs) (revision fc6082ddc5f58833e31d6b824ef078e22730e834) +++ Core/Common/test/Core.Common.Utils.Test/FileFilterGeneratorTest.cs (.../FileFilterGeneratorTest.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -131,7 +131,7 @@ } [Test] - public void Equals_DiffentType_ReturnsFalse() + public void Equals_DifferentType_ReturnsFalse() { // Setup var generator = new FileFilterGenerator("txt", "descriptionA"); Index: Ringtoets/Common/src/Ringtoets.Common.Data/DikeProfiles/DikeProfile.cs =================================================================== diff -u -rec27d9f02dc27c2829ed45788fae7d5923d63d3d -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/Common/src/Ringtoets.Common.Data/DikeProfiles/DikeProfile.cs (.../DikeProfile.cs) (revision ec27d9f02dc27c2829ed45788fae7d5923d63d3d) +++ Ringtoets/Common/src/Ringtoets.Common.Data/DikeProfiles/DikeProfile.cs (.../DikeProfile.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -219,7 +219,7 @@ return true; } var other = obj as DikeProfile; - return other != null && Equals((DikeProfile) obj); + return other != null && Equals(other); } public override int GetHashCode() Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/WindDirectionClosingSituationTest.cs =================================================================== diff -u -r342ecb50ef0e54c04002a2643689c6d0108518c7 -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/WindDirectionClosingSituationTest.cs (.../WindDirectionClosingSituationTest.cs) (revision 342ecb50ef0e54c04002a2643689c6d0108518c7) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/WindDirectionClosingSituationTest.cs (.../WindDirectionClosingSituationTest.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -81,7 +81,7 @@ } [Test] - public void Equals_DiffentType_ReturnsFalse() + public void Equals_DifferentType_ReturnsFalse() { // Setup var instance = new WindDirectionClosingSituation(new TestWindDirection(), string.Empty); Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/WindDirectionTest.cs =================================================================== diff -u -r66a40e718fdf95596f8897d81af4a1a0144cfae4 -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/WindDirectionTest.cs (.../WindDirectionTest.cs) (revision 66a40e718fdf95596f8897d81af4a1a0144cfae4) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/WindDirectionTest.cs (.../WindDirectionTest.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -78,7 +78,7 @@ } [Test] - public void Equals_DiffentType_ReturnsFalse() + public void Equals_DifferentType_ReturnsFalse() { // Setup const string windDirectionName = "SSE"; Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/Ringtoets.MacroStabilityInwards.Data.csproj =================================================================== diff -u -rcd90ebf744fb74f0d4b0dd6ee06f9c39b5faf213 -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/Ringtoets.MacroStabilityInwards.Data.csproj (.../Ringtoets.MacroStabilityInwards.Data.csproj) (revision cd90ebf744fb74f0d4b0dd6ee06f9c39b5faf213) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/Ringtoets.MacroStabilityInwards.Data.csproj (.../Ringtoets.MacroStabilityInwards.Data.csproj) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -57,6 +57,8 @@ + + Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilLayerUnderSurfaceLine.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilLayerUnderSurfaceLine.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilLayerUnderSurfaceLine.cs (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -0,0 +1,83 @@ +// 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.Linq; +using Core.Common.Base.Geometry; +using Ringtoets.MacroStabilityInwards.Primitives; + +namespace Ringtoets.MacroStabilityInwards.Data +{ + /// + /// A 2D soil layer that has been adapted by using a surface line. + /// + public class SoilLayerUnderSurfaceLine + { + /// + /// Creates a new instance of . + /// + /// The outer ring of the geometry of the soil layer. + /// The properties of the soil layer. + public SoilLayerUnderSurfaceLine(Point2D[] outerRing, SoilLayerProperties properties) + : this(outerRing, Enumerable.Empty(), properties) {} + + /// + /// Creates a new instance of . + /// + /// The outer ring of the geometry of the soil layer. + /// The holes of the geometry of the soil layer. + /// The properties of the soil layer. + public SoilLayerUnderSurfaceLine(Point2D[] outerRing, IEnumerable holes, SoilLayerProperties properties) + { + if (outerRing == null) + { + throw new ArgumentNullException(nameof(outerRing)); + } + if (holes == null) + { + throw new ArgumentNullException(nameof(holes)); + } + if (properties == null) + { + throw new ArgumentNullException(nameof(properties)); + } + OuterRing = outerRing; + Holes = holes; + Properties = properties; + } + + /// + /// Gets the outer ring of the geometry. + /// + public Point2D[] OuterRing { get; } + + /// + /// Gets the holes of the geometry. + /// + public IEnumerable Holes { get; } + + /// + /// Gets the properties of the soil layer. + /// + public SoilLayerProperties Properties { get; } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfileUnderSurfaceLine.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfileUnderSurfaceLine.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfileUnderSurfaceLine.cs (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -0,0 +1,50 @@ +// 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; + +namespace Ringtoets.MacroStabilityInwards.Data +{ + /// + /// A soil profile for which it's soil layers have been adapted using a surface line. + /// + public class SoilProfileUnderSurfaceLine + { + /// + /// Creates a new instance of . + /// + /// The layers in the profile. + public SoilProfileUnderSurfaceLine(IEnumerable layersUnderSurfaceLine) + { + if (layersUnderSurfaceLine == null) + { + throw new ArgumentNullException(nameof(layersUnderSurfaceLine)); + } + LayersUnderSurfaceLine = layersUnderSurfaceLine; + } + + /// + /// Gets the layers in the profile. + /// + public IEnumerable LayersUnderSurfaceLine { get; } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfileUnderSurfaceLineFactory.cs =================================================================== diff -u -rcd90ebf744fb74f0d4b0dd6ee06f9c39b5faf213 -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfileUnderSurfaceLineFactory.cs (.../SoilProfileUnderSurfaceLineFactory.cs) (revision cd90ebf744fb74f0d4b0dd6ee06f9c39b5faf213) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfileUnderSurfaceLineFactory.cs (.../SoilProfileUnderSurfaceLineFactory.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -41,6 +41,7 @@ /// The surface line for which determines the top of the . /// A new containing geometries from the /// under the . + /// Thrown when any parameter is null. public static SoilProfileUnderSurfaceLine Create(MacroStabilityInwardsSoilProfile1D soilProfile, MacroStabilityInwardsSurfaceLine surfaceLine) { if (soilProfile == null) @@ -54,7 +55,12 @@ Point2D[] localizedSurfaceLine = surfaceLine.LocalGeometry.ToArray(); IEnumerable surfaceLineGeometry = CreateSurfaceLineAreaToDepth(localizedSurfaceLine, soilProfile.Bottom); - IEnumerable layerGeometries = soilProfile.Layers.Select(l => As2DGeometry(l, soilProfile, localizedSurfaceLine.First().X, localizedSurfaceLine.Last().X)); + IEnumerable layerGeometries = soilProfile.Layers.Select( + layer => As2DGeometry( + layer, + soilProfile, + localizedSurfaceLine.First().X, + localizedSurfaceLine.Last().X)); return GeometriesToIntersections(layerGeometries, surfaceLineGeometry); } @@ -65,19 +71,20 @@ /// The soil profile containing layers. /// A new containing geometries from the /// . + /// Thrown when is null. public static SoilProfileUnderSurfaceLine Create(MacroStabilityInwardsSoilProfile2D soilProfile) { if (soilProfile == null) { throw new ArgumentNullException(nameof(soilProfile)); } - IList layersUnderSurfaceLine = new List(); + IEnumerable layersUnderSurfaceLine = soilProfile.Layers.Select( + layer => new SoilLayerUnderSurfaceLine( + RingToPoints(layer.OuterRing), + layer.Holes.Select(RingToPoints), + layer.Properties)); - foreach (var layer in soilProfile.Layers) - { - layersUnderSurfaceLine.Add(new SoilLayerUnderSurfaceLine(RingToPoints(layer.OuterRing), layer.Holes.Select(RingToPoints), layer.Properties)); - } return new SoilProfileUnderSurfaceLine(layersUnderSurfaceLine); } @@ -106,7 +113,7 @@ private static TempSoilLayerGeometry As2DGeometry(MacroStabilityInwardsSoilLayer1D layer, MacroStabilityInwardsSoilProfile1D soilProfile, double minX, double maxX) { double top = layer.Top; - double bottom = layer.Top - soilProfile.GetLayerThickness(layer); + double bottom = top - soilProfile.GetLayerThickness(layer); return new TempSoilLayerGeometry(new[] { @@ -152,47 +159,4 @@ public IEnumerable InnerLoops { get; } } } - - public class SoilProfileUnderSurfaceLine - { - public SoilProfileUnderSurfaceLine(IEnumerable layersUnderSurfaceLine) - { - if (layersUnderSurfaceLine == null) - { - throw new ArgumentNullException(nameof(layersUnderSurfaceLine)); - } - LayersUnderSurfaceLine = layersUnderSurfaceLine; - } - - public IEnumerable LayersUnderSurfaceLine { get; } - } - - public class SoilLayerUnderSurfaceLine - { - public SoilLayerUnderSurfaceLine(Point2D[] outerRing, SoilLayerProperties properties) - : this(outerRing, Enumerable.Empty(), properties) {} - - public SoilLayerUnderSurfaceLine(Point2D[] outerRing, IEnumerable holes, SoilLayerProperties properties) - { - if (outerRing == null) - { - throw new ArgumentNullException(nameof(outerRing)); - } - if (holes == null) - { - throw new ArgumentNullException(nameof(holes)); - } - if (properties == null) - { - throw new ArgumentNullException(nameof(properties)); - } - OuterRing = outerRing; - Holes = holes; - Properties = properties; - } - - public Point2D[] OuterRing { get; } - public IEnumerable Holes { get; } - public SoilLayerProperties Properties { get; } - } } \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/StochasticSoilModel.cs =================================================================== diff -u -r564a695798dd77c0b90bba14c902c6caefb7786f -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/StochasticSoilModel.cs (.../StochasticSoilModel.cs) (revision 564a695798dd77c0b90bba14c902c6caefb7786f) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/StochasticSoilModel.cs (.../StochasticSoilModel.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -38,8 +38,14 @@ /// Creates a new instance of . /// /// Name of the segment soil model. + /// Thrown when is + /// null. public StochasticSoilModel(string name) { + if (name == null) + { + throw new ArgumentNullException(nameof(name)); + } Name = name; Geometry = new List(); StochasticSoilProfiles = new List(); Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Factories/MacroStabilityInwardsChartDataFactory.cs =================================================================== diff -u -rf52eb6e887fbc44ce5fc439e6b2c289c903987b4 -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Factories/MacroStabilityInwardsChartDataFactory.cs (.../MacroStabilityInwardsChartDataFactory.cs) (revision f52eb6e887fbc44ce5fc439e6b2c289c903987b4) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Factories/MacroStabilityInwardsChartDataFactory.cs (.../MacroStabilityInwardsChartDataFactory.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -148,10 +148,10 @@ MacroStabilityInwardsSoilLayer1D soilLayer = soilProfile.Layers.ElementAt(soilLayerIndex); - return new ChartMultipleAreaData($"{soilLayerIndex + 1} {soilLayer.MaterialName}", + return new ChartMultipleAreaData($"{soilLayerIndex + 1} {soilLayer.Properties.MaterialName}", new ChartAreaStyle { - FillColor = soilLayer.Color, + FillColor = soilLayer.Properties.Color, StrokeColor = Color.Black, StrokeThickness = 1 }); Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsSoilLayerTable.cs =================================================================== diff -u -rd47809e3a8fadff2be5b10056b79b16dc27eeca2 -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsSoilLayerTable.cs (.../MacroStabilityInwardsSoilLayerTable.cs) (revision d47809e3a8fadff2be5b10056b79b16dc27eeca2) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsSoilLayerTable.cs (.../MacroStabilityInwardsSoilLayerTable.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -66,9 +66,9 @@ public FormattedMacroStabilityInwardsSoilLayerRow(MacroStabilityInwardsSoilLayer1D layer) { Top = new RoundedDouble(2, layer.Top); - MaterialName = layer.MaterialName; - Color = layer.Color; - IsAquifer = layer.IsAquifer; + MaterialName = layer.Properties.MaterialName; + Color = layer.Properties.Color; + IsAquifer = layer.Properties.IsAquifer; } /// Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/Builders/SoilLayer1D.cs =================================================================== diff -u -rd47809e3a8fadff2be5b10056b79b16dc27eeca2 -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/Builders/SoilLayer1D.cs (.../SoilLayer1D.cs) (revision d47809e3a8fadff2be5b10056b79b16dc27eeca2) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/Builders/SoilLayer1D.cs (.../SoilLayer1D.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -50,9 +50,12 @@ { return new MacroStabilityInwardsSoilLayer1D(Top) { - IsAquifer = IsAquifer.HasValue && IsAquifer.Value.Equals(1.0), - MaterialName = MaterialName ?? string.Empty, - Color = SoilLayerColorConversionHelper.ColorFromNullableDouble(Color) + Properties = + { + IsAquifer = IsAquifer.HasValue && IsAquifer.Value.Equals(1.0), + MaterialName = MaterialName ?? string.Empty, + Color = SoilLayerColorConversionHelper.ColorFromNullableDouble(Color) + } }; } } Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/Builders/SoilLayer2D.cs =================================================================== diff -u -rd47809e3a8fadff2be5b10056b79b16dc27eeca2 -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/Builders/SoilLayer2D.cs (.../SoilLayer2D.cs) (revision d47809e3a8fadff2be5b10056b79b16dc27eeca2) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/Builders/SoilLayer2D.cs (.../SoilLayer2D.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -124,9 +124,12 @@ { var soilLayer = new MacroStabilityInwardsSoilLayer1D(height) { - IsAquifer = IsAquifer.HasValue && IsAquifer.Value.Equals(1.0), - MaterialName = MaterialName ?? string.Empty, - Color = SoilLayerColorConversionHelper.ColorFromNullableDouble(Color) + Properties = + { + IsAquifer = IsAquifer.HasValue && IsAquifer.Value.Equals(1.0), + MaterialName = MaterialName ?? string.Empty, + Color = SoilLayerColorConversionHelper.ColorFromNullableDouble(Color) + } }; result.Add(soilLayer); Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/MacroStabilityInwardsCalculatorInput.cs =================================================================== diff -u -rcd90ebf744fb74f0d4b0dd6ee06f9c39b5faf213 -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/MacroStabilityInwardsCalculatorInput.cs (.../MacroStabilityInwardsCalculatorInput.cs) (revision cd90ebf744fb74f0d4b0dd6ee06f9c39b5faf213) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/MacroStabilityInwardsCalculatorInput.cs (.../MacroStabilityInwardsCalculatorInput.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -44,7 +44,7 @@ } AssessmentLevel = properties.AssessmentLevel; SurfaceLine = properties.SurfaceLine; - SoilProfile = properties.SoilProfile as MacroStabilityInwardsSoilProfile1D; + SoilProfile = properties.SoilProfile; } public class ConstructionProperties @@ -94,9 +94,9 @@ public MacroStabilityInwardsSurfaceLine SurfaceLine { get; private set; } /// - /// Gets the profile which contains a 1 dimensional definition of soil layers with properties. + /// Gets the profile which contains a definition of soil layers with properties. /// - public MacroStabilityInwardsSoilProfile1D SoilProfile { get; private set; } + public ISoilProfile SoilProfile { get; private set; } #endregion } Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/MacroStabilityInwardsSoilLayer1D.cs =================================================================== diff -u -rec27d9f02dc27c2829ed45788fae7d5923d63d3d -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/MacroStabilityInwardsSoilLayer1D.cs (.../MacroStabilityInwardsSoilLayer1D.cs) (revision ec27d9f02dc27c2829ed45788fae7d5923d63d3d) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/MacroStabilityInwardsSoilLayer1D.cs (.../MacroStabilityInwardsSoilLayer1D.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -19,14 +19,10 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. -using System; -using System.Drawing; - namespace Ringtoets.MacroStabilityInwards.Primitives { /// - /// This class represents profiles that were imported from D-Soil Model and will later on be used to create the - /// necessary input for executing a macro stability inwards calculation. + /// This class represents a 1D layer that was imported from D-Soil Model. /// public class MacroStabilityInwardsSoilLayer1D { @@ -50,386 +46,6 @@ /// public double Top { get; } - /// - /// Gets or sets a value indicating whether or not the is an aquifer. - /// - public bool IsAquifer - { - get - { - return Properties.IsAquifer; - } - set - { - Properties.IsAquifer = value; - } - } - - /// - /// Gets or sets a value indicating whether or not to use POP for the . - /// - public bool UsePop - { - get - { - return Properties.UsePop; - } - set - { - Properties.UsePop = value; - } - } - - /// - /// Gets or sets the shear strength model used for the . - /// - public ShearStrengthModel ShearStrengthModel - { - get - { - return Properties.ShearStrengthModel; - } - set - { - Properties.ShearStrengthModel = value; - } - } - - /// - /// Gets or sets the mean of the distrubtion for the volumic weight of the above the phreatic level. - /// [kN/m³] - /// - public double AbovePhreaticLevelMean - { - get - { - return Properties.AbovePhreaticLevelMean; - } - set - { - Properties.AbovePhreaticLevelMean = value; - } - } - - /// - /// Gets or sets the deviation of the distrubtion for the volumic weight of the above the phreatic level. - /// [kN/m³] - /// - public double AbovePhreaticLevelDeviation - { - get - { - return Properties.AbovePhreaticLevelDeviation; - } - set - { - Properties.AbovePhreaticLevelDeviation = value; - } - } - - /// - /// Gets or sets the mean of the distrubtion for the volumic weight of the below the phreatic level. - /// [kN/m³] - /// - public double BelowPhreaticLevelMean - { - get - { - return Properties.BelowPhreaticLevelMean; - } - set - { - Properties.BelowPhreaticLevelMean = value; - } - } - - /// - /// Gets or sets the deviation of the distrubtion for the volumic weight of the below the phreatic level. - /// [kN/m³] - /// - public double BelowPhreaticLevelDeviation - { - get - { - return Properties.BelowPhreaticLevelDeviation; - } - set - { - Properties.BelowPhreaticLevelDeviation = value; - } - } - - /// - /// Gets or sets the mean of the distribution for the friction angle of the - /// [°] - /// - public double FrictionAngleMean - { - get - { - return Properties.FrictionAngleMean; - } - set - { - Properties.FrictionAngleMean = value; - } - } - - /// - /// Gets or sets the deviation of the distribution for the friction angle of the . - /// [°] - /// - public double FrictionAngleDeviation - { - get - { - return Properties.FrictionAngleDeviation; - } - set - { - Properties.FrictionAngleDeviation = value; - } - } - - /// - /// Gets or sets the shift of the distrubtion for the friction angle of the . - /// [°] - /// - public double FrictionAngleShift - { - get - { - return Properties.FrictionAngleShift; - } - set - { - Properties.FrictionAngleShift = value; - } - } - - /// - /// Gets or sets the mean of the distribution for the ratio of shear strength S of the - /// [-] - /// - public double ShearStrengthRatioMean - { - get - { - return Properties.ShearStrengthRatioMean; - } - set - { - Properties.ShearStrengthRatioMean = value; - } - } - - /// - /// Gets or sets the deviation of the distribution for the ratio of shear strength S of the . - /// [-] - /// - public double ShearStrengthRatioDeviation - { - get - { - return Properties.ShearStrengthRatioDeviation; - } - set - { - Properties.ShearStrengthRatioDeviation = value; - } - } - - /// - /// Gets or sets the shift of the distrubtion for the ratio of shear strength S of the . - /// [-] - /// - public double ShearStrengthRatioShift - { - get - { - return Properties.ShearStrengthRatioShift; - } - set - { - Properties.ShearStrengthRatioShift = value; - } - } - - /// - /// Gets or sets the mean of the distribution for the strength increase exponent (m) of the - /// [-] - /// - public double StrengthIncreaseExponentMean - { - get - { - return Properties.StrengthIncreaseExponentMean; - } - set - { - Properties.StrengthIncreaseExponentMean = value; - } - } - - /// - /// Gets or sets the deviation of the distribution for the strength increase exponent (m) of the . - /// [-] - /// - public double StrengthIncreaseExponentDeviation - { - get - { - return Properties.StrengthIncreaseExponentDeviation; - } - set - { - Properties.StrengthIncreaseExponentDeviation = value; - } - } - - /// - /// Gets or sets the shift of the distrubtion for the strength increase exponent (m) of the . - /// [-] - /// - public double StrengthIncreaseExponentShift - { - get - { - return Properties.StrengthIncreaseExponentShift; - } - set - { - Properties.StrengthIncreaseExponentShift = value; - } - } - - /// - /// Gets or sets the mean of the distribution for the cohesion of the - /// [kN/m³] - /// - public double CohesionMean - { - get - { - return Properties.CohesionMean; - } - set - { - Properties.CohesionMean = value; - } - } - - /// - /// Gets or sets the deviation of the distribution for the cohesion of the . - /// [kN/m³] - /// - public double CohesionDeviation - { - get - { - return Properties.CohesionDeviation; - } - set - { - Properties.CohesionDeviation = value; - } - } - - /// - /// Gets or sets the shift of the distrubtion for the cohesion of the . - /// [kN/m³] - /// - public double CohesionShift - { - get - { - return Properties.CohesionShift; - } - set - { - Properties.CohesionShift = value; - } - } - - /// - /// Gets or sets the mean of the distribution for the POP of the - /// [kN/m²] - /// - public double PopMean - { - get - { - return Properties.PopMean; - } - set - { - Properties.PopMean = value; - } - } - - /// - /// Gets or sets the deviation of the distribution for the POP of the . - /// [kN/m²] - /// - public double PopDeviation - { - get - { - return Properties.PopDeviation; - } - set - { - Properties.PopDeviation = value; - } - } - - /// - /// Gets or sets the shift of the distrubtion for the POP of the . - /// [kN/m²] - /// - public double PopShift - { - get - { - return Properties.PopShift; - } - set - { - Properties.PopShift = value; - } - } - - /// - /// Gets or sets the name of the material that was assigned to the . - /// - /// Thrown when is null. - public string MaterialName - { - get - { - return Properties.MaterialName; - } - set - { - Properties.MaterialName = value; - } - } - - /// - /// Gets or sets the that was used to represent the . - /// - public Color Color - { - get - { - return Properties.Color; - } - set - { - Properties.Color = value; - } - } - public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) @@ -448,17 +64,15 @@ { unchecked { - int hashCode = MaterialName?.GetHashCode() ?? 0; - hashCode = (hashCode * 397) ^ Top.GetHashCode(); + int hashCode = Top.GetHashCode(); hashCode = (hashCode * 397) ^ Properties.GetHashCode(); return hashCode; } } private bool Equals(MacroStabilityInwardsSoilLayer1D other) { - return string.Equals(MaterialName, other.MaterialName) - && Top.Equals(other.Top) + return Top.Equals(other.Top) && Properties.Equals(other.Properties); } } Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/MacroStabilityInwardsSoilLayer2D.cs =================================================================== diff -u -r564a695798dd77c0b90bba14c902c6caefb7786f -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/MacroStabilityInwardsSoilLayer2D.cs (.../MacroStabilityInwardsSoilLayer2D.cs) (revision 564a695798dd77c0b90bba14c902c6caefb7786f) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/MacroStabilityInwardsSoilLayer2D.cs (.../MacroStabilityInwardsSoilLayer2D.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -26,8 +26,7 @@ namespace Ringtoets.MacroStabilityInwards.Primitives { /// - /// This class represents profiles that were imported from D-Soil Model and will later on be used to create the - /// necessary input for executing a macro stability inwards calculation. + /// This class represents a 2D layer that was imported from D-Soil Model. /// public class MacroStabilityInwardsSoilLayer2D { Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/MacroStabilityInwardsSoilProfile1D.cs =================================================================== diff -u -r376649a985f9523e6ecac956b3abd39ed1a64369 -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/MacroStabilityInwardsSoilProfile1D.cs (.../MacroStabilityInwardsSoilProfile1D.cs) (revision 376649a985f9523e6ecac956b3abd39ed1a64369) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/MacroStabilityInwardsSoilProfile1D.cs (.../MacroStabilityInwardsSoilProfile1D.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -35,7 +35,7 @@ private string name; /// - /// Creates a new instance ofL , with the given , + /// Creates a new instance of , with the given , /// and . /// A new collection is created for and used in the . /// @@ -45,7 +45,13 @@ /// The type of soil profile used as data source /// to build this instance. /// Identifier of the profile. - /// Thrown when contains no layers. + /// Thrown when + /// + /// contains no layers + /// contains a layer with the less than + /// + /// + /// /// Thrown when or /// is null. public MacroStabilityInwardsSoilProfile1D(string name, double bottom, IEnumerable layers, SoilProfileType sourceProfileType, long soilProfileId) @@ -70,6 +76,7 @@ /// /// Gets the name of . /// + /// Thrown when the value is null. public string Name { get Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/MacroStabilityInwardsSoilProfile2D.cs =================================================================== diff -u -r376649a985f9523e6ecac956b3abd39ed1a64369 -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/MacroStabilityInwardsSoilProfile2D.cs (.../MacroStabilityInwardsSoilProfile2D.cs) (revision 376649a985f9523e6ecac956b3abd39ed1a64369) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/MacroStabilityInwardsSoilProfile2D.cs (.../MacroStabilityInwardsSoilProfile2D.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -35,7 +35,7 @@ private string name; /// - /// Creates a new instance ofL , with the given + /// Creates a new instance of , with the given /// and . /// A new collection is created for and used in the . /// @@ -63,6 +63,7 @@ /// /// Gets the name of . /// + /// Thrown when the value is null. public string Name { get Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/Ring.cs =================================================================== diff -u -r376649a985f9523e6ecac956b3abd39ed1a64369 -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/Ring.cs (.../Ring.cs) (revision 376649a985f9523e6ecac956b3abd39ed1a64369) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/Ring.cs (.../Ring.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -35,6 +35,8 @@ /// Creates a new instance of . /// /// The points that form the ring. + /// Thrown when is null. + /// Thrown when contains less than 2 unique points. /// While a ring is defined to be closed line, it's not required /// that the given ' first point and last point /// are equal. @@ -85,8 +87,8 @@ /// Validates the points collection. /// /// The points to validate. - /// Thrown when points is null. - /// Thrown when points contains less than 2 unique points. + /// Thrown when is null. + /// Thrown when contains less than 2 unique points. private void ValidateAndTrimPoints(IEnumerable points) { if (points == null) @@ -95,7 +97,7 @@ } if (points.Distinct().Count() < 2) { - throw new ArgumentException($@"Need at least two points to define a {typeof(Ring).Name}.", nameof(points)); + throw new ArgumentException($@"Need at least two distinct points to define a {typeof(Ring).Name}.", nameof(points)); } } } Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/SoilLayerProperties.cs =================================================================== diff -u -rf2234f62cc9b8e06b06c39acc6e0754d85366ac7 -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/SoilLayerProperties.cs (.../SoilLayerProperties.cs) (revision f2234f62cc9b8e06b06c39acc6e0754d85366ac7) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/SoilLayerProperties.cs (.../SoilLayerProperties.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -24,11 +24,22 @@ namespace Ringtoets.MacroStabilityInwards.Primitives { + /// + /// Properties of a soil layer. + /// public class SoilLayerProperties { private string materialName = string.Empty; + + /// + /// 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 @@ -45,27 +56,133 @@ } } + /// + /// 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 strenth model to use for the layer. + /// public ShearStrengthModel 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 of the + /// [kN/m³] + /// public double CohesionMean { get; set; } = double.NaN; + + /// + /// Gets or sets the deviation of the distribution for the cohesion of the . + /// [kN/m³] + /// public double CohesionDeviation { get; set; } = double.NaN; + + /// + /// Gets or sets the shift of the distribution for the cohesion of the . + /// [kN/m³] + /// public double CohesionShift { get; set; } = double.NaN; + + /// + /// Gets or sets the mean of the distribution for the friction angle of the + /// [°] + /// public double FrictionAngleMean { get; set; } = double.NaN; + + /// + /// Gets or sets the deviation of the distribution for the friction angle of the . + /// [°] + /// public double FrictionAngleDeviation { get; set; } = double.NaN; + + /// + /// Gets or sets the shift of the distribution for the friction angle of the . + /// [°] + /// public double FrictionAngleShift { get; set; } = double.NaN; + + /// + /// Gets or sets the mean of the distribution for the ratio of shear strength S of the + /// [-] + /// public double ShearStrengthRatioMean { get; set; } = double.NaN; + + /// + /// Gets or sets the deviation of the distribution for the ratio of shear strength S of the . + /// [-] + /// public double ShearStrengthRatioDeviation { get; set; } = double.NaN; + + /// + /// Gets or sets the shift of the distribution for the ratio of shear strength S of the . + /// [-] + /// public double ShearStrengthRatioShift { get; set; } = double.NaN; + + /// + /// Gets or sets the mean of the distribution for the strength increase exponent (m) of the + /// [-] + /// public double StrengthIncreaseExponentMean { get; set; } = double.NaN; + + /// + /// Gets or sets the deviation of the distribution for the strength increase exponent (m) of the . + /// [-] + /// public double StrengthIncreaseExponentDeviation { get; set; } = double.NaN; + + /// + /// Gets or sets the shift of the distribution for the strength increase exponent (m) of the . + /// [-] + /// public double StrengthIncreaseExponentShift { get; set; } = double.NaN; + + /// + /// Gets or sets the mean of the distribution for the POP of the + /// [kN/m²] + /// public double PopMean { get; set; } = double.NaN; + + /// + /// Gets or sets the deviation of the distribution for the POP of the . + /// [kN/m²] + /// public double PopDeviation { get; set; } = double.NaN; + + /// + /// Gets or sets the shift of the distribution for the POP of the . + /// [kN/m²] + /// public double PopShift { get; set; } = double.NaN; public override bool Equals(object obj) Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/Ringtoets.MacroStabilityInwards.Data.Test.csproj =================================================================== diff -u -r564a695798dd77c0b90bba14c902c6caefb7786f -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/Ringtoets.MacroStabilityInwards.Data.Test.csproj (.../Ringtoets.MacroStabilityInwards.Data.Test.csproj) (revision 564a695798dd77c0b90bba14c902c6caefb7786f) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/Ringtoets.MacroStabilityInwards.Data.Test.csproj (.../Ringtoets.MacroStabilityInwards.Data.Test.csproj) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -97,10 +97,6 @@ {83d6b73e-91d5-46b0-9218-955da1f75f7c} Ringtoets.MacroStabilityInwards.Data - - {4a6e4b44-316e-4717-bdb1-05a78b734f14} - Ringtoets.MacroStabilityInwards.InputParameterCalculation - {e9b39743-2dc9-4922-9e0f-6ba3e0e54189} Ringtoets.MacroStabilityInwards.Primitives Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilProfileUnderSurfaceLineFactoryTest.cs =================================================================== diff -u -r564a695798dd77c0b90bba14c902c6caefb7786f -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilProfileUnderSurfaceLineFactoryTest.cs (.../SoilProfileUnderSurfaceLineFactoryTest.cs) (revision 564a695798dd77c0b90bba14c902c6caefb7786f) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilProfileUnderSurfaceLineFactoryTest.cs (.../SoilProfileUnderSurfaceLineFactoryTest.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -23,7 +23,6 @@ using System.Collections.Generic; using System.Linq; using Core.Common.Base.Geometry; -using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.MacroStabilityInwards.Primitives; @@ -341,8 +340,16 @@ // Assert Assert.AreEqual(2, profileUnderSurfaceLine.LayersUnderSurfaceLine.Count()); - CollectionAssert.AreEqual(new [] { outerRingA.Points, outerRingB.Points }, profileUnderSurfaceLine.LayersUnderSurfaceLine.Select(layer => layer.OuterRing)); - CollectionAssert.AreEqual(new [] { holesA.Select(h => h.Points), holesB.Select(h => h.Points) }, profileUnderSurfaceLine.LayersUnderSurfaceLine.Select(layer => layer.Holes)); + CollectionAssert.AreEqual(new[] + { + outerRingA.Points, + outerRingB.Points + }, profileUnderSurfaceLine.LayersUnderSurfaceLine.Select(layer => layer.OuterRing)); + CollectionAssert.AreEqual(new[] + { + holesA.Select(h => h.Points), + holesB.Select(h => h.Points) + }, profileUnderSurfaceLine.LayersUnderSurfaceLine.Select(layer => layer.Holes)); } private static Ring CreateRing(int seed) Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/StochasticSoilModelTest.cs =================================================================== diff -u -r564a695798dd77c0b90bba14c902c6caefb7786f -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/StochasticSoilModelTest.cs (.../StochasticSoilModelTest.cs) (revision 564a695798dd77c0b90bba14c902c6caefb7786f) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/StochasticSoilModelTest.cs (.../StochasticSoilModelTest.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -27,7 +27,6 @@ using Core.Common.Base.Geometry; using NUnit.Framework; using Rhino.Mocks; -using Ringtoets.MacroStabilityInwards.Data; using Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil; using Ringtoets.MacroStabilityInwards.Primitives; @@ -37,9 +36,20 @@ public class StochasticSoilModelTest { [Test] + public void Constructor_WithoutName_ExpectedValues() + { + // Call + TestDelegate test = () => new StochasticSoilModel(null); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("name", exception.ParamName); + } + + [Test] [TestCase("")] [TestCase("segmentSoilModelName")] - public void Constructor_Always_ExpectedValues(string segmentSoilModelName) + public void Constructor_WithName_ExpectedValues(string segmentSoilModelName) { // Call var stochasticSoilModel = new StochasticSoilModel(segmentSoilModelName); @@ -354,17 +364,6 @@ }, difference.AddedProfiles); } - private static ISoilProfile CreateMacroStabilityInwardsSoilProfile1D(string name) - { - return new MacroStabilityInwardsSoilProfile1D(name, 0.0, new Collection - { - new MacroStabilityInwardsSoilLayer1D(0.0) - { - IsAquifer = true - } - }, SoilProfileType.SoilProfile1D, 0); - } - [Test] public void Update_ModelsWithAddedProfilesWithSameNames_ThrowsInvalidOperationException() { @@ -402,7 +401,6 @@ } [Test] - [TestCase(null)] [TestCase("")] [TestCase("some name")] public void ToString_WithName_ReturnsName(string name) @@ -414,6 +412,20 @@ Assert.AreEqual(name, stochasticSoilModel.ToString()); } + private static ISoilProfile CreateMacroStabilityInwardsSoilProfile1D(string name) + { + return new MacroStabilityInwardsSoilProfile1D(name, 0.0, new Collection + { + new MacroStabilityInwardsSoilLayer1D(0.0) + { + Properties = + { + IsAquifer = true + } + } + }, SoilProfileType.SoilProfile1D, 0); + } + private class TestSoilProfile : ISoilProfile { public string Name { get; } = ""; Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/StochasticSoilProfileTest.cs =================================================================== diff -u -r564a695798dd77c0b90bba14c902c6caefb7786f -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/StochasticSoilProfileTest.cs (.../StochasticSoilProfileTest.cs) (revision 564a695798dd77c0b90bba14c902c6caefb7786f) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/StochasticSoilProfileTest.cs (.../StochasticSoilProfileTest.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -160,6 +160,19 @@ } [Test] + public void Equals_OtherType_ReturnsFalse() + { + // Setup + var stochasticProfile = new StochasticSoilProfile(0.0, SoilProfileType.SoilProfile1D, 0); + + // Call + bool areEqual = stochasticProfile.Equals(new object()); + + // Assert + Assert.IsFalse(areEqual); + } + + [Test] public void Equals_Null_ReturnsFalse() { // Setup @@ -201,9 +214,7 @@ } [Test] - [TestCase("")] - [TestCase("some name")] - public void ToString_WithProfile_ReturnsToStringResultOfProfile(string name) + public void ToString_WithProfile_ReturnsToStringResultOfProfile() { // Setup var profile = new TestSoilProfile(); @@ -245,6 +256,8 @@ StochasticSoilProfile profileC = CreateRandomStochasticProfile(73); var profileE = new StochasticSoilProfile(0.5, SoilProfileType.SoilProfile1D, 25); var profileF = new StochasticSoilProfile(0.5, SoilProfileType.SoilProfile1D, 45); + var profileG = new StochasticSoilProfile(0.5, SoilProfileType.SoilProfile2D, 25); + var profileH = new StochasticSoilProfile(0.15, SoilProfileType.SoilProfile1D, 25); return new[] { @@ -256,9 +269,21 @@ { TestName = "Equals_ProfileBProfileC_False" }, + new TestCaseData(profileA, profileC, false) + { + TestName = "Equals_ProfileAProfileC_False" + }, new TestCaseData(profileE, profileF, true) { TestName = "Equals_DifferentIds_True" + }, + new TestCaseData(profileE, profileG, false) + { + TestName = "Equals_DifferentTypes_False" + }, + new TestCaseData(profileE, profileH, false) + { + TestName = "Equals_DifferentProbability_False" } }; } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil.Test/MacroStabilityInwardsInputFactoryTest.cs =================================================================== diff -u -rd47809e3a8fadff2be5b10056b79b16dc27eeca2 -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil.Test/MacroStabilityInwardsInputFactoryTest.cs (.../MacroStabilityInwardsInputFactoryTest.cs) (revision d47809e3a8fadff2be5b10056b79b16dc27eeca2) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil.Test/MacroStabilityInwardsInputFactoryTest.cs (.../MacroStabilityInwardsInputFactoryTest.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -174,7 +174,7 @@ private static void AssertLayer(bool aquifer, double top, MacroStabilityInwardsSoilLayer1D soilLayer) { - Assert.AreEqual(aquifer, soilLayer.IsAquifer); + Assert.AreEqual(aquifer, soilLayer.Properties.IsAquifer); Assert.AreEqual(top, soilLayer.Top); } } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil/MacroStabilityInwardsCalculationScenarioFactory.cs =================================================================== diff -u -rcd90ebf744fb74f0d4b0dd6ee06f9c39b5faf213 -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil/MacroStabilityInwardsCalculationScenarioFactory.cs (.../MacroStabilityInwardsCalculationScenarioFactory.cs) (revision cd90ebf744fb74f0d4b0dd6ee06f9c39b5faf213) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil/MacroStabilityInwardsCalculationScenarioFactory.cs (.../MacroStabilityInwardsCalculationScenarioFactory.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -139,11 +139,17 @@ { new MacroStabilityInwardsSoilLayer1D(top) { - IsAquifer = false + Properties = + { + IsAquifer = false + } }, new MacroStabilityInwardsSoilLayer1D(top / 2) { - IsAquifer = true + Properties = + { + IsAquifer = true + } } }, SoilProfileType.SoilProfile1D, 0) }; Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil/MacroStabilityInwardsInputFactory.cs =================================================================== diff -u -rcd90ebf744fb74f0d4b0dd6ee06f9c39b5faf213 -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil/MacroStabilityInwardsInputFactory.cs (.../MacroStabilityInwardsInputFactory.cs) (revision cd90ebf744fb74f0d4b0dd6ee06f9c39b5faf213) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil/MacroStabilityInwardsInputFactory.cs (.../MacroStabilityInwardsInputFactory.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -52,11 +52,17 @@ { new MacroStabilityInwardsSoilLayer1D(thicknessCoverageLayer) { - IsAquifer = false + Properties = + { + IsAquifer = false + } }, new MacroStabilityInwardsSoilLayer1D(0.0) { - IsAquifer = true + Properties = + { + IsAquifer = true + } } }, SoilProfileType.SoilProfile1D, 0) }; @@ -87,7 +93,10 @@ { new MacroStabilityInwardsSoilLayer1D(0.0) { - IsAquifer = true + Properties = + { + IsAquifer = true + } } }, SoilProfileType.SoilProfile1D, 0) }; @@ -119,15 +128,24 @@ { new MacroStabilityInwardsSoilLayer1D(surfaceLineTopLevel + deltaAboveSurfaceLine + 2) { - IsAquifer = false + Properties = + { + IsAquifer = false + } }, new MacroStabilityInwardsSoilLayer1D(surfaceLineTopLevel + deltaAboveSurfaceLine + 1) { - IsAquifer = true + Properties = + { + IsAquifer = true + } }, new MacroStabilityInwardsSoilLayer1D(surfaceLineTopLevel + deltaAboveSurfaceLine) { - IsAquifer = false + Properties = + { + IsAquifer = false + } } }, SoilProfileType.SoilProfile1D, 0) }; @@ -158,15 +176,24 @@ { new MacroStabilityInwardsSoilLayer1D(4.3) { - IsAquifer = false + Properties = + { + IsAquifer = false + } }, new MacroStabilityInwardsSoilLayer1D(3.3) { - IsAquifer = true + Properties = + { + IsAquifer = true + } }, new MacroStabilityInwardsSoilLayer1D(1.1) { - IsAquifer = true + Properties = + { + IsAquifer = true + } } }, SoilProfileType.SoilProfile1D, 0) }; Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Factories/MacroStabilityInwardsChartDataFactoryTest.cs =================================================================== diff -u -rf52eb6e887fbc44ce5fc439e6b2c289c903987b4 -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Factories/MacroStabilityInwardsChartDataFactoryTest.cs (.../MacroStabilityInwardsChartDataFactoryTest.cs) (revision f52eb6e887fbc44ce5fc439e6b2c289c903987b4) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Factories/MacroStabilityInwardsChartDataFactoryTest.cs (.../MacroStabilityInwardsChartDataFactoryTest.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -149,8 +149,11 @@ } layers.Add(new MacroStabilityInwardsSoilLayer1D(-1.0) { - MaterialName = name, - Color = Color.Aquamarine + Properties = + { + MaterialName = name, + Color = Color.Aquamarine + } }); var profile = new MacroStabilityInwardsSoilProfile1D("name", -1.0, layers, SoilProfileType.SoilProfile1D, 0); Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsInputContextPropertiesTest.cs =================================================================== diff -u -r564a695798dd77c0b90bba14c902c6caefb7786f -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsInputContextPropertiesTest.cs (.../MacroStabilityInwardsInputContextPropertiesTest.cs) (revision 564a695798dd77c0b90bba14c902c6caefb7786f) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsInputContextPropertiesTest.cs (.../MacroStabilityInwardsInputContextPropertiesTest.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -299,7 +299,10 @@ { new MacroStabilityInwardsSoilLayer1D(random.NextDouble()) { - IsAquifer = true + Properties = + { + IsAquifer = true + } } }, SoilProfileType.SoilProfile1D, 0) }; Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/StochasticSoilProfilePropertiesTest.cs =================================================================== diff -u -rd47809e3a8fadff2be5b10056b79b16dc27eeca2 -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/StochasticSoilProfilePropertiesTest.cs (.../StochasticSoilProfilePropertiesTest.cs) (revision d47809e3a8fadff2be5b10056b79b16dc27eeca2) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/StochasticSoilProfilePropertiesTest.cs (.../StochasticSoilProfilePropertiesTest.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -72,7 +72,10 @@ new MacroStabilityInwardsSoilLayer1D(-2), new MacroStabilityInwardsSoilLayer1D(-4) { - IsAquifer = true + Properties = + { + IsAquifer = true + } } }; Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsInputViewTest.cs =================================================================== diff -u -rcd90ebf744fb74f0d4b0dd6ee06f9c39b5faf213 -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsInputViewTest.cs (.../MacroStabilityInwardsInputViewTest.cs) (revision cd90ebf744fb74f0d4b0dd6ee06f9c39b5faf213) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsInputViewTest.cs (.../MacroStabilityInwardsInputViewTest.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -822,7 +822,7 @@ Assert.AreEqual(expectedLayerCount, soilProfileChartData.Collection.Count()); Assert.AreEqual(soilProfile.Name, soilProfileChartData.Name); - string[] soilLayers = soilProfile.Layers.Select((l, i) => string.Format("{0} {1}", i + 1, l.MaterialName)).Reverse().ToArray(); + string[] soilLayers = soilProfile.Layers.Select((l, i) => $"{i + 1} {l.Properties.MaterialName}").Reverse().ToArray(); for (var i = 0; i < expectedLayerCount; i++) { Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsSoilLayerTableTest.cs =================================================================== diff -u -rd47809e3a8fadff2be5b10056b79b16dc27eeca2 -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsSoilLayerTableTest.cs (.../MacroStabilityInwardsSoilLayerTableTest.cs) (revision d47809e3a8fadff2be5b10056b79b16dc27eeca2) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsSoilLayerTableTest.cs (.../MacroStabilityInwardsSoilLayerTableTest.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -155,10 +155,10 @@ { MacroStabilityInwardsSoilLayer1D soilLayer = layers[i]; DataGridViewCellCollection rowCells = table.Rows[i].Cells; - AssertColumnValueEqual(soilLayer.MaterialName, rowCells[nameColumnIndex].Value); - AssertColumnValueEqual(soilLayer.Color, rowCells[colorColumnIndex].Value); AssertColumnValueEqual(soilLayer.Top, rowCells[topColumnIndex].Value); - AssertColumnValueEqual(soilLayer.IsAquifer, rowCells[isAquiferColumnIndex].Value); + AssertColumnValueEqual(soilLayer.Properties.MaterialName, rowCells[nameColumnIndex].Value); + AssertColumnValueEqual(soilLayer.Properties.Color, rowCells[colorColumnIndex].Value); + AssertColumnValueEqual(soilLayer.Properties.IsAquifer, rowCells[isAquiferColumnIndex].Value); } } } @@ -183,9 +183,12 @@ return new MacroStabilityInwardsSoilLayer1D(random.NextDouble()) { - MaterialName = $"{random.NextDouble()}", - Color = Color.FromKnownColor(random.NextEnumValue()), - IsAquifer = random.NextBoolean() + Properties = + { + MaterialName = $"{random.NextDouble()}", + Color = Color.FromKnownColor(random.NextEnumValue()), + IsAquifer = random.NextBoolean() + } }; } } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Builders/SoilLayer1DTest.cs =================================================================== diff -u -rd47809e3a8fadff2be5b10056b79b16dc27eeca2 -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Builders/SoilLayer1DTest.cs (.../SoilLayer1DTest.cs) (revision d47809e3a8fadff2be5b10056b79b16dc27eeca2) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Builders/SoilLayer1DTest.cs (.../SoilLayer1DTest.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -71,9 +71,9 @@ // Assert Assert.AreEqual(top, result.Top); - Assert.AreEqual(isAquifer.Equals(1.0), result.IsAquifer); - Assert.AreEqual(materialName, result.MaterialName); - Assert.AreEqual(Color.FromArgb(color.ToArgb()), result.Color); + Assert.AreEqual(isAquifer.Equals(1.0), result.Properties.IsAquifer); + Assert.AreEqual(materialName, result.Properties.MaterialName); + Assert.AreEqual(Color.FromArgb(color.ToArgb()), result.Properties.Color); } [Test] @@ -88,7 +88,7 @@ MacroStabilityInwardsSoilLayer1D result = layer.AsMacroStabilityInwardsSoilLayer(); // Assert - Assert.IsEmpty(result.MaterialName); + Assert.IsEmpty(result.Properties.MaterialName); } } } \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Builders/SoilLayer2DTest.cs =================================================================== diff -u -rd47809e3a8fadff2be5b10056b79b16dc27eeca2 -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Builders/SoilLayer2DTest.cs (.../SoilLayer2DTest.cs) (revision d47809e3a8fadff2be5b10056b79b16dc27eeca2) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Builders/SoilLayer2DTest.cs (.../SoilLayer2DTest.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -290,9 +290,9 @@ Assert.AreEqual(y1, bottom, 1e-6); MacroStabilityInwardsSoilLayer1D resultLayer = result.First(); Assert.AreEqual(y2, resultLayer.Top, 1e-6); - Assert.IsTrue(resultLayer.IsAquifer); - Assert.AreEqual(materialName, resultLayer.MaterialName); - Assert.AreEqual(Color.FromArgb(color.ToArgb()), resultLayer.Color); + Assert.IsTrue(resultLayer.Properties.IsAquifer); + Assert.AreEqual(materialName, resultLayer.Properties.MaterialName); + Assert.AreEqual(Color.FromArgb(color.ToArgb()), resultLayer.Properties.Color); } [Test] @@ -316,7 +316,7 @@ // Assert Assert.AreEqual(1, result.Length); - Assert.IsEmpty(result[0].MaterialName); + Assert.IsEmpty(result[0].Properties.MaterialName); } [Test] Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Builders/SoilProfileBuilder1DTest.cs =================================================================== diff -u -rd47809e3a8fadff2be5b10056b79b16dc27eeca2 -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Builders/SoilProfileBuilder1DTest.cs (.../SoilProfileBuilder1DTest.cs) (revision d47809e3a8fadff2be5b10056b79b16dc27eeca2) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Builders/SoilProfileBuilder1DTest.cs (.../SoilProfileBuilder1DTest.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -57,7 +57,10 @@ var builder = new SoilProfileBuilder1D(profileName, bottom, soilProfileId); builder.Add(new MacroStabilityInwardsSoilLayer1D(top) { - IsAquifer = true + Properties = + { + IsAquifer = true + } }); // Call @@ -86,7 +89,10 @@ var builder = new SoilProfileBuilder1D(profileName, bottom, soilProfileId); builder.Add(new MacroStabilityInwardsSoilLayer1D(top) { - IsAquifer = true + Properties = + { + IsAquifer = true + } }); builder.Add(new MacroStabilityInwardsSoilLayer1D(top2)); Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Importers/StochasticSoilModelImporterTest.cs =================================================================== diff -u -rd47809e3a8fadff2be5b10056b79b16dc27eeca2 -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Importers/StochasticSoilModelImporterTest.cs (.../StochasticSoilModelImporterTest.cs) (revision d47809e3a8fadff2be5b10056b79b16dc27eeca2) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Importers/StochasticSoilModelImporterTest.cs (.../StochasticSoilModelImporterTest.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -881,7 +881,7 @@ CollectionAssert.AreEqual(expectedLayerTops, profile.Layers.Select(l => l.Top)); int expectedNumberOfLayers = expectedLayerTops.Length; CollectionAssert.AreEqual(Enumerable.Repeat(false, expectedNumberOfLayers), - profile.Layers.Select(l => l.IsAquifer)); + profile.Layers.Select(l => l.Properties.IsAquifer)); Assert.AreEqual(7, progress); } @@ -949,20 +949,8 @@ false }; CollectionAssert.AreEqual(expectedIsAquiferValues, - profile.Layers.Select(l => l.IsAquifer)); + profile.Layers.Select(l => l.Properties.IsAquifer)); CollectionAssert.AreEqual(expectedLayerTops, profile.Layers.Select(l => l.Top)); - var expectedBelowPhreaticLevelValues = new[] - { - 27.27, - 28.28, - 29.29, - 30.3, - 33.33, - 35.35, - 37.37, - 39.39, - 40.4 - }; Assert.AreEqual(7, progress); } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/SoilProfile/MacroStabilityInwardsSoilProfileReaderTest.cs =================================================================== diff -u -rb5404a5a71bbedaa91bbcc5aee55c690a063aa8d -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/SoilProfile/MacroStabilityInwardsSoilProfileReaderTest.cs (.../MacroStabilityInwardsSoilProfileReaderTest.cs) (revision b5404a5a71bbedaa91bbcc5aee55c690a063aa8d) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/SoilProfile/MacroStabilityInwardsSoilProfileReaderTest.cs (.../MacroStabilityInwardsSoilProfileReaderTest.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -298,7 +298,7 @@ Assert.AreEqual("Profile", profile.Name); const int expectedNumberOfLayers = 3; Assert.AreEqual(expectedNumberOfLayers, profile.Layers.Count()); - CollectionAssert.AreEqual(Enumerable.Repeat(false, expectedNumberOfLayers), profile.Layers.Select(l => l.IsAquifer)); + CollectionAssert.AreEqual(Enumerable.Repeat(false, expectedNumberOfLayers), profile.Layers.Select(l => l.Properties.IsAquifer)); } } @@ -343,13 +343,13 @@ false, false, true - }, profile.Layers.Select(l => l.IsAquifer)); + }, profile.Layers.Select(l => l.Properties.IsAquifer)); CollectionAssert.AreEqual(new[] { Color.FromArgb(128, 255, 128), Color.FromArgb(255, 0, 0), Color.FromArgb(70, 130, 180) - }, profile.Layers.Select(l => l.Color)); + }, profile.Layers.Select(l => l.Properties.Color)); } } @@ -370,13 +370,13 @@ true, false, false - }, profile.Layers.Select(l => l.IsAquifer)); + }, profile.Layers.Select(l => l.Properties.IsAquifer)); CollectionAssert.AreEqual(new[] { Color.FromArgb(70, 130, 180), Color.FromArgb(255, 0, 0), Color.FromArgb(128, 255, 128) - }, profile.Layers.Select(l => l.Color)); + }, profile.Layers.Select(l => l.Properties.Color)); } } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/SoilProfile/SoilProfile1DReaderTest.cs =================================================================== diff -u -rd47809e3a8fadff2be5b10056b79b16dc27eeca2 -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/SoilProfile/SoilProfile1DReaderTest.cs (.../SoilProfile1DReaderTest.cs) (revision d47809e3a8fadff2be5b10056b79b16dc27eeca2) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/SoilProfile/SoilProfile1DReaderTest.cs (.../SoilProfile1DReaderTest.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -171,9 +171,9 @@ MacroStabilityInwardsSoilLayer1D macroStabilityInwardsSoilLayer = profile.Layers.First(); Assert.AreEqual(top, macroStabilityInwardsSoilLayer.Top); - Assert.IsEmpty(macroStabilityInwardsSoilLayer.MaterialName); - Assert.AreEqual(Color.Empty, macroStabilityInwardsSoilLayer.Color); - Assert.IsFalse(macroStabilityInwardsSoilLayer.IsAquifer); + Assert.IsEmpty(macroStabilityInwardsSoilLayer.Properties.MaterialName); + Assert.AreEqual(Color.Empty, macroStabilityInwardsSoilLayer.Properties.Color); + Assert.IsFalse(macroStabilityInwardsSoilLayer.Properties.IsAquifer); mocks.VerifyAll(); } @@ -225,9 +225,9 @@ MacroStabilityInwardsSoilLayer1D macroStabilityInwardsSoilLayer = profile.Layers.First(); Assert.AreEqual(top, macroStabilityInwardsSoilLayer.Top); - Assert.IsTrue(macroStabilityInwardsSoilLayer.IsAquifer); - Assert.AreEqual(materialName, macroStabilityInwardsSoilLayer.MaterialName); - Assert.AreEqual(color, macroStabilityInwardsSoilLayer.Color); + Assert.IsTrue(macroStabilityInwardsSoilLayer.Properties.IsAquifer); + Assert.AreEqual(materialName, macroStabilityInwardsSoilLayer.Properties.MaterialName); + Assert.AreEqual(color, macroStabilityInwardsSoilLayer.Properties.Color); mocks.VerifyAll(); } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/SoilProfile/SoilProfile2DReaderTest.cs =================================================================== diff -u -rd47809e3a8fadff2be5b10056b79b16dc27eeca2 -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/SoilProfile/SoilProfile2DReaderTest.cs (.../SoilProfile2DReaderTest.cs) (revision d47809e3a8fadff2be5b10056b79b16dc27eeca2) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/SoilProfile/SoilProfile2DReaderTest.cs (.../SoilProfile2DReaderTest.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -244,9 +244,9 @@ MacroStabilityInwardsSoilLayer1D macroStabilityInwardsSoilLayer = profile.Layers.First(); Assert.AreEqual(1.1, macroStabilityInwardsSoilLayer.Top); - Assert.IsFalse(macroStabilityInwardsSoilLayer.IsAquifer); - Assert.IsEmpty(macroStabilityInwardsSoilLayer.MaterialName); - Assert.AreEqual(Color.Empty, macroStabilityInwardsSoilLayer.Color); + Assert.IsFalse(macroStabilityInwardsSoilLayer.Properties.IsAquifer); + Assert.IsEmpty(macroStabilityInwardsSoilLayer.Properties.MaterialName); + Assert.AreEqual(Color.Empty, macroStabilityInwardsSoilLayer.Properties.Color); mocks.VerifyAll(); } @@ -297,9 +297,9 @@ MacroStabilityInwardsSoilLayer1D macroStabilityInwardsSoilLayer = profile.Layers.First(); Assert.AreEqual(1.1, macroStabilityInwardsSoilLayer.Top); - Assert.IsTrue(macroStabilityInwardsSoilLayer.IsAquifer); - Assert.AreEqual(materialName, macroStabilityInwardsSoilLayer.MaterialName); - Assert.AreEqual(color, macroStabilityInwardsSoilLayer.Color); + Assert.IsTrue(macroStabilityInwardsSoilLayer.Properties.IsAquifer); + Assert.AreEqual(materialName, macroStabilityInwardsSoilLayer.Properties.MaterialName); + Assert.AreEqual(color, macroStabilityInwardsSoilLayer.Properties.Color); mocks.VerifyAll(); } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/MacroStabilityInwardsCalculatorInputTest.cs =================================================================== diff -u -rcd90ebf744fb74f0d4b0dd6ee06f9c39b5faf213 -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/MacroStabilityInwardsCalculatorInputTest.cs (.../MacroStabilityInwardsCalculatorInputTest.cs) (revision cd90ebf744fb74f0d4b0dd6ee06f9c39b5faf213) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/MacroStabilityInwardsCalculatorInputTest.cs (.../MacroStabilityInwardsCalculatorInputTest.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -51,7 +51,10 @@ { new MacroStabilityInwardsSoilLayer1D(random.NextDouble()) { - IsAquifer = true + Properties = + { + IsAquifer = true + } } }, SoilProfileType.SoilProfile1D, 0); Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/MacroStabilityInwardsCalculatorTest.cs =================================================================== diff -u -rcd90ebf744fb74f0d4b0dd6ee06f9c39b5faf213 -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/MacroStabilityInwardsCalculatorTest.cs (.../MacroStabilityInwardsCalculatorTest.cs) (revision cd90ebf744fb74f0d4b0dd6ee06f9c39b5faf213) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/MacroStabilityInwardsCalculatorTest.cs (.../MacroStabilityInwardsCalculatorTest.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -102,7 +102,10 @@ new MacroStabilityInwardsSoilLayer1D(9), new MacroStabilityInwardsSoilLayer1D(4) { - IsAquifer = true + Properties = + { + IsAquifer = true + } }, new MacroStabilityInwardsSoilLayer1D(2), new MacroStabilityInwardsSoilLayer1D(-1) Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test.csproj =================================================================== diff -u -r5906f61fff270a7526253bea07dfecdf680898ed -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test.csproj (.../Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test.csproj) (revision 5906f61fff270a7526253bea07dfecdf680898ed) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test.csproj (.../Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test.csproj) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -51,7 +51,7 @@ - + Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test/TestMacroStabilityInwardsSoilProfile1DTest.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test/TestMacroStabilityInwardsSoilProfile1DTest.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test/TestMacroStabilityInwardsSoilProfile1DTest.cs (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -0,0 +1,100 @@ +// 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.Linq; +using Core.Common.TestUtil; +using NUnit.Framework; +using Ringtoets.MacroStabilityInwards.Primitives; + +namespace Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test +{ + [TestFixture] + public class TestMacroStabilityInwardsSoilProfile1DTest + { + [Test] + public void DefaultConstructor_ExpectedPropertiesSet() + { + // Call + var profile = new TestMacroStabilityInwardsSoilProfile1D(); + + // Assert + Assert.IsEmpty(profile.Name); + Assert.AreEqual(0.0, profile.Bottom); + Assert.AreEqual(SoilProfileType.SoilProfile1D, profile.SoilProfileType); + CollectionAssert.AreEquivalent(new[] + { + true + }, profile.Layers.Select(l => l.Properties.IsAquifer)); + CollectionAssert.AreEquivalent(new[] + { + 0.0 + }, profile.Layers.Select(l => l.Top)); + } + + [Test] + public void Constructor_WitValidName_ExpectedPropertiesSet() + { + // Setup + const string name = "some name"; + + // Call + var profile = new TestMacroStabilityInwardsSoilProfile1D(name); + + // Assert + Assert.AreEqual(name, profile.Name); + Assert.AreEqual(0.0, profile.Bottom); + Assert.AreEqual(SoilProfileType.SoilProfile1D, profile.SoilProfileType); + CollectionAssert.AreEquivalent(new[] + { + true + }, profile.Layers.Select(l => l.Properties.IsAquifer)); + CollectionAssert.AreEquivalent(new[] + { + 0.0 + }, profile.Layers.Select(l => l.Top)); + } + + [Test] + public void Constructor_WitValidNameAndType_ExpectedPropertiesSet() + { + // Setup + const string name = "some name"; + var soilProfileType = new Random(6543).NextEnumValue(); + + // Call + var profile = new TestMacroStabilityInwardsSoilProfile1D(name, soilProfileType); + + // Assert + Assert.AreEqual(name, profile.Name); + Assert.AreEqual(0.0, profile.Bottom); + Assert.AreEqual(soilProfileType, profile.SoilProfileType); + CollectionAssert.AreEquivalent(new[] + { + true + }, profile.Layers.Select(l => l.Properties.IsAquifer)); + CollectionAssert.AreEquivalent(new[] + { + 0.0 + }, profile.Layers.Select(l => l.Top)); + } + } +} \ No newline at end of file Fisheye: Tag 677ec9937ae7eff73a09bf937804ad22e0dc5a4b refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test/TestMacroStabilityInwardsSoilProfileTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil/TestMacroStabilityInwardsSoilProfile1D.cs =================================================================== diff -u -r564a695798dd77c0b90bba14c902c6caefb7786f -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil/TestMacroStabilityInwardsSoilProfile1D.cs (.../TestMacroStabilityInwardsSoilProfile1D.cs) (revision 564a695798dd77c0b90bba14c902c6caefb7786f) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil/TestMacroStabilityInwardsSoilProfile1D.cs (.../TestMacroStabilityInwardsSoilProfile1D.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -74,7 +74,10 @@ { new MacroStabilityInwardsSoilLayer1D(0.0) { - IsAquifer = true + Properties = + { + IsAquifer = true + } } }, soilProfileType, 0) {} } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/FileImporter/StochasticSoilModelUpdateDataStrategyTest.cs =================================================================== diff -u -r564a695798dd77c0b90bba14c902c6caefb7786f -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/FileImporter/StochasticSoilModelUpdateDataStrategyTest.cs (.../StochasticSoilModelUpdateDataStrategyTest.cs) (revision 564a695798dd77c0b90bba14c902c6caefb7786f) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/FileImporter/StochasticSoilModelUpdateDataStrategyTest.cs (.../StochasticSoilModelUpdateDataStrategyTest.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -23,6 +23,7 @@ using System.Collections.Generic; using System.Linq; using Core.Common.Base; +using Core.Common.Base.Geometry; using NUnit.Framework; using Ringtoets.Common.Data.Exceptions; using Ringtoets.Common.Data.UpdateDataStrategies; @@ -310,7 +311,7 @@ } [Test] - public void UpdateModelWithImportedData_ProfilesAssignedToCalculationsOneWithNoChangeInProfile_OnlyCalculationWithChangedProfileUpdated() + public void UpdateModelWithImportedData_ProfilesAssignedToCalculations1DProfileChanged_OnlyCalculationWithChangedProfileUpdated() { // Setup const string modelsName = "same model"; @@ -324,7 +325,7 @@ }, sourceFilePath); StochasticSoilModel readModel = CreateStochasticSoilModel(modelsName); - StochasticSoilProfile changedProfile = CloneAndSlightlyModify(readModel.StochasticSoilProfiles.ElementAt(0)); + StochasticSoilProfile changedProfile = CloneAndSlightlyModify1DProfile(readModel.StochasticSoilProfiles.ElementAt(0)); readModel.StochasticSoilProfiles[0] = changedProfile; var calculationWithUpdatedProfile = new MacroStabilityInwardsCalculationScenario(new GeneralMacroStabilityInwardsInput()); @@ -372,6 +373,68 @@ } [Test] + public void UpdateModelWithImportedData_ProfilesAssignedToCalculations2DProfileChanged_OnlyCalculationWithChangedProfileUpdated() + { + // Setup + const string modelsName = "same model"; + StochasticSoilModel existingModel = CreateStochasticSoilModel(modelsName); + + var failureMechanism = new MacroStabilityInwardsFailureMechanism(); + StochasticSoilModelCollection targetCollection = failureMechanism.StochasticSoilModels; + targetCollection.AddRange(new[] + { + existingModel + }, sourceFilePath); + + StochasticSoilModel readModel = CreateStochasticSoilModel(modelsName); + StochasticSoilProfile changedProfile = CloneAndSlightlyModify2DProfile(readModel.StochasticSoilProfiles.ElementAt(1)); + readModel.StochasticSoilProfiles[1] = changedProfile; + + var calculationWithNotUpdatedProfile = new MacroStabilityInwardsCalculationScenario(new GeneralMacroStabilityInwardsInput()); + calculationWithNotUpdatedProfile.InputParameters.StochasticSoilModel = existingModel; + calculationWithNotUpdatedProfile.InputParameters.StochasticSoilProfile = existingModel.StochasticSoilProfiles[0]; + calculationWithNotUpdatedProfile.Output = new MacroStabilityInwardsOutput(); + + var calculationWithUpdatedProfile = new MacroStabilityInwardsCalculationScenario(new GeneralMacroStabilityInwardsInput()); + calculationWithUpdatedProfile.InputParameters.StochasticSoilModel = existingModel; + calculationWithUpdatedProfile.InputParameters.StochasticSoilProfile = existingModel.StochasticSoilProfiles[1]; + calculationWithUpdatedProfile.Output = new MacroStabilityInwardsOutput(); + + failureMechanism.CalculationsGroup.Children.Add(calculationWithUpdatedProfile); + failureMechanism.CalculationsGroup.Children.Add(calculationWithNotUpdatedProfile); + + var strategy = new StochasticSoilModelUpdateDataStrategy(failureMechanism); + + // Call + IEnumerable affectedObjects = strategy.UpdateModelWithImportedData(new[] + { + readModel + }, sourceFilePath).ToArray(); + + // Assert + StochasticSoilModel firstSoilModel = targetCollection[0]; + Assert.AreSame(existingModel, firstSoilModel); + Assert.AreEqual(2, firstSoilModel.StochasticSoilProfiles.Count); + Assert.AreSame(existingModel.StochasticSoilProfiles[0], firstSoilModel.StochasticSoilProfiles[0]); + Assert.AreSame(existingModel.StochasticSoilProfiles[1], firstSoilModel.StochasticSoilProfiles[1]); + + Assert.IsFalse(calculationWithUpdatedProfile.HasOutput); + Assert.AreSame(existingModel.StochasticSoilProfiles[1], calculationWithUpdatedProfile.InputParameters.StochasticSoilProfile); + + Assert.IsTrue(calculationWithNotUpdatedProfile.HasOutput); + Assert.AreSame(existingModel.StochasticSoilProfiles[0], calculationWithNotUpdatedProfile.InputParameters.StochasticSoilProfile); + + CollectionAssert.AreEquivalent(new IObservable[] + { + targetCollection, + firstSoilModel, + calculationWithUpdatedProfile, + calculationWithUpdatedProfile.InputParameters, + calculationWithUpdatedProfile.InputParameters.StochasticSoilProfile + }, affectedObjects); + } + + [Test] public void UpdateModelWithImportedData_CalculationWithOutputAssignedRemovedSoilModelAndProfile_CalculationUpdatedAndCalculationAndInputReturned() { // Setup @@ -485,16 +548,15 @@ SoilProfileType.SoilProfile1D, 0) }, - new StochasticSoilProfile(0.5, SoilProfileType.SoilProfile1D, 0) + new StochasticSoilProfile(0.5, SoilProfileType.SoilProfile2D, 0) { - SoilProfile = new MacroStabilityInwardsSoilProfile1D( + SoilProfile = new MacroStabilityInwardsSoilProfile2D( "B", - 0.0, new[] { - new MacroStabilityInwardsSoilLayer1D(0.0) + new MacroStabilityInwardsSoilLayer2D(new Ring(new [] { new Point2D(3,2), new Point2D(4,5) }), Enumerable.Empty()) }, - SoilProfileType.SoilProfile1D, + SoilProfileType.SoilProfile2D, 0) } }); @@ -521,8 +583,23 @@ return model; } - private static StochasticSoilProfile CloneAndSlightlyModify(StochasticSoilProfile profile) + private static StochasticSoilProfile CloneAndSlightlyModify2DProfile(StochasticSoilProfile profile) { + var soilProfile = (MacroStabilityInwardsSoilProfile2D) profile.SoilProfile; + return new StochasticSoilProfile(profile.Probability, profile.SoilProfileType, profile.SoilProfileId) + { + SoilProfile = new MacroStabilityInwardsSoilProfile2D( + soilProfile.Name, + soilProfile.Layers.Select(s => new MacroStabilityInwardsSoilLayer2D( + new Ring(s.OuterRing.Points.Select(p => new Point2D(p.Y - 1, p.Y))), + s.Holes)), + soilProfile.SoilProfileType, + soilProfile.MacroStabilityInwardsSoilProfileId) + }; + } + + private static StochasticSoilProfile CloneAndSlightlyModify1DProfile(StochasticSoilProfile profile) + { var soilProfile = (MacroStabilityInwardsSoilProfile1D) profile.SoilProfile; return new StochasticSoilProfile(profile.Probability, profile.SoilProfileType, profile.SoilProfileId) { Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/MacroStabilityInwardsSoilLayer1DTest.cs =================================================================== diff -u -rec27d9f02dc27c2829ed45788fae7d5923d63d3d -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/MacroStabilityInwardsSoilLayer1DTest.cs (.../MacroStabilityInwardsSoilLayer1DTest.cs) (revision ec27d9f02dc27c2829ed45788fae7d5923d63d3d) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/MacroStabilityInwardsSoilLayer1DTest.cs (.../MacroStabilityInwardsSoilLayer1DTest.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -45,37 +45,6 @@ } [Test] - public void MaterialName_Null_ThrowsArgumentNullException() - { - // Setup - double top = new Random(22).NextDouble(); - var layer = new MacroStabilityInwardsSoilLayer1D(top); - - // 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 - double top = new Random(22).NextDouble(); - var layer = new MacroStabilityInwardsSoilLayer1D(top); - - // Call - layer.MaterialName = materialName; - - // Assert - Assert.AreEqual(materialName, layer.MaterialName); - } - - [Test] public void GetHashCode_EqualLayers_AreEqual() { // Setup @@ -136,6 +105,19 @@ } [Test] + public void Equals_DifferentType_ReturnsFalse() + { + // Setup + MacroStabilityInwardsSoilLayer1D layer = CreateRandomLayer(21); + + // Call + bool areEqual = layer.Equals(new object()); + + // Assert + Assert.IsFalse(areEqual); + } + + [Test] public void Equals_Null_ReturnsFalse() { // Setup Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/MacroStabilityInwardsSoilLayer2DTest.cs =================================================================== diff -u -r564a695798dd77c0b90bba14c902c6caefb7786f -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/MacroStabilityInwardsSoilLayer2DTest.cs (.../MacroStabilityInwardsSoilLayer2DTest.cs) (revision 564a695798dd77c0b90bba14c902c6caefb7786f) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/MacroStabilityInwardsSoilLayer2DTest.cs (.../MacroStabilityInwardsSoilLayer2DTest.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -53,7 +53,7 @@ } [Test] - public void Constructor_WithoutHoles_ReturnsNewInstance() + public void Constructor_WithoutHoles_ThrowsArgumentNullException() { // Setup var outerRing = new Ring(new[] @@ -161,6 +161,19 @@ } [Test] + public void Equals_DifferentType_ReturnsFalse() + { + // Setup + MacroStabilityInwardsSoilLayer2D layer = CreateRandomLayer(21); + + // Call + bool areEqual = layer.Equals(new object()); + + // Assert + Assert.IsFalse(areEqual); + } + + [Test] public void Equals_Null_ReturnsFalse() { // Setup Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/MacroStabilityInwardsSoilProfile1DTest.cs =================================================================== diff -u -r376649a985f9523e6ecac956b3abd39ed1a64369 -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/MacroStabilityInwardsSoilProfile1DTest.cs (.../MacroStabilityInwardsSoilProfile1DTest.cs) (revision 376649a985f9523e6ecac956b3abd39ed1a64369) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/MacroStabilityInwardsSoilProfile1DTest.cs (.../MacroStabilityInwardsSoilProfile1DTest.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -72,7 +72,6 @@ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage); } - [Test] public void Constructor_NameNull_ThrowsArgumentNullException() { @@ -108,7 +107,10 @@ { equivalentLayers.Add(new MacroStabilityInwardsSoilLayer1D(random.NextDouble()) { - IsAquifer = i == 0 + Properties = + { + IsAquifer = i == 0 + } }); } @@ -359,9 +361,12 @@ { return new MacroStabilityInwardsSoilLayer1D(random.NextDouble()) { - MaterialName = GetRandomName(random), - Color = Color.FromKnownColor(random.NextEnumValue()), - IsAquifer = random.NextBoolean() + Properties = + { + MaterialName = GetRandomName(random), + Color = Color.FromKnownColor(random.NextEnumValue()), + IsAquifer = random.NextBoolean() + } }; } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/RingTest.cs =================================================================== diff -u -r669e99259a7cc575b5df2be2c0ea7105d9edcbcf -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/RingTest.cs (.../RingTest.cs) (revision 669e99259a7cc575b5df2be2c0ea7105d9edcbcf) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/RingTest.cs (.../RingTest.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -43,26 +43,28 @@ } [Test] - public void Constructor_WithEmptyPoints_ThrowsArgumentException() + public void Constructor_WithoutAtLeastTwoDistinctPoints_ThrowsArgumentException([Range(0, 4)] int times) { // Call - TestDelegate test = () => new Ring(Enumerable.Empty()); + TestDelegate test = () => new Ring(Enumerable.Repeat(new Point2D(3, 2), times)); // Assert - var exception = Assert.Throws(test); + const string expectedMessage = "Need at least two distinct points to define a Ring."; + var exception = TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage); Assert.AreEqual("points", exception.ParamName); } [Test] - public void Constructor_WithSingleUniquePoint_ThrowsArgumentException([Range(0, 4)] int times) + public void Equals_DifferentType_ReturnsFalse() { + // Setup + Ring layer = CreateRing(); + // Call - TestDelegate test = () => new Ring(Enumerable.Repeat(new Point2D(3, 2), times)); + bool areEqual = layer.Equals(new object()); // Assert - const string expectedMessage = "Need at least two points to define a Ring."; - var exception = TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage); - Assert.AreEqual("points", exception.ParamName); + Assert.IsFalse(areEqual); } [Test] @@ -112,6 +114,7 @@ Ring ringA = CreateRandomRing(21); Ring ringB = CreateRandomRing(21); Ring ringC = CreateRandomRing(73); + Ring ringD = CreateRandomRing(21); return new[] { @@ -123,13 +126,21 @@ { TestName = "Equals_RingARingB_True" }, + new TestCaseData(ringB, ringD, true) + { + TestName = "Equals_RingBRingD_True" + }, + new TestCaseData(ringA, ringD, true) + { + TestName = "Equals_RingARingD_True" + }, new TestCaseData(ringB, ringC, false) { TestName = "Equals_RingBRingC_False" }, - new TestCaseData(ringC, ringC, true) + new TestCaseData(ringA, ringC, false) { - TestName = "Equals_RingCRingC_True" + TestName = "Equals_RingARingC_False" } }; } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/SoilLayerPropertiesTest.cs =================================================================== diff -u -r669e99259a7cc575b5df2be2c0ea7105d9edcbcf -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/SoilLayerPropertiesTest.cs (.../SoilLayerPropertiesTest.cs) (revision 669e99259a7cc575b5df2be2c0ea7105d9edcbcf) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/SoilLayerPropertiesTest.cs (.../SoilLayerPropertiesTest.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -76,8 +76,7 @@ public void MaterialName_Null_ThrowsArgumentNullException() { // Setup - double top = new Random(22).NextDouble(); - var layer = new MacroStabilityInwardsSoilLayer1D(top); + var layer = new SoilLayerProperties(); // Call TestDelegate test = () => layer.MaterialName = null; @@ -93,8 +92,7 @@ public void MaterialName_NotNullValue_ValueSet(string materialName) { // Setup - double top = new Random(22).NextDouble(); - var layer = new MacroStabilityInwardsSoilLayer1D(top); + var layer = new SoilLayerProperties(); // Call layer.MaterialName = materialName; @@ -120,6 +118,19 @@ } [Test] + public void Equals_DifferentType_ReturnsFalse() + { + // Setup + SoilLayerProperties layer = CreateRandomProperties(21); + + // Call + bool areEqual = layer.Equals(new object()); + + // Assert + Assert.IsFalse(areEqual); + } + + [Test] public void Equals_Null_ReturnsFalse() { // Setup @@ -169,7 +180,7 @@ yield return new TestCaseData(new Action(lp => lp.ShearStrengthModel = (ShearStrengthModel) 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.IsAquifer)); + yield return new TestCaseData(new Action(lp => lp.UsePop = !lp.UsePop)); yield return new TestCaseData(new Action(lp => lp.Color = lp.Color == Color.Aqua ? 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)); @@ -197,6 +208,7 @@ SoilLayerProperties propertiesA = CreateRandomProperties(21); SoilLayerProperties propertiesB = CreateRandomProperties(21); SoilLayerProperties propertiesC = CreateRandomProperties(73); + SoilLayerProperties propertiesD = CreateRandomProperties(21); return new[] { @@ -208,13 +220,21 @@ { 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(propertiesC, propertiesC, true) + new TestCaseData(propertiesA, propertiesC, false) { - TestName = "Equals_LayerCLayerC_True" + TestName = "Equals_LayerALayerC_False" } }; } Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/StochasticSoilProfile.cs =================================================================== diff -u -rec27d9f02dc27c2829ed45788fae7d5923d63d3d -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/Piping/src/Ringtoets.Piping.Data/StochasticSoilProfile.cs (.../StochasticSoilProfile.cs) (revision ec27d9f02dc27c2829ed45788fae7d5923d63d3d) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/StochasticSoilProfile.cs (.../StochasticSoilProfile.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -141,7 +141,7 @@ return true; } var other = obj as StochasticSoilProfile; - return other != null && Equals((StochasticSoilProfile) obj); + return other != null && Equals(other); } public override int GetHashCode() Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingSoilLayerTable.cs =================================================================== diff -u -r81fa8a9bf3bd503cbd280e88b8f6037a840cff12 -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingSoilLayerTable.cs (.../PipingSoilLayerTable.cs) (revision 81fa8a9bf3bd503cbd280e88b8f6037a840cff12) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingSoilLayerTable.cs (.../PipingSoilLayerTable.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -96,19 +96,19 @@ public bool IsAquifer { get; } /// - /// Gets the mean of the distrubtion for the volumic weight of the below the phreatic level. + /// Gets the mean of the distribution for the volumic weight of the below the phreatic level. /// [kN/m³] /// public RoundedDouble BelowPhreaticLevelMean { get; } /// - /// Gets the deviation of the distrubtion for the volumic weight of the below the phreatic level. + /// Gets the deviation of the distribution for the volumic weight of the below the phreatic level. /// [kN/m³] /// public RoundedDouble BelowPhreaticLevelDeviation { get; } /// - /// Gets the shift of the distrubtion for the volumic weight of the below the phreatic level. + /// Gets the shift of the distribution for the volumic weight of the below the phreatic level. /// [kN/m³] /// public RoundedDouble BelowPhreaticLevelShift { get; } Index: Ringtoets/Piping/src/Ringtoets.Piping.Primitives/PipingSoilLayer.cs =================================================================== diff -u -rec27d9f02dc27c2829ed45788fae7d5923d63d3d -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/Piping/src/Ringtoets.Piping.Primitives/PipingSoilLayer.cs (.../PipingSoilLayer.cs) (revision ec27d9f02dc27c2829ed45788fae7d5923d63d3d) +++ Ringtoets/Piping/src/Ringtoets.Piping.Primitives/PipingSoilLayer.cs (.../PipingSoilLayer.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -55,24 +55,24 @@ public double Top { get; } /// - /// Gets or sets a value indicating whether or not the is an aquifer. + /// Gets or sets a value indicating whether the is an aquifer. /// public bool IsAquifer { get; set; } /// - /// Gets or sets the mean of the distrubtion for the volumic weight of the below the phreatic level. + /// Gets or sets the mean of the distribution for the volumic weight of the below the phreatic level. /// [kN/m³] /// public double BelowPhreaticLevelMean { get; set; } /// - /// Gets or sets the deviation of the distrubtion for the volumic weight of the below the phreatic level. + /// Gets or sets the deviation of the distribution for the volumic weight of the below the phreatic level. /// [kN/m³] /// public double BelowPhreaticLevelDeviation { get; set; } /// - /// Gets or sets the shift of the distrubtion for the volumic weight of the below the phreatic level. + /// Gets or sets the shift of the distribution for the volumic weight of the below the phreatic level. /// [kN/m³] /// public double BelowPhreaticLevelShift { get; set; } @@ -139,7 +139,7 @@ return true; } var other = obj as PipingSoilLayer; - return other != null && Equals((PipingSoilLayer) obj); + return other != null && Equals(other); } public override int GetHashCode() Index: Ringtoets/Piping/src/Ringtoets.Piping.Primitives/PipingSoilProfile.cs =================================================================== diff -u -rec27d9f02dc27c2829ed45788fae7d5923d63d3d -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/Piping/src/Ringtoets.Piping.Primitives/PipingSoilProfile.cs (.../PipingSoilProfile.cs) (revision ec27d9f02dc27c2829ed45788fae7d5923d63d3d) +++ Ringtoets/Piping/src/Ringtoets.Piping.Primitives/PipingSoilProfile.cs (.../PipingSoilProfile.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -34,7 +34,7 @@ private PipingSoilLayer[] layers; /// - /// Creates a new instance ofL , with the given , and . + /// Creates a new instance of , with the given , and . /// A new collection is created for and used in the . /// /// The name of the profile. @@ -131,7 +131,7 @@ return true; } var other = obj as PipingSoilProfile; - return other!= null && Equals((PipingSoilProfile)obj); + return other!= null && Equals(other); } public override int GetHashCode() Index: Ringtoets/Piping/src/Ringtoets.Piping.Primitives/PipingSurfaceLine.cs =================================================================== diff -u -r94e24e96e5e908960f5559c5d98021153f4e4120 -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/Piping/src/Ringtoets.Piping.Primitives/PipingSurfaceLine.cs (.../PipingSurfaceLine.cs) (revision 94e24e96e5e908960f5559c5d98021153f4e4120) +++ Ringtoets/Piping/src/Ringtoets.Piping.Primitives/PipingSurfaceLine.cs (.../PipingSurfaceLine.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -204,7 +204,7 @@ return true; } var other = obj as PipingSurfaceLine; - return other != null && Equals((PipingSurfaceLine) obj); + return other != null && Equals(other); } public override int GetHashCode() Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/StochasticSoilProfileTest.cs =================================================================== diff -u -rec27d9f02dc27c2829ed45788fae7d5923d63d3d -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/StochasticSoilProfileTest.cs (.../StochasticSoilProfileTest.cs) (revision ec27d9f02dc27c2829ed45788fae7d5923d63d3d) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/StochasticSoilProfileTest.cs (.../StochasticSoilProfileTest.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -176,6 +176,19 @@ } [Test] + public void Equals_OtherType_ReturnsFalse() + { + // Setup + var stochasticProfile = new StochasticSoilProfile(0.0, SoilProfileType.SoilProfile1D, 0); + + // Call + bool areEqual = stochasticProfile.Equals(new object()); + + // Assert + Assert.IsFalse(areEqual); + } + + [Test] public void Equals_Null_ReturnsFalse() { // Setup Index: Ringtoets/Piping/test/Ringtoets.Piping.Primitives.Test/PipingSoilLayerTest.cs =================================================================== diff -u -rec27d9f02dc27c2829ed45788fae7d5923d63d3d -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/Piping/test/Ringtoets.Piping.Primitives.Test/PipingSoilLayerTest.cs (.../PipingSoilLayerTest.cs) (revision ec27d9f02dc27c2829ed45788fae7d5923d63d3d) +++ Ringtoets/Piping/test/Ringtoets.Piping.Primitives.Test/PipingSoilLayerTest.cs (.../PipingSoilLayerTest.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -103,6 +103,19 @@ } [Test] + public void Equals_DifferentType_ReturnsFalse() + { + // Setup + PipingSoilLayer layer = CreateRandomLayer(21); + + // Call + bool areEqual = layer.Equals(new object()); + + // Assert + Assert.IsFalse(areEqual); + } + + [Test] public void Equals_Null_ReturnsFalse() { // Setup Index: Ringtoets/Piping/test/Ringtoets.Piping.Primitives.Test/PipingSoilProfileTest.cs =================================================================== diff -u -rec27d9f02dc27c2829ed45788fae7d5923d63d3d -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b --- Ringtoets/Piping/test/Ringtoets.Piping.Primitives.Test/PipingSoilProfileTest.cs (.../PipingSoilProfileTest.cs) (revision ec27d9f02dc27c2829ed45788fae7d5923d63d3d) +++ Ringtoets/Piping/test/Ringtoets.Piping.Primitives.Test/PipingSoilProfileTest.cs (.../PipingSoilProfileTest.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) @@ -235,6 +235,19 @@ } [Test] + public void Equals_DifferentType_ReturnsFalse() + { + // Setup + PipingSoilProfile profile = CreateRandomProfile(2); + + // Call + bool areEqual = profile.Equals(new object()); + + // Assert + Assert.IsFalse(areEqual); + } + + [Test] public void Equals_Null_ReturnsFalse() { // Setup