Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.TestUtil.Test/HeightStructurePermutationHelperTest.cs =================================================================== diff -u -rad440d0e14ea249a0ae198e634ab6aa5d72a3977 -rb869895cec4a159381b5d2db15b48744dd66ab60 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.TestUtil.Test/HeightStructurePermutationHelperTest.cs (.../HeightStructurePermutationHelperTest.cs) (revision ad440d0e14ea249a0ae198e634ab6aa5d72a3977) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.TestUtil.Test/HeightStructurePermutationHelperTest.cs (.../HeightStructurePermutationHelperTest.cs) (revision b869895cec4a159381b5d2db15b48744dd66ab60) @@ -29,13 +29,50 @@ public class HeightStructurePermutationHelperTest { [Test] - public void DifferentHeightStructureWithSameId_ReturnsExpectedTestCaseData() + public void DifferentHeightStructures_ReturnsExpectedTestCaseData() { // Setup var referenceStructure = new TestHeightStructure(); var differentStructures = new List(); // Call + List testCaseDatas = HeightStructurePermutationHelper.DifferentHeightStructures("A", "B").ToList(); + + // Assert + Assert.AreEqual(11, testCaseDatas.Count); + IEnumerable testNames = testCaseDatas + .Select(tcd => tcd.TestName) + .ToList(); + Assert.AreEqual(11, testNames.Distinct().Count()); + Assert.IsTrue(testNames.All(tn => tn.StartsWith("A_"))); + Assert.IsTrue(testNames.All(tn => tn.EndsWith("_B"))); + IEnumerable structures = testCaseDatas + .Select(tcd => tcd.Arguments[0]) + .OfType() + .ToList(); + Assert.AreEqual(11, structures.Count()); + differentStructures.Add(structures.Single(s => !s.Id.Equals(referenceStructure.Id))); + differentStructures.Add(structures.Single(s => !s.Name.Equals(referenceStructure.Name))); + differentStructures.Add(structures.Single(s => !s.Location.Equals(referenceStructure.Location))); + differentStructures.Add(structures.Single(s => !s.AllowedLevelIncreaseStorage.Equals(referenceStructure.AllowedLevelIncreaseStorage))); + differentStructures.Add(structures.Single(s => !s.CriticalOvertoppingDischarge.Equals(referenceStructure.CriticalOvertoppingDischarge))); + differentStructures.Add(structures.Single(s => !s.FlowWidthAtBottomProtection.Equals(referenceStructure.FlowWidthAtBottomProtection))); + differentStructures.Add(structures.Single(s => !s.LevelCrestStructure.Equals(referenceStructure.LevelCrestStructure))); + differentStructures.Add(structures.Single(s => !s.StorageStructureArea.Equals(referenceStructure.StorageStructureArea))); + differentStructures.Add(structures.Single(s => !s.WidthFlowApertures.Equals(referenceStructure.WidthFlowApertures))); + differentStructures.Add(structures.Single(s => !s.FailureProbabilityStructureWithErosion.Equals(referenceStructure.FailureProbabilityStructureWithErosion))); + differentStructures.Add(structures.Single(s => !s.StructureNormalOrientation.Equals(referenceStructure.StructureNormalOrientation))); + Assert.AreEqual(11, differentStructures.Distinct().Count()); + } + + [Test] + public void DifferentHeightStructuresWithSameId_ReturnsExpectedTestCaseData() + { + // Setup + var referenceStructure = new TestHeightStructure(); + var differentStructures = new List(); + + // Call List testCaseDatas = HeightStructurePermutationHelper.DifferentHeightStructuresWithSameId("A", "B").ToList(); // Assert Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.TestUtil/HeightStructurePermutationHelper.cs =================================================================== diff -u -r597f2ecd0c9cb1aedf4bef978b209d49f63b08fe -rb869895cec4a159381b5d2db15b48744dd66ab60 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.TestUtil/HeightStructurePermutationHelper.cs (.../HeightStructurePermutationHelper.cs) (revision 597f2ecd0c9cb1aedf4bef978b209d49f63b08fe) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.TestUtil/HeightStructurePermutationHelper.cs (.../HeightStructurePermutationHelper.cs) (revision b869895cec4a159381b5d2db15b48744dd66ab60) @@ -34,6 +34,34 @@ public static class HeightStructurePermutationHelper { /// + /// Returns a collection of modified entities. + /// + /// The name of the target to test while using the test case source. + /// A description of the result of the test while using the test case source. + /// The collection of test case data. + /// + /// [TestCaseSource(typeof(HeightStructurePermutationHelper), + /// nameof(HeightStructurePermutationHelper.DifferentHeightStructures), + /// new object[] + /// { + /// "TargetMethodName", + /// "TestResult" + /// })] + /// + public static IEnumerable DifferentHeightStructures(string targetName, string testResultDescription) + { + var testCaseData = new List + { + new TestCaseData(new TestHeightStructure("Different id")) + .SetName($"{targetName}_DifferentId_{testResultDescription}") + }; + + testCaseData.AddRange(DifferentHeightStructuresWithSameId(targetName, testResultDescription)); + + return testCaseData; + } + + /// /// Returns a collection of modified entities, which all differ /// except for their id. /// @@ -75,7 +103,7 @@ /// The collection of test case data. /// /// [TestCaseSource(typeof(HeightStructurePermutationHelper), - /// nameof(HeightStructurePermutationHelper.DifferentHeightStructuresWithSameId), + /// nameof(HeightStructurePermutationHelper.DifferentHeightStructuresWithSameIdNameAndLocation), /// new object[] /// { /// "TargetMethodName",