Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.TestUtil/HeightStructurePermutationHelper.cs =================================================================== diff -u -r0150045bc1d6bf839c9a9ea30275226dd3978522 -r51ead7e5a2422ca9f35e65c2ca327fdd9b8d1a48 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.TestUtil/HeightStructurePermutationHelper.cs (.../HeightStructurePermutationHelper.cs) (revision 0150045bc1d6bf839c9a9ea30275226dd3978522) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.TestUtil/HeightStructurePermutationHelper.cs (.../HeightStructurePermutationHelper.cs) (revision 51ead7e5a2422ca9f35e65c2ca327fdd9b8d1a48) @@ -39,105 +39,164 @@ /// except for their id. /// /// [TestCaseSource(typeof(HeightStructurePermutationHelper), nameof(HeightStructurePermutationHelper.DifferentHeightStructureWithSameId))] - public static IEnumerable DifferentHeightStructureWithSameId + public static IEnumerable DifferentHeightStructuresWithSameId() { - get + var referenceStructure = new TestHeightStructure(); + + var testCaseData = new List { - const string defaultId = "id"; + new TestCaseData(new TestHeightStructure(referenceStructure.Id, "Different Name")) + .SetName("Different Name"), + new TestCaseData(new TestHeightStructure(new Point2D(1, 1), referenceStructure.Id)) + .SetName("Different Location") + }; - var testCaseData = new List - { - new TestCaseData(new TestHeightStructure(defaultId, "Different Name")) - .SetName("Different Name"), - new TestCaseData(new TestHeightStructure(new Point2D(1, 1), defaultId)) - .SetName("Different Location") - }; + testCaseData.AddRange(DifferentHeightStructuresWithSameIdNameAndLocation()); - testCaseData.AddRange(DifferentHeightStructureWithSameIdLocationAndName); - - return testCaseData; - } + return testCaseData; } /// /// Returns a collection of modified entities, which all - /// differ except for their id, location and name. + /// differ except for their id, name and location. /// /// [TestCaseSource(typeof(HeightStructurePermutationHelper), nameof(HeightStructurePermutationHelper.DifferentHeightStructureWithSameIdLocationAndName))] - public static IEnumerable DifferentHeightStructureWithSameIdLocationAndName + public static IEnumerable DifferentHeightStructuresWithSameIdNameAndLocation() { - get + var random = new Random(532); + var referenceStructure = new TestHeightStructure(); + + yield return new TestCaseData(new TestHeightStructure { - var random = new Random(532); - const string defaultId = "id"; - const string defaultName = "name"; - var defaultLocation = new Point2D(0, 0); + AllowedLevelIncreaseStorage = + { + Mean = (RoundedDouble) random.Next(), + Shift = random.NextRoundedDouble(), + StandardDeviation = random.NextRoundedDouble() + } + }).SetName("Different AllowedLevelIncreaseStorage"); + yield return new TestCaseData(new TestHeightStructure + { + CriticalOvertoppingDischarge = + { + Mean = (RoundedDouble) random.Next(), + CoefficientOfVariation = random.NextRoundedDouble() + } + }).SetName("Different CriticalOvertoppingDischarge"); + yield return new TestCaseData(new TestHeightStructure + { + FlowWidthAtBottomProtection = + { + Mean = (RoundedDouble) random.Next(), + Shift = random.NextRoundedDouble(), + StandardDeviation = random.NextRoundedDouble() + } + }).SetName("Different FlowWidthAtBottomProtection"); + yield return new TestCaseData(new TestHeightStructure + { + LevelCrestStructure = + { + Mean = (RoundedDouble) random.Next(), + StandardDeviation = random.NextRoundedDouble() + } + }).SetName("Different LevelCrestStructure"); + yield return new TestCaseData(new TestHeightStructure + { + StorageStructureArea = + { + Mean = (RoundedDouble) random.Next(), + CoefficientOfVariation = random.NextRoundedDouble() + } + }).SetName("Different StorageStructureArea"); + yield return new TestCaseData(new TestHeightStructure + { + WidthFlowApertures = + { + Mean = (RoundedDouble) random.Next(), + StandardDeviation = random.NextRoundedDouble() + } + }).SetName("Different WidthFlowApertures"); - yield return new TestCaseData(new TestHeightStructure + yield return new TestCaseData(new HeightStructure(new HeightStructure.ConstructionProperties + { + Name = referenceStructure.Name, + Id = referenceStructure.Id, + Location = referenceStructure.Location, + AllowedLevelIncreaseStorage = { - AllowedLevelIncreaseStorage = - { - Mean = (RoundedDouble) random.Next(), - Shift = random.NextRoundedDouble(), - StandardDeviation = random.NextRoundedDouble() - } - }).SetName("Different AllowedLevelIncreaseStorage"); - yield return new TestCaseData(new TestHeightStructure + Mean = referenceStructure.AllowedLevelIncreaseStorage.Mean, + Shift = referenceStructure.AllowedLevelIncreaseStorage.Shift, + StandardDeviation = referenceStructure.AllowedLevelIncreaseStorage.StandardDeviation + }, + CriticalOvertoppingDischarge = { - CriticalOvertoppingDischarge = - { - Mean = (RoundedDouble) random.Next(), - CoefficientOfVariation = random.NextRoundedDouble() - } - }).SetName("Different CriticalOvertoppingDischarge"); - yield return new TestCaseData(new TestHeightStructure + Mean = referenceStructure.CriticalOvertoppingDischarge.Mean, + CoefficientOfVariation = referenceStructure.CriticalOvertoppingDischarge.CoefficientOfVariation + }, + FlowWidthAtBottomProtection = { - FlowWidthAtBottomProtection = - { - Mean = (RoundedDouble) random.Next(), - Shift = random.NextRoundedDouble(), - StandardDeviation = random.NextRoundedDouble() - } - }).SetName("Different FlowWidthAtBottomProtection"); - yield return new TestCaseData(new TestHeightStructure + Mean = referenceStructure.FlowWidthAtBottomProtection.Mean, + Shift = referenceStructure.FlowWidthAtBottomProtection.Shift, + StandardDeviation = referenceStructure.FlowWidthAtBottomProtection.StandardDeviation + }, + LevelCrestStructure = { - LevelCrestStructure = - { - Mean = (RoundedDouble) random.Next(), - StandardDeviation = random.NextRoundedDouble() - } - }).SetName("Different LevelCrestStructure"); - yield return new TestCaseData(new TestHeightStructure + Mean = referenceStructure.LevelCrestStructure.Mean, + StandardDeviation = referenceStructure.LevelCrestStructure.StandardDeviation + }, + StorageStructureArea = { - StorageStructureArea = - { - Mean = (RoundedDouble) random.Next(), - CoefficientOfVariation = random.NextRoundedDouble() - } - }).SetName("Different StorageStructureArea"); - yield return new TestCaseData(new TestHeightStructure + Mean = referenceStructure.StorageStructureArea.Mean, + CoefficientOfVariation = referenceStructure.StorageStructureArea.CoefficientOfVariation + }, + WidthFlowApertures = { - WidthFlowApertures = - { - Mean = (RoundedDouble) random.Next(), - StandardDeviation = random.NextRoundedDouble() - } - }).SetName("Different WidthFlowApertures"); - yield return new TestCaseData(new HeightStructure(new HeightStructure.ConstructionProperties + Mean = referenceStructure.WidthFlowApertures.Mean, + StandardDeviation = referenceStructure.WidthFlowApertures.StandardDeviation + }, + FailureProbabilityStructureWithErosion = random.NextRoundedDouble(), + StructureNormalOrientation = referenceStructure.StructureNormalOrientation + })).SetName("Different FailureProbabilityStructureWithErosion"); + yield return new TestCaseData(new HeightStructure(new HeightStructure.ConstructionProperties + { + Name = referenceStructure.Name, + Id = referenceStructure.Id, + Location = referenceStructure.Location, + AllowedLevelIncreaseStorage = { - Name = defaultName, - Id = defaultId, - Location = defaultLocation, - FailureProbabilityStructureWithErosion = random.NextDouble() - })).SetName("Different FailureProbabilityStructureWithErosion"); - yield return new TestCaseData(new HeightStructure(new HeightStructure.ConstructionProperties + Mean = referenceStructure.AllowedLevelIncreaseStorage.Mean, + Shift = referenceStructure.AllowedLevelIncreaseStorage.Shift, + StandardDeviation = referenceStructure.AllowedLevelIncreaseStorage.StandardDeviation + }, + CriticalOvertoppingDischarge = { - Name = defaultName, - Id = defaultId, - Location = defaultLocation, - StructureNormalOrientation = random.NextRoundedDouble() - })).SetName("Different StructureNormalOrientation"); - } + Mean = referenceStructure.CriticalOvertoppingDischarge.Mean, + CoefficientOfVariation = referenceStructure.CriticalOvertoppingDischarge.CoefficientOfVariation + }, + FlowWidthAtBottomProtection = + { + Mean = referenceStructure.FlowWidthAtBottomProtection.Mean, + Shift = referenceStructure.FlowWidthAtBottomProtection.Shift, + StandardDeviation = referenceStructure.FlowWidthAtBottomProtection.StandardDeviation + }, + LevelCrestStructure = + { + Mean = referenceStructure.LevelCrestStructure.Mean, + StandardDeviation = referenceStructure.LevelCrestStructure.StandardDeviation + }, + StorageStructureArea = + { + Mean = referenceStructure.StorageStructureArea.Mean, + CoefficientOfVariation = referenceStructure.StorageStructureArea.CoefficientOfVariation + }, + WidthFlowApertures = + { + Mean = referenceStructure.WidthFlowApertures.Mean, + StandardDeviation = referenceStructure.WidthFlowApertures.StandardDeviation + }, + FailureProbabilityStructureWithErosion = referenceStructure.FailureProbabilityStructureWithErosion, + StructureNormalOrientation = random.NextRoundedDouble() + })).SetName("Different StructureNormalOrientation"); } } } \ No newline at end of file