Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/StochasticSoilProfileTest.cs =================================================================== diff -u -r4ab7b653ebbf2ff9962d1e6a326029d07c225548 -r564a695798dd77c0b90bba14c902c6caefb7786f --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/StochasticSoilProfileTest.cs (.../StochasticSoilProfileTest.cs) (revision 4ab7b653ebbf2ff9962d1e6a326029d07c225548) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/StochasticSoilProfileTest.cs (.../StochasticSoilProfileTest.cs) (revision 564a695798dd77c0b90bba14c902c6caefb7786f) @@ -20,12 +20,9 @@ // All rights reserved. using System; -using System.Drawing; using Core.Common.Base; using Core.Common.TestUtil; using NUnit.Framework; -using Rhino.Mocks; -using Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil; using Ringtoets.MacroStabilityInwards.Primitives; namespace Ringtoets.MacroStabilityInwards.Data.Test @@ -139,7 +136,7 @@ { // Setup const double probability = 1.0; - var profile = new TestMacroStabilityInwardsSoilProfile(); + var profile = new TestSoilProfile(); var stochasticProfile = new StochasticSoilProfile(probability, SoilProfileType.SoilProfile1D, 0) { SoilProfile = profile @@ -206,39 +203,27 @@ [Test] [TestCase("")] [TestCase("some name")] - public void ToString_WithName_ReturnsName(string name) + public void ToString_WithProfile_ReturnsToStringResultOfProfile(string name) { // Setup + var profile = new TestSoilProfile(); var stochasticSoilProfile = new StochasticSoilProfile(0.0, SoilProfileType.SoilProfile1D, 0) { - SoilProfile = new MacroStabilityInwardsSoilProfile1D(name, 0.0, new[] - { - new MacroStabilityInwardsSoilLayer1D(0.0) - }, SoilProfileType.SoilProfile1D, 0) + SoilProfile = profile }; // Call string text = stochasticSoilProfile.ToString(); // Assert - Assert.AreEqual(name, text); + Assert.AreEqual(profile.ToString(), text); } private static TestCaseData[] StochasticProfileUnequalCombinations() { - const string profileName = "newProfile"; - var stochasticSoilProfile = new StochasticSoilProfile(1.0, SoilProfileType.SoilProfile1D, 0) - { - SoilProfile = new TestMacroStabilityInwardsSoilProfile(profileName, SoilProfileType.SoilProfile1D) - }; - var otherStochasticSoilProfileA = new StochasticSoilProfile(0.5, SoilProfileType.SoilProfile1D, 0) - { - SoilProfile = new TestMacroStabilityInwardsSoilProfile(profileName, SoilProfileType.SoilProfile1D) - }; - var otherStochasticSoilProfileB = new StochasticSoilProfile(1.0, SoilProfileType.SoilProfile2D, 0) - { - SoilProfile = new TestMacroStabilityInwardsSoilProfile(profileName, SoilProfileType.SoilProfile2D) - }; + var stochasticSoilProfile = new StochasticSoilProfile(1.0, SoilProfileType.SoilProfile1D, 0); + var otherStochasticSoilProfileA = new StochasticSoilProfile(0.5, SoilProfileType.SoilProfile1D, 0); + var otherStochasticSoilProfileB = new StochasticSoilProfile(1.0, SoilProfileType.SoilProfile2D, 0); return new[] { @@ -287,22 +272,37 @@ }; } - private static MacroStabilityInwardsSoilProfile1D CreateRandomProfile(Random random) + private static TestSoilProfile CreateRandomProfile(Random random) { - return new MacroStabilityInwardsSoilProfile1D(GetRandomName(random), -1.0 - random.NextDouble(), new[] - { - new MacroStabilityInwardsSoilLayer1D(random.NextDouble()) - { - MaterialName = GetRandomName(random), - Color = Color.FromKnownColor(random.NextEnumValue()), - IsAquifer = random.NextBoolean() - } - }, random.NextEnumValue(), random.Next()); + return new TestSoilProfile(GetRandomName(random)); } private static string GetRandomName(Random random) { return new string('x', random.Next(0, 40)); } + + private class TestSoilProfile : ISoilProfile + { + public TestSoilProfile() {} + + public TestSoilProfile(string name) + { + Name = name; + } + + public string Name { get; } + + public override int GetHashCode() + { + return 0; + } + + public override bool Equals(object obj) + { + var other = obj as ISoilProfile; + return other != null && Name.Equals(other.Name); + } + } } } \ No newline at end of file