Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/StochasticSoilProfileTest.cs =================================================================== diff -u -r583456a0f5395189a54a8cedf4e4a7b40945d990 -r303f3924f66df0bc726646b29031a926a94882bc --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/StochasticSoilProfileTest.cs (.../StochasticSoilProfileTest.cs) (revision 583456a0f5395189a54a8cedf4e4a7b40945d990) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/StochasticSoilProfileTest.cs (.../StochasticSoilProfileTest.cs) (revision 303f3924f66df0bc726646b29031a926a94882bc) @@ -120,27 +120,48 @@ } [Test] - public void Update_WithValidProfile_UpdatesProperties() + [TestCaseSource(nameof(StochasticProfileUnequalCombinations))] + public void Update_WithValidProfile_UpdatesProperties(StochasticSoilProfile stochasticProfile, StochasticSoilProfile otherStochasticProfile) { - // Setup - var newProbability = 1.0; - var newProfile = new TestPipingSoilProfile(); - var otherStochasticProfile = new StochasticSoilProfile(newProbability, SoilProfileType.SoilProfile1D, 0) - { - SoilProfile = newProfile - }; - - var stochasticProfile = new StochasticSoilProfile(0.0, SoilProfileType.SoilProfile1D, 0); - // Call bool updated = stochasticProfile.Update(otherStochasticProfile); // Assert Assert.IsTrue(updated); - Assert.AreEqual(newProbability, stochasticProfile.Probability); - Assert.AreSame(newProfile, stochasticProfile.SoilProfile); + Assert.AreEqual(otherStochasticProfile.Probability, stochasticProfile.Probability); + Assert.AreEqual(otherStochasticProfile.SoilProfileType, stochasticProfile.SoilProfileType); + Assert.AreSame(otherStochasticProfile.SoilProfile, stochasticProfile.SoilProfile); } + private static TestCaseData[] StochasticProfileUnequalCombinations() + { + const string profileName = "newProfile"; + var stochasticSoilProfile = new StochasticSoilProfile(1.0, SoilProfileType.SoilProfile1D, 0) + { + SoilProfile = new TestPipingSoilProfile(profileName, SoilProfileType.SoilProfile1D) + }; + var otherStochasticSoilProfileA = new StochasticSoilProfile(0.5, SoilProfileType.SoilProfile1D, 0) + { + SoilProfile = new TestPipingSoilProfile(profileName, SoilProfileType.SoilProfile1D) + }; + var otherStochasticSoilProfileB = new StochasticSoilProfile(1.0, SoilProfileType.SoilProfile2D, 0) + { + SoilProfile = new TestPipingSoilProfile(profileName, SoilProfileType.SoilProfile2D) + }; + + return new[] + { + new TestCaseData(stochasticSoilProfile, otherStochasticSoilProfileA) + { + TestName = "Update_ProfileWithProfileA_UpdatesProperties" + }, + new TestCaseData(stochasticSoilProfile, otherStochasticSoilProfileB) + { + TestName = "Update_ProfileWithProfileB_UpdatesProperties" + } + }; + } + [Test] public void Update_WithEqualProfile_ReturnsFalse() { @@ -255,8 +276,8 @@ StochasticSoilProfile profileA = CreateRandomStochasticProfile(21); StochasticSoilProfile profileB = CreateRandomStochasticProfile(21); StochasticSoilProfile profileC = CreateRandomStochasticProfile(73); - StochasticSoilProfile profileE = new StochasticSoilProfile(0.5, SoilProfileType.SoilProfile1D, 25); - StochasticSoilProfile profileF = new StochasticSoilProfile(0.5, SoilProfileType.SoilProfile1D, 45); + var profileE = new StochasticSoilProfile(0.5, SoilProfileType.SoilProfile1D, 25); + var profileF = new StochasticSoilProfile(0.5, SoilProfileType.SoilProfile1D, 45); return new[] { @@ -278,7 +299,7 @@ private static StochasticSoilProfile CreateRandomStochasticProfile(int randomSeed) { var random = new Random(randomSeed); - return new StochasticSoilProfile(random.NextDouble(), SoilProfileType.SoilProfile1D, profileIdRandom.Next()) + return new StochasticSoilProfile(random.NextDouble(), random.NextEnumValue(), profileIdRandom.Next()) { SoilProfile = CreateRandomProfile(random) }; @@ -301,7 +322,7 @@ PermeabilityDeviation = random.NextDouble(), PermeabilityMean = random.NextDouble() } - }, SoilProfileType.SoilProfile1D, random.Next()); + }, random.NextEnumValue(), random.Next()); } private static string GetRandomName(Random random)