Index: Core/Common/test/Core.Common.TestUtil/FileDisposeHelper.cs =================================================================== diff -u -r67284323e2785c651633d9c52049ba12a9c70e6a -r831379390ac72116a2f1c3a014063bbd60ab928d --- Core/Common/test/Core.Common.TestUtil/FileDisposeHelper.cs (.../FileDisposeHelper.cs) (revision 67284323e2785c651633d9c52049ba12a9c70e6a) +++ Core/Common/test/Core.Common.TestUtil/FileDisposeHelper.cs (.../FileDisposeHelper.cs) (revision 831379390ac72116a2f1c3a014063bbd60ab928d) @@ -188,7 +188,7 @@ /// Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 /// characters. /// The specified path is invalid (for example, it is on an unmapped drive). - /// An I/O error occurred while creating the file. + /// An I/O error occurred while creating the file. /// /// private static void CreateFile(string filePath) Index: Ringtoets/Common/src/Ringtoets.Common.Data/FailureMechanism/FailureMechanismSection.cs =================================================================== diff -u -r01bd90d4fab9699280c5619754fc55b4f03be08a -r831379390ac72116a2f1c3a014063bbd60ab928d --- Ringtoets/Common/src/Ringtoets.Common.Data/FailureMechanism/FailureMechanismSection.cs (.../FailureMechanismSection.cs) (revision 01bd90d4fab9699280c5619754fc55b4f03be08a) +++ Ringtoets/Common/src/Ringtoets.Common.Data/FailureMechanism/FailureMechanismSection.cs (.../FailureMechanismSection.cs) (revision 831379390ac72116a2f1c3a014063bbd60ab928d) @@ -47,7 +47,7 @@ /// is null. /// is null. /// Thrown when: - /// One ore more elements are null. + /// One or more elements are null. /// does not have at lease one geometry point. /// public FailureMechanismSection(string name, IEnumerable geometryPoints) Index: Ringtoets/Common/src/Ringtoets.Common.Data/IllustrationPoints/FaultTreeIllustrationPointExtensions.cs =================================================================== diff -u -r92f0a266f3ee297a3e0332e9a36fc3ec70d47b59 -r831379390ac72116a2f1c3a014063bbd60ab928d --- Ringtoets/Common/src/Ringtoets.Common.Data/IllustrationPoints/FaultTreeIllustrationPointExtensions.cs (.../FaultTreeIllustrationPointExtensions.cs) (revision 92f0a266f3ee297a3e0332e9a36fc3ec70d47b59) +++ Ringtoets/Common/src/Ringtoets.Common.Data/IllustrationPoints/FaultTreeIllustrationPointExtensions.cs (.../FaultTreeIllustrationPointExtensions.cs) (revision 831379390ac72116a2f1c3a014063bbd60ab928d) @@ -31,11 +31,13 @@ public static class FaultTreeIllustrationPointExtensions { /// - /// Returns a list of all the stochast names present in the . + /// Gets all the stochast names present in the . /// /// The fault tree illustration point /// to retrieve stochast names from. - /// Returns all stochast names as an enumerable result. + /// A list of all stochast names. + /// Thrown when + /// is null. public static IEnumerable GetStochastNames(this FaultTreeIllustrationPoint faultTreeIllustrationPoint) { if (faultTreeIllustrationPoint == null) Index: Ringtoets/Common/src/Ringtoets.Common.Data/IllustrationPoints/GeneralResult.cs =================================================================== diff -u -r92f0a266f3ee297a3e0332e9a36fc3ec70d47b59 -r831379390ac72116a2f1c3a014063bbd60ab928d --- Ringtoets/Common/src/Ringtoets.Common.Data/IllustrationPoints/GeneralResult.cs (.../GeneralResult.cs) (revision 92f0a266f3ee297a3e0332e9a36fc3ec70d47b59) +++ Ringtoets/Common/src/Ringtoets.Common.Data/IllustrationPoints/GeneralResult.cs (.../GeneralResult.cs) (revision 831379390ac72116a2f1c3a014063bbd60ab928d) @@ -46,11 +46,12 @@ /// parameters is null. /// Thrown when: /// - /// the stochasts in child nodes don't equal the general result's stochasts; + /// the stochasts in child nodes are not equal to the general result's stochasts; /// the general result's stochasts contains duplicates; /// the top level illustration points have a duplicate /// combination of closing situation and wind direction. - /// + /// + /// public GeneralResult(WindDirection governingWindDirection, IEnumerable stochasts, IEnumerable topLevelIllustrationPoints) @@ -103,6 +104,16 @@ return clone; } + /// + /// Validates a collection of + /// or objects by comparing the stochasts of child nodes + /// with its own stochasts. + /// + /// The collection of + /// or objects to be validated. + /// The collection of objects to be validated. + /// Thrown when the content does not equal + /// the child stochasts. private static void ValidateStochastInChildren(IEnumerable topLevelillustrationPoints, IEnumerable stochasts) { var childStochastNames = new List(); @@ -112,7 +123,7 @@ var topLevelFaultTreeIllustrationPoint = topLevelIllustrationPoint as TopLevelFaultTreeIllustrationPoint; if (topLevelFaultTreeIllustrationPoint != null) { - childStochastNames.AddRange(topLevelFaultTreeIllustrationPoint.FaultTreeNodeRoot.GetStochastNamesFromChildren()); + childStochastNames.AddRange(topLevelFaultTreeIllustrationPoint.FaultTreeNodeRoot.GetStochastNamesRecursively()); continue; } @@ -128,17 +139,24 @@ if (childStochastNames.Except(topLevelStochastNames).Any()) { - throw new ArgumentException(string.Format(Resources.GeneralResult_Imported_with_incorrect_stochasts_in_children)); + throw new ArgumentException(string.Format(Resources.Child_stochasts_not_same_as_parent_stochasts)); } } + /// + /// Validates a collection of + /// or objects by checking for duplicate combinations + /// of closing situation and wind direction. + /// + /// The collection of + /// or objects to be validated. + /// Thrown when contains a duplicate + /// combination of closing situation and wind direction. private static void ValidateTopLevelIllustrationPoints(IEnumerable topLevelIllustrationPoints) { - bool hasDuplicateIllustrationPointsPerWindDirection = - topLevelIllustrationPoints.HasDuplicates(t => $"{t.ClosingSituation} {t.WindDirection.Angle}"); - if (hasDuplicateIllustrationPointsPerWindDirection) + if (topLevelIllustrationPoints.HasDuplicates(t => $"{t.ClosingSituation} {t.WindDirection.Angle}")) { - throw new ArgumentException(string.Format(Resources.GeneralResult_Imported_non_unique_closing_situations_or_wind_direction)); + throw new ArgumentException(string.Format(Resources.GeneralResult_ValidateTopLevelIllustrationPoints_ClosingSituation_or_windDirection_not_unique)); } } } Index: Ringtoets/Common/src/Ringtoets.Common.Data/IllustrationPoints/IllustrationPointNode.cs =================================================================== diff -u -r92f0a266f3ee297a3e0332e9a36fc3ec70d47b59 -r831379390ac72116a2f1c3a014063bbd60ab928d --- Ringtoets/Common/src/Ringtoets.Common.Data/IllustrationPoints/IllustrationPointNode.cs (.../IllustrationPointNode.cs) (revision 92f0a266f3ee297a3e0332e9a36fc3ec70d47b59) +++ Ringtoets/Common/src/Ringtoets.Common.Data/IllustrationPoints/IllustrationPointNode.cs (.../IllustrationPointNode.cs) (revision 831379390ac72116a2f1c3a014063bbd60ab928d) @@ -65,9 +65,12 @@ /// Sets the children to this node. /// /// The children that are attached to this node. - /// Thrown when - /// does not contain 0 or 2 elements or when the children have duplicate names or - /// when they have different stochasts than the node itself. + /// Thrown when: + /// + /// does not contain 0 or 2 elements; + /// the children have duplicate names; + /// they have different stochasts than the node itself. + /// public void SetChildren(IllustrationPointNode[] children) { if (children == null) @@ -102,21 +105,36 @@ return clone; } + /// + /// Validates a by checking for duplicate names in child nodes. + /// + /// The object to be validated. + /// The collection of objects to be validated. + /// Thrown when contains child nodes with + /// duplicate names. private static void ValidateChildNames(FaultTreeIllustrationPoint data, IEnumerable children) { if (children.HasDuplicates(c => c.Data.Name)) { - throw new ArgumentException(string.Format(Resources.GeneralResult_Imported_non_unique_child_names)); + throw new ArgumentException(string.Format(Resources.IllustrationPointNode_ValidateChildNames_Child_names_not_unique)); } } + /// + /// Validates a by comparing the stochasts in child nodes with its + /// own stochasts. + /// + /// The object to be validated. + /// The collection of objects to be validated. + /// Thrown when contains stochasts that + /// are not in 's stochasts. private static void ValidateChildStochasts(FaultTreeIllustrationPoint data, IEnumerable children) { List stochastNames = children.SelectMany(c => c.GetStochastNames()).ToList(); if (data.GetStochastNames().Intersect(stochastNames).Count() != stochastNames.Distinct().Count()) { - throw new ArgumentException(string.Format(Resources.GeneralResult_Imported_with_incorrect_stochasts_in_children)); + throw new ArgumentException(string.Format(Resources.Child_stochasts_not_same_as_parent_stochasts)); } } } Index: Ringtoets/Common/src/Ringtoets.Common.Data/IllustrationPoints/IllustrationPointNodeExtensions.cs =================================================================== diff -u -r92f0a266f3ee297a3e0332e9a36fc3ec70d47b59 -r831379390ac72116a2f1c3a014063bbd60ab928d --- Ringtoets/Common/src/Ringtoets.Common.Data/IllustrationPoints/IllustrationPointNodeExtensions.cs (.../IllustrationPointNodeExtensions.cs) (revision 92f0a266f3ee297a3e0332e9a36fc3ec70d47b59) +++ Ringtoets/Common/src/Ringtoets.Common.Data/IllustrationPoints/IllustrationPointNodeExtensions.cs (.../IllustrationPointNodeExtensions.cs) (revision 831379390ac72116a2f1c3a014063bbd60ab928d) @@ -31,11 +31,13 @@ public static class IllustrationPointNodeExtensions { /// - /// Returns a list of all the stochast names present in the . + /// Gets all the stochast names present in the . /// /// The illustration point node /// to retrieve stochast names from. - /// Returns all stochast names as an enumerable result. + /// A list of all stochast names. + /// Thrown when + /// is null. public static IEnumerable GetStochastNames(this IllustrationPointNode illustrationPointNode) { if (illustrationPointNode == null) @@ -58,19 +60,21 @@ } /// - /// Returns a list of all the stochast names present in the and its children. + /// Gets all the stochast names present in the and its children. /// /// The illustration point node /// to retrieve child stochast names from. - /// Returns all stochast names as an enumerable result. - public static IEnumerable GetStochastNamesFromChildren(this IllustrationPointNode illustrationPointNode) + /// A list of all stochast names. + /// Thrown when + /// is null. + public static IEnumerable GetStochastNamesRecursively(this IllustrationPointNode illustrationPointNode) { if (illustrationPointNode == null) { throw new ArgumentNullException(nameof(illustrationPointNode)); } - List stochastNames = illustrationPointNode.Children.SelectMany(GetStochastNamesFromChildren).ToList(); + List stochastNames = illustrationPointNode.Children.SelectMany(GetStochastNamesRecursively).ToList(); stochastNames.AddRange(illustrationPointNode.GetStochastNames()); return stochastNames; Index: Ringtoets/Common/src/Ringtoets.Common.Data/IllustrationPoints/StochastValidator.cs =================================================================== diff -u -r92f0a266f3ee297a3e0332e9a36fc3ec70d47b59 -r831379390ac72116a2f1c3a014063bbd60ab928d --- Ringtoets/Common/src/Ringtoets.Common.Data/IllustrationPoints/StochastValidator.cs (.../StochastValidator.cs) (revision 92f0a266f3ee297a3e0332e9a36fc3ec70d47b59) +++ Ringtoets/Common/src/Ringtoets.Common.Data/IllustrationPoints/StochastValidator.cs (.../StochastValidator.cs) (revision 831379390ac72116a2f1c3a014063bbd60ab928d) @@ -35,15 +35,15 @@ /// Validates a collection of objects by checking for duplicate names. /// /// The collection of objects to be validated. + /// Thrown when contains duplicate stochasts. public static void ValidateStochasts(IEnumerable stochasts) { if (stochasts == null) { throw new ArgumentNullException(nameof(stochasts)); } - bool hasDuplicates = stochasts.HasDuplicates(s => s.Name); - if (hasDuplicates) + if (stochasts.HasDuplicates(s => s.Name)) { throw new ArgumentException(string.Format(Resources.GeneralResult_Imported_non_unique_stochasts)); } Index: Ringtoets/Common/src/Ringtoets.Common.Data/IllustrationPoints/SubMechanismIllustrationPoint.cs =================================================================== diff -u -r92f0a266f3ee297a3e0332e9a36fc3ec70d47b59 -r831379390ac72116a2f1c3a014063bbd60ab928d --- Ringtoets/Common/src/Ringtoets.Common.Data/IllustrationPoints/SubMechanismIllustrationPoint.cs (.../SubMechanismIllustrationPoint.cs) (revision 92f0a266f3ee297a3e0332e9a36fc3ec70d47b59) +++ Ringtoets/Common/src/Ringtoets.Common.Data/IllustrationPoints/SubMechanismIllustrationPoint.cs (.../SubMechanismIllustrationPoint.cs) (revision 831379390ac72116a2f1c3a014063bbd60ab928d) @@ -39,14 +39,13 @@ /// The beta value that was realized. /// The stochasts for the sub mechanism illustration point. /// The output variables. - /// Thrown when any of: + /// Thrown when any of the following parameters is null: /// - /// - /// - /// - /// - /// is null. - /// Thrown when the names of the are not unique. + /// ; + /// ; + /// . + /// + /// Thrown when the aren't unique. public SubMechanismIllustrationPoint(string name, double beta, IEnumerable stochasts, @@ -90,15 +89,18 @@ } /// - /// Validates a collection of objects by checking for duplicate descriptions. + /// Validates a collection of objects + /// by checking for duplicate descriptions. /// - /// The collection of objects to be validated. + /// The collection of + /// objects to be validated. + /// Thrown when + /// contains results with duplicate descriptions. private static void ValidateResults(IEnumerable illustrationPointResults) { - bool hasDuplicateResults = illustrationPointResults.HasDuplicates(i => i.Description); - if (hasDuplicateResults) + if (illustrationPointResults.HasDuplicates(i => i.Description)) { - throw new ArgumentException(string.Format(Resources.GeneralResult_Imported_non_unique_results)); + throw new ArgumentException(string.Format(Resources.SubMechanismIllustrationPoint_ValidateResults_Results_not_unique)); } } } Index: Ringtoets/Common/src/Ringtoets.Common.Data/IllustrationPoints/SubMechanismIllustrationPointExtensions.cs =================================================================== diff -u -r92f0a266f3ee297a3e0332e9a36fc3ec70d47b59 -r831379390ac72116a2f1c3a014063bbd60ab928d --- Ringtoets/Common/src/Ringtoets.Common.Data/IllustrationPoints/SubMechanismIllustrationPointExtensions.cs (.../SubMechanismIllustrationPointExtensions.cs) (revision 92f0a266f3ee297a3e0332e9a36fc3ec70d47b59) +++ Ringtoets/Common/src/Ringtoets.Common.Data/IllustrationPoints/SubMechanismIllustrationPointExtensions.cs (.../SubMechanismIllustrationPointExtensions.cs) (revision 831379390ac72116a2f1c3a014063bbd60ab928d) @@ -31,11 +31,13 @@ public static class SubMechanismIllustrationPointExtensions { /// - /// Returns a list of all the stochast names present in the . + /// Gets all the stochast names present in the . /// /// The sub mechanism illustration point /// to retrieve stochast names from. - /// Returns all stochast names as an enumerable result. + /// A list of all stochast names. + /// Thrown when + /// is null. public static IEnumerable GetStochastNames(this SubMechanismIllustrationPoint subMechanismIllustrationPoint) { if (subMechanismIllustrationPoint == null) Index: Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.Designer.cs =================================================================== diff -u -rd7f56db6a475e07dd904bd61c0a56346aac4e565 -r831379390ac72116a2f1c3a014063bbd60ab928d --- Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision d7f56db6a475e07dd904bd61c0a56346aac4e565) +++ Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 831379390ac72116a2f1c3a014063bbd60ab928d) @@ -398,6 +398,15 @@ } /// + /// Looks up a localized string similar to De stochasten van een illustratiepunt bevatten niet dezelfde stochasten als in de onderliggende illustratiepunten.. + /// + public static string Child_stochasts_not_same_as_parent_stochasts { + get { + return ResourceManager.GetString("Child_stochasts_not_same_as_parent_stochasts", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Variatiecoƫfficiƫnt (CV) moet groter zijn dan of gelijk zijn aan 0.. /// public static string CoefficientOfVariation_Should_be_greater_or_equal_to_zero { @@ -555,33 +564,6 @@ } /// - /// Looks up a localized string similar to Een of meerdere illustratiepunten bevatten illustratiepunten met dezelfde naam.. - /// - public static string GeneralResult_Imported_non_unique_child_names { - get { - return ResourceManager.GetString("GeneralResult_Imported_non_unique_child_names", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Een of meerdere illustratiepunten hebben dezelfde combinatie van sluitscenario en windrichting.. - /// - public static string GeneralResult_Imported_non_unique_closing_situations_or_wind_direction { - get { - return ResourceManager.GetString("GeneralResult_Imported_non_unique_closing_situations_or_wind_direction", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Een of meerdere uitvoer variabelen hebben dezelfde naam.. - /// - public static string GeneralResult_Imported_non_unique_results { - get { - return ResourceManager.GetString("GeneralResult_Imported_non_unique_results", resourceCulture); - } - } - - /// /// Looks up a localized string similar to Een of meerdere stochasten hebben dezelfde naam.. /// public static string GeneralResult_Imported_non_unique_stochasts { @@ -591,11 +573,12 @@ } /// - /// Looks up a localized string similar to De stochasten van een illustratiepunt bevatten niet dezelfde stochasten als in de onderliggende illustratiepunten.. + /// Looks up a localized string similar to Een of meerdere illustratiepunten hebben dezelfde combinatie van sluitscenario en windrichting.. /// - public static string GeneralResult_Imported_with_incorrect_stochasts_in_children { + public static string GeneralResult_ValidateTopLevelIllustrationPoints_ClosingSituation_or_windDirection_not_unique { get { - return ResourceManager.GetString("GeneralResult_Imported_with_incorrect_stochasts_in_children", resourceCulture); + return ResourceManager.GetString("GeneralResult_ValidateTopLevelIllustrationPoints_ClosingSituation_or_windDirectio" + + "n_not_unique", resourceCulture); } } @@ -627,6 +610,15 @@ } /// + /// Looks up a localized string similar to Een of meerdere illustratiepunten bevatten illustratiepunten met dezelfde naam.. + /// + public static string IllustrationPointNode_ValidateChildNames_Child_names_not_unique { + get { + return ResourceManager.GetString("IllustrationPointNode_ValidateChildNames_Child_names_not_unique", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Gemiddelde moet groter zijn dan 0.. /// public static string LogNormalDistribution_Mean_must_be_greater_than_zero { @@ -946,6 +938,15 @@ } /// + /// Looks up a localized string similar to Een of meerdere uitvoer variabelen hebben dezelfde naam.. + /// + public static string SubMechanismIllustrationPoint_ValidateResults_Results_not_unique { + get { + return ResourceManager.GetString("SubMechanismIllustrationPoint_ValidateResults_Results_not_unique", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Profielschematisaties. /// public static string SurfaceLineCollection_TypeDescriptor { Index: Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.resx =================================================================== diff -u -rd7f56db6a475e07dd904bd61c0a56346aac4e565 -r831379390ac72116a2f1c3a014063bbd60ab928d --- Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.resx (.../Resources.resx) (revision d7f56db6a475e07dd904bd61c0a56346aac4e565) +++ Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.resx (.../Resources.resx) (revision 831379390ac72116a2f1c3a014063bbd60ab928d) @@ -390,16 +390,16 @@ Een of meerdere stochasten hebben dezelfde naam. - + Een of meerdere illustratiepunten hebben dezelfde combinatie van sluitscenario en windrichting. - + Een of meerdere uitvoer variabelen hebben dezelfde naam. - + De stochasten van een illustratiepunt bevatten niet dezelfde stochasten als in de onderliggende illustratiepunten. - + Een of meerdere illustratiepunten bevatten illustratiepunten met dezelfde naam. Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/IllustrationPoints/FaultTreeIllustrationPointTest.cs =================================================================== diff -u -rd7f56db6a475e07dd904bd61c0a56346aac4e565 -r831379390ac72116a2f1c3a014063bbd60ab928d --- Ringtoets/Common/test/Ringtoets.Common.Data.Test/IllustrationPoints/FaultTreeIllustrationPointTest.cs (.../FaultTreeIllustrationPointTest.cs) (revision d7f56db6a475e07dd904bd61c0a56346aac4e565) +++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/IllustrationPoints/FaultTreeIllustrationPointTest.cs (.../FaultTreeIllustrationPointTest.cs) (revision 831379390ac72116a2f1c3a014063bbd60ab928d) @@ -92,11 +92,11 @@ var random = new Random(21); var stochasts = new[] { - new Stochast("unique", 0, 0), - new Stochast("non-unique", 2, 1), - new Stochast("non-unique", 4, 8), - new Stochast("nonunique", 23, 7), - new Stochast("nonunique", 4, 2) + new Stochast("unique", random.NextDouble(), random.NextDouble()), + new Stochast("non-unique", random.NextDouble(), random.NextDouble()), + new Stochast("non-unique", random.NextDouble(), random.NextDouble()), + new Stochast("nonunique", random.NextDouble(), random.NextDouble()), + new Stochast("nonunique", random.NextDouble(), random.NextDouble()) }; // Call Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/IllustrationPoints/GeneralResultTest.cs =================================================================== diff -u -rd7f56db6a475e07dd904bd61c0a56346aac4e565 -r831379390ac72116a2f1c3a014063bbd60ab928d --- Ringtoets/Common/test/Ringtoets.Common.Data.Test/IllustrationPoints/GeneralResultTest.cs (.../GeneralResultTest.cs) (revision d7f56db6a475e07dd904bd61c0a56346aac4e565) +++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/IllustrationPoints/GeneralResultTest.cs (.../GeneralResultTest.cs) (revision 831379390ac72116a2f1c3a014063bbd60ab928d) @@ -107,14 +107,15 @@ public void Constructor_StochastNamesNotUnique_ThrowArgumentException() { // Setup + var random = new Random(21); WindDirection windDirection = WindDirectionTestFactory.CreateTestWindDirection(); var stochasts = new[] { - new Stochast("unique", 1, 4), - new Stochast("non-unique", 2, 0), - new Stochast("non-unique", 3, 2), - new Stochast("nonunique", 4, 0), - new Stochast("nonunique", 5, 1) + new Stochast("unique", random.NextDouble(), random.NextDouble()), + new Stochast("non-unique", random.NextDouble(), random.NextDouble()), + new Stochast("non-unique", random.NextDouble(), random.NextDouble()), + new Stochast("nonunique", random.NextDouble(), random.NextDouble()), + new Stochast("nonunique", random.NextDouble(), random.NextDouble()) }; IEnumerable topLevelIllustrationPoints = Enumerable.Empty(); @@ -153,7 +154,7 @@ } [Test] - public void Constructor_ChildStochastsNotInStochasts_ThrowArgumentException() + public void Constructor_ChildStochastsNotEqualToTopLevelIllustrationPointStochasts_ThrowArgumentException() { // Setup WindDirection windDirection = WindDirectionTestFactory.CreateTestWindDirection(); Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/IllustrationPoints/IllustrationPointNodeExtensionsTest.cs =================================================================== diff -u -r92f0a266f3ee297a3e0332e9a36fc3ec70d47b59 -r831379390ac72116a2f1c3a014063bbd60ab928d --- Ringtoets/Common/test/Ringtoets.Common.Data.Test/IllustrationPoints/IllustrationPointNodeExtensionsTest.cs (.../IllustrationPointNodeExtensionsTest.cs) (revision 92f0a266f3ee297a3e0332e9a36fc3ec70d47b59) +++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/IllustrationPoints/IllustrationPointNodeExtensionsTest.cs (.../IllustrationPointNodeExtensionsTest.cs) (revision 831379390ac72116a2f1c3a014063bbd60ab928d) @@ -21,7 +21,6 @@ using System; using System.Collections.Generic; -using System.Linq; using NUnit.Framework; using Ringtoets.Common.Data.IllustrationPoints; using Ringtoets.Common.Data.TestUtil.IllustrationPoints; @@ -45,81 +44,75 @@ } [Test] - public void GetStochastNames_IllustrationPointNodeWithSubMechanismIllustrationPointWithoutStochast_ReturnsEmptyList() + public void GetStochastNames_IllustrationPointNodeWithSubMechanismIllustrationPointWithStochast_ReturnStochastNames() { // Setup - var illustrationPointNode = new IllustrationPointNode(new TestSubMechanismIllustrationPoint()); - - // Call - IEnumerable names = illustrationPointNode.GetStochastNames(); - - // Assert - CollectionAssert.IsEmpty(names); - } - - [Test] - public void GetStochastNames_IllustrationPointNodeWithFaultTreeIllustrationPointWithoutStochast_ReturnsEmptyList() - { - // Setup - var illustrationPointNode = new IllustrationPointNode(new TestFaultTreeIllustrationPoint()); - - // Call - IEnumerable names = illustrationPointNode.GetStochastNames(); - - // Assert - CollectionAssert.IsEmpty(names); - } - - [Test] - public void GetStochastNames_IllustrationPointNodeWithSubMechanismIllustrationPointWithStochast_ReturnsExpectedName() - { - // Setup - const string stochastName = "Stochast A"; + var random = new Random(21); + const string stochastNameA = "Stochast A"; + const string stochastNameB = "Stochast B"; var illustrationPointNode = new IllustrationPointNode(new TestSubMechanismIllustrationPoint(new[] { - new SubMechanismIllustrationPointStochast(stochastName, 2, 5, 3) + new SubMechanismIllustrationPointStochast(stochastNameA, + random.NextDouble(), + random.NextDouble(), + random.NextDouble()), + new SubMechanismIllustrationPointStochast(stochastNameB, + random.NextDouble(), + random.NextDouble(), + random.NextDouble()) })); // Call IEnumerable names = illustrationPointNode.GetStochastNames(); // Assert - Assert.AreEqual(stochastName, names.Single()); + CollectionAssert.AreEqual(new[] + { + stochastNameA, + stochastNameB + }, names); } [Test] - public void GetStochastNames_IllustrationPointNodeWithFaultTreeIllustrationPointWithStochast_ReturnsExpectedName() + public void GetStochastNames_IllustrationPointNodeWithFaultTreeIllustrationPointWithStochast_ReturnStochastNames() { // Setup - const string stochastName = "Stochast A"; + var random = new Random(21); + const string stochastNameA = "Stochast A"; + const string stochastNameB = "Stochast B"; var illustrationPointNode = new IllustrationPointNode(new TestFaultTreeIllustrationPoint(new[] { - new Stochast(stochastName, 2, 4) + new Stochast(stochastNameA, random.NextDouble(), random.NextDouble()), + new Stochast(stochastNameB, random.NextDouble(), random.NextDouble()) })); // Call IEnumerable names = illustrationPointNode.GetStochastNames(); // Assert - Assert.AreEqual(stochastName, names.Single()); + CollectionAssert.AreEqual(new[] + { + stochastNameA, + stochastNameB + }, names); } [Test] - public void GetStochastNamesFromChildren_IllustrationPointNodeNull_ThrowsArgumentNullException() + public void GetStochastNamesRecursively_IllustrationPointNodeNull_ThrowsArgumentNullException() { // Setup IllustrationPointNode illustrationPointNode = null; // Call - TestDelegate test = () => illustrationPointNode.GetStochastNamesFromChildren(); + TestDelegate test = () => illustrationPointNode.GetStochastNamesRecursively(); // Assert var exception = Assert.Throws(test); Assert.AreEqual("illustrationPointNode", exception.ParamName); } [Test] - public void GetStochastNamesFromChildren_IllustrationPointNodeWithFaultTreeIllustrationPointAndChildrenContainingStochasts_ReturnsExpectedNames() + public void GetStochastNamesRecursively_IllustrationPointNodeWithFaultTreeIllustrationPointAndChildrenContainingStochasts_ReturnStochastNames() { // Setup const string stochastNameA = "Stochast A"; @@ -142,7 +135,7 @@ }); // Call - IEnumerable names = illustrationPointNode.GetStochastNamesFromChildren(); + IEnumerable names = illustrationPointNode.GetStochastNamesRecursively(); // Assert CollectionAssert.AreEqual(new[] @@ -155,7 +148,7 @@ } [Test] - public void GetStochastNamesFromChildren_IllustrationPointNodeWithSubMechanismIllustrationPointAndNoChildren_ReturnsExpectedNames() + public void GetStochastNamesRecursively_IllustrationPointNodeWithSubMechanismIllustrationPointAndNoChildren_ReturnStochastNames() { // Setup const string stochastNameA = "Stochast A"; @@ -167,7 +160,7 @@ })); // Call - IEnumerable names = illustrationPointNode.GetStochastNamesFromChildren(); + IEnumerable names = illustrationPointNode.GetStochastNamesRecursively(); // Assert CollectionAssert.AreEqual(new[] Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/IllustrationPoints/StochastValidatorTest.cs =================================================================== diff -u -r92f0a266f3ee297a3e0332e9a36fc3ec70d47b59 -r831379390ac72116a2f1c3a014063bbd60ab928d --- Ringtoets/Common/test/Ringtoets.Common.Data.Test/IllustrationPoints/StochastValidatorTest.cs (.../StochastValidatorTest.cs) (revision 92f0a266f3ee297a3e0332e9a36fc3ec70d47b59) +++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/IllustrationPoints/StochastValidatorTest.cs (.../StochastValidatorTest.cs) (revision 831379390ac72116a2f1c3a014063bbd60ab928d) @@ -21,7 +21,6 @@ using System; using System.Collections.Generic; -using System.Linq; using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.IllustrationPoints; @@ -43,32 +42,6 @@ } [Test] - public void ValidateStochasts_StochastsEmpty_DoesNotThrow() - { - // Call - TestDelegate test = () => StochastValidator.ValidateStochasts(Enumerable.Empty()); - - // Assert - Assert.DoesNotThrow(test); - } - - [Test] - public void ValidateStochasts_SingleStochast_DoesNotThrow() - { - // Setup - var stochasts = new List - { - new Stochast("Stochast A", 1, 2) - }; - - // Call - TestDelegate test = () => StochastValidator.ValidateStochasts(stochasts); - - // Assert - Assert.DoesNotThrow(test); - } - - [Test] public void ValidateStochasts_UniqueStochasts_DoesNotThrow() { // Setup Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/IllustrationPoints/SubMechanismIllustrationPointExtensionsTest.cs =================================================================== diff -u -r92f0a266f3ee297a3e0332e9a36fc3ec70d47b59 -r831379390ac72116a2f1c3a014063bbd60ab928d --- Ringtoets/Common/test/Ringtoets.Common.Data.Test/IllustrationPoints/SubMechanismIllustrationPointExtensionsTest.cs (.../SubMechanismIllustrationPointExtensionsTest.cs) (revision 92f0a266f3ee297a3e0332e9a36fc3ec70d47b59) +++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/IllustrationPoints/SubMechanismIllustrationPointExtensionsTest.cs (.../SubMechanismIllustrationPointExtensionsTest.cs) (revision 831379390ac72116a2f1c3a014063bbd60ab928d) @@ -21,7 +21,6 @@ using System; using System.Collections.Generic; -using System.Linq; using NUnit.Framework; using Ringtoets.Common.Data.IllustrationPoints; using Ringtoets.Common.Data.TestUtil.IllustrationPoints; @@ -45,33 +44,33 @@ } [Test] - public void GetStochastNames_SubMechanismIllustrationPointWithoutStochast_ReturnsEmptyList() + public void GetStochastNames_SubMechanismIllustrationPointWithStochast_ReturnStochastNames() { // Setup - var subMechanismIllustrationPoint = new TestSubMechanismIllustrationPoint(); - - // Call - IEnumerable names = subMechanismIllustrationPoint.GetStochastNames(); - - // Assert - CollectionAssert.IsEmpty(names); - } - - [Test] - public void GetStochastNames_SubMechanismIllustrationPointWithStochast_ReturnsExpectedName() - { - // Setup - const string stochastName = "Stochast A"; + var random = new Random(21); + const string stochastNameA = "Stochast A"; + const string stochastNameB = "Stochast B"; var subMechanismIllustrationPoint = new TestSubMechanismIllustrationPoint(new[] { - new SubMechanismIllustrationPointStochast(stochastName, 2, 5, 3) + new SubMechanismIllustrationPointStochast(stochastNameA, + random.NextDouble(), + random.NextDouble(), + random.NextDouble()), + new SubMechanismIllustrationPointStochast(stochastNameB, + random.NextDouble(), + random.NextDouble(), + random.NextDouble()) }); // Call IEnumerable names = subMechanismIllustrationPoint.GetStochastNames(); // Assert - Assert.AreEqual(stochastName, names.Single()); + CollectionAssert.AreEqual(new[] + { + stochastNameA, + stochastNameB + }, names); } } } \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/DesignWaterLevelCalculationServiceTest.cs =================================================================== diff -u -r9a6b8bd8e680c7b847ad548bad1c5a8c2d33b143 -r831379390ac72116a2f1c3a014063bbd60ab928d --- Ringtoets/Common/test/Ringtoets.Common.Service.Test/DesignWaterLevelCalculationServiceTest.cs (.../DesignWaterLevelCalculationServiceTest.cs) (revision 9a6b8bd8e680c7b847ad548bad1c5a8c2d33b143) +++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/DesignWaterLevelCalculationServiceTest.cs (.../DesignWaterLevelCalculationServiceTest.cs) (revision 831379390ac72116a2f1c3a014063bbd60ab928d) @@ -295,7 +295,7 @@ } [Test] - public void Calculate_CalculationRanErrorInSettingIllustrationPoints_GeneralResultNotSetAndLogsWarning() + public void Calculate_CalculationRanErrorInSettingIllustrationPoints_IllustrationPointsNotSetAndLogsWarning() { // Setup string validFilePath = Path.Combine(testDataPath, validFile); Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/Structures/StructuresCalculationServiceBaseTest.cs =================================================================== diff -u -r9a6b8bd8e680c7b847ad548bad1c5a8c2d33b143 -r831379390ac72116a2f1c3a014063bbd60ab928d --- Ringtoets/Common/test/Ringtoets.Common.Service.Test/Structures/StructuresCalculationServiceBaseTest.cs (.../StructuresCalculationServiceBaseTest.cs) (revision 9a6b8bd8e680c7b847ad548bad1c5a8c2d33b143) +++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/Structures/StructuresCalculationServiceBaseTest.cs (.../StructuresCalculationServiceBaseTest.cs) (revision 831379390ac72116a2f1c3a014063bbd60ab928d) @@ -597,7 +597,7 @@ } [Test] - public void Calculate_CalculationRanErrorInSettingIllustrationPoints_GeneralResultNotSetAndLogsWarning() + public void Calculate_CalculationRanErrorInSettingIllustrationPoints_IllustrationPointsNotSetAndLogsWarning() { // Setup var mocks = new MockRepository(); Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/WaveHeightCalculationServiceTest.cs =================================================================== diff -u -r9a6b8bd8e680c7b847ad548bad1c5a8c2d33b143 -r831379390ac72116a2f1c3a014063bbd60ab928d --- Ringtoets/Common/test/Ringtoets.Common.Service.Test/WaveHeightCalculationServiceTest.cs (.../WaveHeightCalculationServiceTest.cs) (revision 9a6b8bd8e680c7b847ad548bad1c5a8c2d33b143) +++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/WaveHeightCalculationServiceTest.cs (.../WaveHeightCalculationServiceTest.cs) (revision 831379390ac72116a2f1c3a014063bbd60ab928d) @@ -290,7 +290,7 @@ } [Test] - public void Calculate_ValidWaveHeightCalculationButIllustrationPointResultsWithDuplicateStochasts_IllustrationPointNotSetAndLog() + public void Calculate_ValidWaveHeightCalculationButIllustrationPointResultsWithDuplicateStochasts_IllustrationPointsNotSetAndLog() { // Setup string validFilePath = Path.Combine(testDataPath, validFile); Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Service.Test/GrassCoverErosionInwardsCalculationServiceTest.cs =================================================================== diff -u -r9a6b8bd8e680c7b847ad548bad1c5a8c2d33b143 -r831379390ac72116a2f1c3a014063bbd60ab928d --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Service.Test/GrassCoverErosionInwardsCalculationServiceTest.cs (.../GrassCoverErosionInwardsCalculationServiceTest.cs) (revision 9a6b8bd8e680c7b847ad548bad1c5a8c2d33b143) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Service.Test/GrassCoverErosionInwardsCalculationServiceTest.cs (.../GrassCoverErosionInwardsCalculationServiceTest.cs) (revision 831379390ac72116a2f1c3a014063bbd60ab928d) @@ -1588,7 +1588,7 @@ } [Test] - public void Calculate_ValidInputButOvertoppingGeneralResultNull_GeneralResultNotSetAndLogs() + public void Calculate_ValidInputButOvertoppingGeneralResultNull_IllustrationPointsNotSetAndLogs() { // Setup GrassCoverErosionInwardsFailureMechanism failureMechanism = CreateGrassCoverErosionInwardsFailureMechanism(); @@ -1752,7 +1752,7 @@ } [Test] - public void Calculate_ValidInputButOvertoppingRateGeneralResultNull_GeneralResultNotSetAndLogs() + public void Calculate_ValidInputButOvertoppingRateGeneralResultNull_IllustrationPointsNotSetAndLogs() { // Setup GrassCoverErosionInwardsFailureMechanism failureMechanism = CreateGrassCoverErosionInwardsFailureMechanism(); @@ -1916,7 +1916,7 @@ } [Test] - public void Calculate_ValidInputButDikeHeightGeneralResultNull_GeneralResultNotSetAndLogs() + public void Calculate_ValidInputButDikeHeightGeneralResultNull_IllustrationPointsNotSetAndLogs() { // Setup GrassCoverErosionInwardsFailureMechanism failureMechanism = CreateGrassCoverErosionInwardsFailureMechanism(); @@ -2080,7 +2080,7 @@ } [Test] - public void Calculate_ValidInputButOvertoppingIllustrationPointResultsOfIncorrectType_GeneralResultNotSetAndLogsWarning() + public void Calculate_ValidInputButOvertoppingIllustrationPointResultsOfIncorrectType_IllustrationPointsNotSetAndLogsWarning() { // Setup GrassCoverErosionInwardsFailureMechanism failureMechanism = CreateGrassCoverErosionInwardsFailureMechanism(); @@ -2164,7 +2164,7 @@ } [Test] - public void Calculate_OvertoppingCalculationRanErrorInSettingIllustrationPoints_GeneralResultNotSetAndLogsWarning() + public void Calculate_OvertoppingCalculationRanErrorInSettingIllustrationPoints_IllustrationPointsNotSetAndLogsWarning() { // Setup GrassCoverErosionInwardsFailureMechanism failureMechanism = CreateGrassCoverErosionInwardsFailureMechanism(); @@ -2248,7 +2248,7 @@ } [Test] - public void Calculate_ValidInputButOvertoppingRateIllustrationPointResultsOfIncorrectType_GeneralResultNotSetAndLogsWarning() + public void Calculate_ValidInputButOvertoppingRateIllustrationPointResultsOfIncorrectType_IllustrationPointsNotSetAndLogsWarning() { // Setup GrassCoverErosionInwardsFailureMechanism failureMechanism = CreateGrassCoverErosionInwardsFailureMechanism(); @@ -2332,7 +2332,7 @@ } [Test] - public void Calculate_OvertoppingRateCalculationRanErrorInSettingIllustrationPoints_GeneralResultNotSetAndLogsWarning() + public void Calculate_OvertoppingRateCalculationRanErrorInSettingIllustrationPoints_IllustrationPointsNotSetAndLogsWarning() { // Setup GrassCoverErosionInwardsFailureMechanism failureMechanism = CreateGrassCoverErosionInwardsFailureMechanism(); @@ -2416,7 +2416,7 @@ } [Test] - public void Calculate_ValidInputButDikeHeightIllustrationPointResultsOfIncorrectType_GeneralResultNotSetAndLogsWarning() + public void Calculate_ValidInputButDikeHeightIllustrationPointResultsOfIncorrectType_IllustrationPointsNotSetAndLogsWarning() { // Setup GrassCoverErosionInwardsFailureMechanism failureMechanism = CreateGrassCoverErosionInwardsFailureMechanism(); @@ -2500,7 +2500,7 @@ } [Test] - public void Calculate_DikeHeightCalculationRanErrorInSettingIllustrationPoints_GeneralResultNotSetAndLogsWarning() + public void Calculate_DikeHeightCalculationRanErrorInSettingIllustrationPoints_IllustrationPointsNotSetAndLogsWarning() { // Setup GrassCoverErosionInwardsFailureMechanism failureMechanism = CreateGrassCoverErosionInwardsFailureMechanism(); Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Ringtoets.HydraRing.Calculation.csproj =================================================================== diff -u -rd7f56db6a475e07dd904bd61c0a56346aac4e565 -r831379390ac72116a2f1c3a014063bbd60ab928d --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Ringtoets.HydraRing.Calculation.csproj (.../Ringtoets.HydraRing.Calculation.csproj) (revision d7f56db6a475e07dd904bd61c0a56346aac4e565) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Ringtoets.HydraRing.Calculation.csproj (.../Ringtoets.HydraRing.Calculation.csproj) (revision 831379390ac72116a2f1c3a014063bbd60ab928d) @@ -170,9 +170,7 @@ Always - - Designer - +