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));
}
}
}