Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/SoilLayerProperties.cs =================================================================== diff -u -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b -r11770f197071c45397a34ec91fc3981acf05c850 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/SoilLayerProperties.cs (.../SoilLayerProperties.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/SoilLayerProperties.cs (.../SoilLayerProperties.cs) (revision 11770f197071c45397a34ec91fc3981acf05c850) @@ -229,7 +229,7 @@ { return string.Equals(materialName, other.materialName, StringComparison.InvariantCulture) && IsAquifer == other.IsAquifer - && Color.Equals(other.Color) + && Color.ToArgb().Equals(other.Color.ToArgb()) && UsePop == other.UsePop && ShearStrengthModel == other.ShearStrengthModel && AbovePhreaticLevelMean.Equals(other.AbovePhreaticLevelMean) Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/Ringtoets.MacroStabilityInwards.Data.Test.csproj =================================================================== diff -u -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b -r11770f197071c45397a34ec91fc3981acf05c850 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/Ringtoets.MacroStabilityInwards.Data.Test.csproj (.../Ringtoets.MacroStabilityInwards.Data.Test.csproj) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/Ringtoets.MacroStabilityInwards.Data.Test.csproj (.../Ringtoets.MacroStabilityInwards.Data.Test.csproj) (revision 11770f197071c45397a34ec91fc3981acf05c850) @@ -61,6 +61,7 @@ + @@ -71,6 +72,7 @@ + Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilLayerUnderSurfaceLineTest.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilLayerUnderSurfaceLineTest.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilLayerUnderSurfaceLineTest.cs (revision 11770f197071c45397a34ec91fc3981acf05c850) @@ -0,0 +1,122 @@ +// 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 NUnit.Framework; +using Ringtoets.MacroStabilityInwards.Primitives; + +namespace Ringtoets.MacroStabilityInwards.Data.Test +{ + [TestFixture] + public class SoilLayerUnderSurfaceLineTest + { + [Test] + public void Constructor_WithoutOuterRingWithHolesAndProperties_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => new SoilLayerUnderSurfaceLine(null, Enumerable.Empty(), new SoilLayerProperties()); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("outerRing", exception.ParamName); + } + + [Test] + public void Constructor_WithoutHolesWithOuterRingAndProperties_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => new SoilLayerUnderSurfaceLine(new Point2D[0], null, new SoilLayerProperties()); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("holes", exception.ParamName); + } + + [Test] + public void Constructor_WithoutPropertiesWithOuterRingAndHoles_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => new SoilLayerUnderSurfaceLine(new Point2D[0], Enumerable.Empty(), null); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("properties", exception.ParamName); + } + + [Test] + public void Constructor_WithoutOuterRingWithProperties_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => new SoilLayerUnderSurfaceLine(null, new SoilLayerProperties()); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("outerRing", exception.ParamName); + } + + [Test] + public void Constructor_WithoutPropertiesWithOuterRing_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => new SoilLayerUnderSurfaceLine(new Point2D[0], null); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("properties", exception.ParamName); + } + + [Test] + public void Constructor_WithOuterRingAndHolesAndProperties_NewInstanceWithPropertiesSet() + { + // Call + var outerRing = new Point2D[0]; + var holes = Enumerable.Empty(); + var properties = new SoilLayerProperties(); + + // Setup + var layer = new SoilLayerUnderSurfaceLine(outerRing, holes, properties); + + // Assert + Assert.AreSame(outerRing, layer.OuterRing); + Assert.AreSame(holes, layer.Holes); + Assert.AreSame(properties, layer.Properties); + } + + [Test] + public void Constructor_WithOuterRingAndProperties_NewInstanceWithPropertiesSet() + { + // Call + var outerRing = new Point2D[0]; + var properties = new SoilLayerProperties(); + + // Setup + var layer = new SoilLayerUnderSurfaceLine(outerRing, properties); + + // Assert + Assert.AreSame(outerRing, layer.OuterRing); + Assert.IsEmpty(layer.Holes); + Assert.AreSame(properties, layer.Properties); + } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilProfileUnderSurfaceLineTest.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilProfileUnderSurfaceLineTest.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilProfileUnderSurfaceLineTest.cs (revision 11770f197071c45397a34ec91fc3981acf05c850) @@ -0,0 +1,56 @@ +// 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 NUnit.Framework; + +namespace Ringtoets.MacroStabilityInwards.Data.Test +{ + [TestFixture] + public class SoilProfileUnderSurfaceLineTest + { + [Test] + public void Constructor_WithoutLayersUnderSurfaceLine_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => new SoilProfileUnderSurfaceLine(null); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("layersUnderSurfaceLine", exception.ParamName); + } + + [Test] + public void Constructor_WithLayersUnderSurfaceLine_NewInstanceWithPropertiesSet() + { + // Call + IEnumerable layers = Enumerable.Empty(); + + // Setup + var profile = new SoilProfileUnderSurfaceLine(layers); + + // Assert + Assert.AreSame(layers, profile.LayersUnderSurfaceLine); + } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/SoilLayerPropertiesTest.cs =================================================================== diff -u -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b -r11770f197071c45397a34ec91fc3981acf05c850 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/SoilLayerPropertiesTest.cs (.../SoilLayerPropertiesTest.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/SoilLayerPropertiesTest.cs (.../SoilLayerPropertiesTest.cs) (revision 11770f197071c45397a34ec91fc3981acf05c850) @@ -181,7 +181,7 @@ yield return new TestCaseData(new Action(lp => lp.MaterialName = "interesting")); yield return new TestCaseData(new Action(lp => lp.IsAquifer = !lp.IsAquifer)); yield return new TestCaseData(new Action(lp => lp.UsePop = !lp.UsePop)); - yield return new TestCaseData(new Action(lp => lp.Color = lp.Color == Color.Aqua ? Color.Bisque : Color.Aqua)); + yield return new TestCaseData(new Action(lp => lp.Color = lp.Color.ToArgb().Equals(Color.Aqua.ToArgb()) ? Color.Bisque : Color.Aqua)); yield return new TestCaseData(new Action(lp => lp.AbovePhreaticLevelMean = 1.0 - lp.AbovePhreaticLevelMean)); yield return new TestCaseData(new Action(lp => lp.AbovePhreaticLevelDeviation = 1.0 - lp.AbovePhreaticLevelDeviation)); yield return new TestCaseData(new Action(lp => lp.BelowPhreaticLevelMean = 1.0 - lp.BelowPhreaticLevelMean)); Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/StochasticSoilProfileTest.cs =================================================================== diff -u -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b -r11770f197071c45397a34ec91fc3981acf05c850 --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/StochasticSoilProfileTest.cs (.../StochasticSoilProfileTest.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/StochasticSoilProfileTest.cs (.../StochasticSoilProfileTest.cs) (revision 11770f197071c45397a34ec91fc3981acf05c850) @@ -230,12 +230,12 @@ } [Test] - public void ToString_WithNullName_ReturnsStringEmpty() + public void ToString_WithProfile_ReturnsToStringResultOfProfile() { // Setup var stochasticSoilProfile = new StochasticSoilProfile(0.0, SoilProfileType.SoilProfile1D, 0) { - SoilProfile = new PipingSoilProfile(null, 0.0, new[] + SoilProfile = new PipingSoilProfile("randomName", 0.0, new[] { new PipingSoilLayer(0.0) }, SoilProfileType.SoilProfile1D, 0) @@ -245,30 +245,10 @@ string text = stochasticSoilProfile.ToString(); // Assert - Assert.IsEmpty(text); + Assert.AreEqual(stochasticSoilProfile.SoilProfile.ToString(), text); } - [Test] - [TestCase("")] - [TestCase("some name")] - public void ToString_WithName_ReturnsName(string name) - { - // Setup - var stochasticSoilProfile = new StochasticSoilProfile(0.0, SoilProfileType.SoilProfile1D, 0) - { - SoilProfile = new PipingSoilProfile(name, 0.0, new[] - { - new PipingSoilLayer(0.0) - }, SoilProfileType.SoilProfile1D, 0) - }; - // Call - string text = stochasticSoilProfile.ToString(); - - // Assert - Assert.AreEqual(name, text); - } - private class TestStochasticSoilProfile : StochasticSoilProfile { public TestStochasticSoilProfile(StochasticSoilProfile profile) @@ -312,6 +292,7 @@ StochasticSoilProfile profileA = CreateRandomStochasticProfile(21); StochasticSoilProfile profileB = CreateRandomStochasticProfile(21); StochasticSoilProfile profileC = CreateRandomStochasticProfile(73); + StochasticSoilProfile profileD = CreateRandomStochasticProfile(21); var profileE = new StochasticSoilProfile(0.5, SoilProfileType.SoilProfile1D, 25); var profileF = new StochasticSoilProfile(0.5, SoilProfileType.SoilProfile1D, 45); @@ -321,10 +302,22 @@ { TestName = "Equals_ProfileAProfileB_True" }, + new TestCaseData(profileB, profileD, true) + { + TestName = "Equals_ProfileBProfileD_True" + }, + new TestCaseData(profileA, profileD, true) + { + TestName = "Equals_ProfileAProfileD_True" + }, new TestCaseData(profileB, profileC, false) { TestName = "Equals_ProfileBProfileC_False" }, + new TestCaseData(profileA, profileC, false) + { + TestName = "Equals_ProfileAProfileC_False" + }, new TestCaseData(profileE, profileF, true) { TestName = "Equals_DifferentIds_True"