Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.TestUtil.Test/StabilityPointStructurePermutationHelperTest.cs =================================================================== diff -u -r59bb55c3103574906353fbfb3ef3026f0086b6be -r6949918830314633db5cc8c16bb2188779fffc93 --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.TestUtil.Test/StabilityPointStructurePermutationHelperTest.cs (.../StabilityPointStructurePermutationHelperTest.cs) (revision 59bb55c3103574906353fbfb3ef3026f0086b6be) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.TestUtil.Test/StabilityPointStructurePermutationHelperTest.cs (.../StabilityPointStructurePermutationHelperTest.cs) (revision 6949918830314633db5cc8c16bb2188779fffc93) @@ -36,12 +36,12 @@ const string testResultDescription = "B"; // Call - List testCaseDatas = StabilityPointStructurePermutationHelper.DifferentStabilityPointStructures(targetName, testResultDescription).ToList(); + IEnumerable testCaseData = StabilityPointStructurePermutationHelper.DifferentStabilityPointStructures(targetName, testResultDescription); // Assert - Assert.AreEqual(46, testCaseDatas.Count); - AssertTestNames(testCaseDatas, targetName, testResultDescription); - AssertParameters(testCaseDatas, true, true, true); + Assert.AreEqual(46, testCaseData.Count()); + AssertTestNames(testCaseData, targetName, testResultDescription); + AssertParameters(testCaseData, true, true, true); } [Test] @@ -52,12 +52,12 @@ const string testResultDescription = "D"; // Call - List testCaseDatas = StabilityPointStructurePermutationHelper.DifferentStabilityPointStructuresWithSameId(targetName, testResultDescription).ToList(); + IEnumerable testCaseData = StabilityPointStructurePermutationHelper.DifferentStabilityPointStructuresWithSameId(targetName, testResultDescription); // Assert - Assert.AreEqual(45, testCaseDatas.Count); - AssertTestNames(testCaseDatas, targetName, testResultDescription); - AssertParameters(testCaseDatas, false, true, true); + Assert.AreEqual(45, testCaseData.Count()); + AssertTestNames(testCaseData, targetName, testResultDescription); + AssertParameters(testCaseData, false, true, true); } [Test] @@ -68,35 +68,36 @@ const string testResultDescription = "F"; // Call - List testCaseDatas = StabilityPointStructurePermutationHelper.DifferentStabilityPointStructuresWithSameIdNameAndLocation(targetName, testResultDescription).ToList(); + IEnumerable testCaseData = StabilityPointStructurePermutationHelper.DifferentStabilityPointStructuresWithSameIdNameAndLocation(targetName, testResultDescription).ToList(); // Assert - Assert.AreEqual(43, testCaseDatas.Count); - AssertTestNames(testCaseDatas, targetName, testResultDescription); - AssertParameters(testCaseDatas, false, false, false); + Assert.AreEqual(43, testCaseData.Count()); + AssertTestNames(testCaseData, targetName, testResultDescription); + AssertParameters(testCaseData, false, false, false); } - private static void AssertTestNames(ICollection testCaseDatas, string targetName, string testResultDescription) + private static void AssertTestNames(IEnumerable testCaseData, string targetName, string testResultDescription) { - IEnumerable testNames = testCaseDatas + IEnumerable testNames = testCaseData .Select(tcd => tcd.TestName) - .ToList(); - Assert.AreEqual(testCaseDatas.Count, testNames.Distinct().Count()); + .ToArray(); + Assert.AreEqual(testCaseData.Count(), testNames.Distinct().Count()); Assert.IsTrue(testNames.All(tn => tn.StartsWith($"{targetName}_"))); Assert.IsTrue(testNames.All(tn => tn.EndsWith($"_{testResultDescription}"))); } - private static void AssertParameters(ICollection testCaseDatas, bool idUnique, bool nameUnique, bool locationUnique) + private static void AssertParameters(IEnumerable testCaseData, bool idUnique, bool nameUnique, bool locationUnique) { var differentStructures = new List(); var referenceStructure = new TestStabilityPointStructure(); - IEnumerable structures = testCaseDatas + IEnumerable structures = testCaseData .Select(tcd => tcd.Arguments[0]) .OfType() - .ToList(); + .ToArray(); - Assert.AreEqual(testCaseDatas.Count, structures.Count()); + int testCaseDataCount = testCaseData.Count(); + Assert.AreEqual(testCaseDataCount, structures.Count()); if (idUnique) { @@ -168,7 +169,7 @@ differentStructures.Add(structures.Single(s => !s.AreaFlowApertures.Mean.Equals(referenceStructure.AreaFlowApertures.Mean))); differentStructures.Add(structures.Single(s => !s.AreaFlowApertures.StandardDeviation.Equals(referenceStructure.AreaFlowApertures.StandardDeviation))); differentStructures.Add(structures.Single(s => !s.InflowModelType.Equals(referenceStructure.InflowModelType))); - Assert.AreEqual(testCaseDatas.Count, differentStructures.Distinct().Count()); + Assert.AreEqual(testCaseDataCount, differentStructures.Distinct().Count()); } } } \ No newline at end of file