Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.TestUtil.Test/ClosingStructurePermutationHelperTest.cs =================================================================== diff -u -r5e1e129f9a4e57a1255b5b1a70a34df434434327 -rad440d0e14ea249a0ae198e634ab6aa5d72a3977 --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.TestUtil.Test/ClosingStructurePermutationHelperTest.cs (.../ClosingStructurePermutationHelperTest.cs) (revision 5e1e129f9a4e57a1255b5b1a70a34df434434327) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.TestUtil.Test/ClosingStructurePermutationHelperTest.cs (.../ClosingStructurePermutationHelperTest.cs) (revision ad440d0e14ea249a0ae198e634ab6aa5d72a3977) @@ -51,7 +51,7 @@ .OfType() .ToList(); Assert.AreEqual(17, structures.Count()); - Assert.IsTrue(structures.All(s => s.Id == structures.First().Id)); + Assert.IsTrue(structures.All(s => s.Id == 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))); Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.TestUtil.Test/HeightStructurePermutationHelperTest.cs =================================================================== diff -u -r6077633f3df6394b0af989aaa1d252773fdff297 -rad440d0e14ea249a0ae198e634ab6aa5d72a3977 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.TestUtil.Test/HeightStructurePermutationHelperTest.cs (.../HeightStructurePermutationHelperTest.cs) (revision 6077633f3df6394b0af989aaa1d252773fdff297) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.TestUtil.Test/HeightStructurePermutationHelperTest.cs (.../HeightStructurePermutationHelperTest.cs) (revision ad440d0e14ea249a0ae198e634ab6aa5d72a3977) @@ -51,7 +51,7 @@ .OfType() .ToList(); Assert.AreEqual(10, structures.Count()); - Assert.IsTrue(structures.All(s => s.Id == structures.First().Id)); + Assert.IsTrue(structures.All(s => s.Id == 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))); Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.TestUtil.Test/Ringtoets.StabilityPointStructures.Data.TestUtil.Test.csproj =================================================================== diff -u -r37453954b2d36699ea16375cdfbf89785a094ab9 -rad440d0e14ea249a0ae198e634ab6aa5d72a3977 --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.TestUtil.Test/Ringtoets.StabilityPointStructures.Data.TestUtil.Test.csproj (.../Ringtoets.StabilityPointStructures.Data.TestUtil.Test.csproj) (revision 37453954b2d36699ea16375cdfbf89785a094ab9) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.TestUtil.Test/Ringtoets.StabilityPointStructures.Data.TestUtil.Test.csproj (.../Ringtoets.StabilityPointStructures.Data.TestUtil.Test.csproj) (revision ad440d0e14ea249a0ae198e634ab6aa5d72a3977) @@ -50,6 +50,7 @@ Properties\GlobalAssembly.cs + Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.TestUtil.Test/StabilityPointStructurePermutationHelperTest.cs =================================================================== diff -u --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.TestUtil.Test/StabilityPointStructurePermutationHelperTest.cs (revision 0) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.TestUtil.Test/StabilityPointStructurePermutationHelperTest.cs (revision ad440d0e14ea249a0ae198e634ab6aa5d72a3977) @@ -0,0 +1,139 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; + +namespace Ringtoets.StabilityPointStructures.Data.TestUtil.Test +{ + [TestFixture] + public class StabilityPointStructurePermutationHelperTest + { + [Test] + public void DifferentStabilityPointStructureWithSameId_ReturnsExpectedTestCaseData() + { + // Setup + var referenceStructure = new TestStabilityPointStructure(); + var differentStructures = new List(); + + // Call + List testCaseDatas = StabilityPointStructurePermutationHelper.DifferentStabilityPointStructuresWithSameId("A", "B").ToList(); + + // Assert + Assert.AreEqual(27, testCaseDatas.Count); + IEnumerable testNames = testCaseDatas + .Select(tcd => tcd.TestName) + .ToList(); + Assert.AreEqual(27, 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(27, structures.Count()); + Assert.IsTrue(structures.All(s => s.Id == 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(27, differentStructures.Count); + } + + [Test] + public void DifferentStabilityPointStructuresWithSameIdNameAndLocation_ReturnsExpectedTestCaseData() + { + // Setup + var referenceStructure = new TestStabilityPointStructure(); + var differentStructures = new List(); + + // Call + List testCaseDatas = StabilityPointStructurePermutationHelper.DifferentStabilityPointStructuresWithSameIdNameAndLocation("C", "D").ToList(); + + // Assert + Assert.AreEqual(25, testCaseDatas.Count); + IEnumerable testNames = testCaseDatas + .Select(tcd => tcd.TestName) + .ToList(); + Assert.AreEqual(25, testNames.Distinct().Count()); + Assert.IsTrue(testNames.All(tn => tn.StartsWith("C_"))); + Assert.IsTrue(testNames.All(tn => tn.EndsWith("_D"))); + IEnumerable structures = testCaseDatas + .Select(tcd => tcd.Arguments[0]) + .OfType() + .ToList(); + Assert.AreEqual(25, structures.Count()); + Assert.IsTrue(structures.All(s => s.Id == referenceStructure.Id)); + Assert.IsTrue(structures.All(s => s.Name == referenceStructure.Name)); + Assert.IsTrue(structures.All(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(25, differentStructures.Count); + } + } +} \ No newline at end of file Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.TestUtil/StabilityPointStructurePermutationHelper.cs =================================================================== diff -u -r597f2ecd0c9cb1aedf4bef978b209d49f63b08fe -rad440d0e14ea249a0ae198e634ab6aa5d72a3977 --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.TestUtil/StabilityPointStructurePermutationHelper.cs (.../StabilityPointStructurePermutationHelper.cs) (revision 597f2ecd0c9cb1aedf4bef978b209d49f63b08fe) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.TestUtil/StabilityPointStructurePermutationHelper.cs (.../StabilityPointStructurePermutationHelper.cs) (revision ad440d0e14ea249a0ae198e634ab6aa5d72a3977) @@ -55,7 +55,7 @@ var testCaseData = new List { - new TestCaseData(new TestStabilityPointStructure(referenceStructure.Id, "Different name")) + new TestCaseData(new TestStabilityPointStructure("Different name", referenceStructure.Id)) .SetName($"{targetName}_DifferentName_{testResultDescription}"), new TestCaseData(new TestStabilityPointStructure(new Point2D(1, 1), referenceStructure.Id)) .SetName($"{targetName}_DifferentLocation_{testResultDescription}") @@ -351,7 +351,7 @@ BankWidth = { Mean = referenceStructure.BankWidth.Mean, - StandardDeviation = referenceStructure.BankWidth.Mean + StandardDeviation = referenceStructure.BankWidth.StandardDeviation }, InsideWaterLevelFailureConstruction = {