Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.TestUtil.Test/ClosingStructurePermutationHelperTest.cs =================================================================== diff -u -rad440d0e14ea249a0ae198e634ab6aa5d72a3977 -r39e83a67849b8408e6c2879de1dbb0241739cc74 --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.TestUtil.Test/ClosingStructurePermutationHelperTest.cs (.../ClosingStructurePermutationHelperTest.cs) (revision ad440d0e14ea249a0ae198e634ab6aa5d72a3977) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.TestUtil.Test/ClosingStructurePermutationHelperTest.cs (.../ClosingStructurePermutationHelperTest.cs) (revision 39e83a67849b8408e6c2879de1dbb0241739cc74) @@ -29,13 +29,57 @@ public class ClosingStructurePermutationHelperTest { [Test] - public void DifferentClosingStructureWithSameId_ReturnsExpectedTestCaseData() + public void DifferentClosingStructures_ReturnsExpectedTestCaseData() { // Setup var referenceStructure = new TestClosingStructure(); var differentStructures = new List(); // Call + List testCaseDatas = ClosingStructurePermutationHelper.DifferentClosingStructures("A", "B").ToList(); + + // Assert + Assert.AreEqual(18, testCaseDatas.Count); + IEnumerable testNames = testCaseDatas + .Select(tcd => tcd.TestName) + .ToList(); + Assert.AreEqual(18, 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(18, 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.AreaFlowApertures.Equals(referenceStructure.AreaFlowApertures))); + 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.InsideWaterLevel.Equals(referenceStructure.InsideWaterLevel))); + differentStructures.Add(structures.Single(s => !s.LevelCrestStructureNotClosing.Equals(referenceStructure.LevelCrestStructureNotClosing))); + differentStructures.Add(structures.Single(s => !s.StorageStructureArea.Equals(referenceStructure.StorageStructureArea))); + differentStructures.Add(structures.Single(s => !s.ThresholdHeightOpenWeir.Equals(referenceStructure.ThresholdHeightOpenWeir))); + differentStructures.Add(structures.Single(s => !s.WidthFlowApertures.Equals(referenceStructure.WidthFlowApertures))); + differentStructures.Add(structures.Single(s => !s.FailureProbabilityReparation.Equals(referenceStructure.FailureProbabilityReparation))); + differentStructures.Add(structures.Single(s => !s.FailureProbabilityOpenStructure.Equals(referenceStructure.FailureProbabilityOpenStructure))); + differentStructures.Add(structures.Single(s => !s.IdenticalApertures.Equals(referenceStructure.IdenticalApertures))); + differentStructures.Add(structures.Single(s => !s.InflowModelType.Equals(referenceStructure.InflowModelType))); + differentStructures.Add(structures.Single(s => !s.ProbabilityOrFrequencyOpenStructureBeforeFlooding.Equals(referenceStructure.ProbabilityOrFrequencyOpenStructureBeforeFlooding))); + differentStructures.Add(structures.Single(s => !s.StructureNormalOrientation.Equals(referenceStructure.StructureNormalOrientation))); + Assert.AreEqual(18, differentStructures.Distinct().Count()); + } + + [Test] + public void DifferentClosingStructuresWithSameId_ReturnsExpectedTestCaseData() + { + // Setup + var referenceStructure = new TestClosingStructure(); + var differentStructures = new List(); + + // Call List testCaseDatas = ClosingStructurePermutationHelper.DifferentClosingStructuresWithSameId("A", "B").ToList(); // Assert Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.TestUtil/ClosingStructurePermutationHelper.cs =================================================================== diff -u -r597f2ecd0c9cb1aedf4bef978b209d49f63b08fe -r39e83a67849b8408e6c2879de1dbb0241739cc74 --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.TestUtil/ClosingStructurePermutationHelper.cs (.../ClosingStructurePermutationHelper.cs) (revision 597f2ecd0c9cb1aedf4bef978b209d49f63b08fe) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.TestUtil/ClosingStructurePermutationHelper.cs (.../ClosingStructurePermutationHelper.cs) (revision 39e83a67849b8408e6c2879de1dbb0241739cc74) @@ -34,6 +34,34 @@ public static class ClosingStructurePermutationHelper { /// + /// 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(ClosingStructurePermutationHelper), + /// nameof(ClosingStructurePermutationHelper.DifferentClosingStructures), + /// new object[] + /// { + /// "TargetMethodName", + /// "TestResult" + /// })] + /// + public static IEnumerable DifferentClosingStructures(string targetName, string testResultDescription) + { + var testCaseData = new List + { + new TestCaseData(new TestClosingStructure("Different id")) + .SetName($"{targetName}_DifferentId_{testResultDescription}") + }; + + testCaseData.AddRange(DifferentClosingStructuresWithSameId(targetName, testResultDescription)); + + return testCaseData; + } + + /// /// Returns a collection of modified entities, which all differ /// except for their id. /// Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.TestUtil.Test/StabilityPointStructurePermutationHelperTest.cs =================================================================== diff -u -re70c00d8db0fdded4e7ed647cfaa994923078d8e -r39e83a67849b8408e6c2879de1dbb0241739cc74 --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.TestUtil.Test/StabilityPointStructurePermutationHelperTest.cs (.../StabilityPointStructurePermutationHelperTest.cs) (revision e70c00d8db0fdded4e7ed647cfaa994923078d8e) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.TestUtil.Test/StabilityPointStructurePermutationHelperTest.cs (.../StabilityPointStructurePermutationHelperTest.cs) (revision 39e83a67849b8408e6c2879de1dbb0241739cc74) @@ -29,13 +29,67 @@ public class StabilityPointStructurePermutationHelperTest { [Test] - public void DifferentStabilityPointStructureWithSameId_ReturnsExpectedTestCaseData() + public void DifferentStabilityPointStructures_ReturnsExpectedTestCaseData() { // Setup var referenceStructure = new TestStabilityPointStructure(); var differentStructures = new List(); // Call + List testCaseDatas = StabilityPointStructurePermutationHelper.DifferentStabilityPointStructures("A", "B").ToList(); + + // Assert + Assert.AreEqual(28, testCaseDatas.Count); + IEnumerable testNames = testCaseDatas + .Select(tcd => tcd.TestName) + .ToList(); + Assert.AreEqual(28, 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(28, 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.StorageStructureArea.Equals(referenceStructure.StorageStructureArea))); + differentStructures.Add(structures.Single(s => !s.AllowedLevelIncreaseStorage.Equals(referenceStructure.AllowedLevelIncreaseStorage))); + differentStructures.Add(structures.Single(s => !s.WidthFlowApertures.Equals(referenceStructure.WidthFlowApertures))); + differentStructures.Add(structures.Single(s => !s.InsideWaterLevel.Equals(referenceStructure.InsideWaterLevel))); + differentStructures.Add(structures.Single(s => !s.ThresholdHeightOpenWeir.Equals(referenceStructure.ThresholdHeightOpenWeir))); + 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.ConstructiveStrengthLinearLoadModel.Equals(referenceStructure.ConstructiveStrengthLinearLoadModel))); + differentStructures.Add(structures.Single(s => !s.ConstructiveStrengthQuadraticLoadModel.Equals(referenceStructure.ConstructiveStrengthQuadraticLoadModel))); + differentStructures.Add(structures.Single(s => !s.BankWidth.Equals(referenceStructure.BankWidth))); + differentStructures.Add(structures.Single(s => !s.InsideWaterLevelFailureConstruction.Equals(referenceStructure.InsideWaterLevelFailureConstruction))); + differentStructures.Add(structures.Single(s => !s.EvaluationLevel.Equals(referenceStructure.EvaluationLevel))); + differentStructures.Add(structures.Single(s => !s.LevelCrestStructure.Equals(referenceStructure.LevelCrestStructure))); + differentStructures.Add(structures.Single(s => !s.VerticalDistance.Equals(referenceStructure.VerticalDistance))); + differentStructures.Add(structures.Single(s => !s.FailureProbabilityRepairClosure.Equals(referenceStructure.FailureProbabilityRepairClosure))); + differentStructures.Add(structures.Single(s => !s.FailureCollisionEnergy.Equals(referenceStructure.FailureCollisionEnergy))); + differentStructures.Add(structures.Single(s => !s.ShipMass.Equals(referenceStructure.ShipMass))); + differentStructures.Add(structures.Single(s => !s.ShipVelocity.Equals(referenceStructure.ShipVelocity))); + differentStructures.Add(structures.Single(s => !s.LevellingCount.Equals(referenceStructure.LevellingCount))); + differentStructures.Add(structures.Single(s => !s.ProbabilityCollisionSecondaryStructure.Equals(referenceStructure.ProbabilityCollisionSecondaryStructure))); + differentStructures.Add(structures.Single(s => !s.FlowVelocityStructureClosable.Equals(referenceStructure.FlowVelocityStructureClosable))); + differentStructures.Add(structures.Single(s => !s.StabilityLinearLoadModel.Equals(referenceStructure.StabilityLinearLoadModel))); + differentStructures.Add(structures.Single(s => !s.StabilityQuadraticLoadModel.Equals(referenceStructure.StabilityQuadraticLoadModel))); + differentStructures.Add(structures.Single(s => !s.AreaFlowApertures.Equals(referenceStructure.AreaFlowApertures))); + differentStructures.Add(structures.Single(s => !s.InflowModelType.Equals(referenceStructure.InflowModelType))); + Assert.AreEqual(28, differentStructures.Distinct().Count()); + } + + [Test] + public void DifferentStabilityPointStructuresWithSameId_ReturnsExpectedTestCaseData() + { + // Setup + var referenceStructure = new TestStabilityPointStructure(); + var differentStructures = new List(); + + // Call List testCaseDatas = StabilityPointStructurePermutationHelper.DifferentStabilityPointStructuresWithSameId("A", "B").ToList(); // Assert Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.TestUtil/StabilityPointStructurePermutationHelper.cs =================================================================== diff -u -rad440d0e14ea249a0ae198e634ab6aa5d72a3977 -r39e83a67849b8408e6c2879de1dbb0241739cc74 --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.TestUtil/StabilityPointStructurePermutationHelper.cs (.../StabilityPointStructurePermutationHelper.cs) (revision ad440d0e14ea249a0ae198e634ab6aa5d72a3977) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.TestUtil/StabilityPointStructurePermutationHelper.cs (.../StabilityPointStructurePermutationHelper.cs) (revision 39e83a67849b8408e6c2879de1dbb0241739cc74) @@ -34,6 +34,34 @@ public static class StabilityPointStructurePermutationHelper { /// + /// 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(StabilityPointStructurePermutationHelper), + /// nameof(StabilityPointStructurePermutationHelper.DifferentStabilityPointStructures), + /// new object[] + /// { + /// "TargetMethodName", + /// "TestResult" + /// })] + /// + public static IEnumerable DifferentStabilityPointStructures(string targetName, string testResultDescription) + { + var testCaseData = new List + { + new TestCaseData(new TestStabilityPointStructure("Different id")) + .SetName($"{targetName}_DifferentId_{testResultDescription}") + }; + + testCaseData.AddRange(DifferentStabilityPointStructuresWithSameId(targetName, testResultDescription)); + + return testCaseData; + } + + /// /// Returns a collection of modified entities, which all differ /// except for their id. ///