Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Utils/GrassCoverErosionInwardsHelper.cs =================================================================== diff -u -re5658f822fa85cab8e99cb3069867d3a87867386 -rd207738be4ce6f50f4e3e00839ea433acea10bbd --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Utils/GrassCoverErosionInwardsHelper.cs (.../GrassCoverErosionInwardsHelper.cs) (revision e5658f822fa85cab8e99cb3069867d3a87867386) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Utils/GrassCoverErosionInwardsHelper.cs (.../GrassCoverErosionInwardsHelper.cs) (revision d207738be4ce6f50f4e3e00839ea433acea10bbd) @@ -19,6 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; using System.Collections.Generic; using System.Linq; using Core.Common.Base.Geometry; @@ -41,19 +42,25 @@ /// A containing a /// of objects /// for each section name which has calculations. + /// When any input parameter is null. public static Dictionary> CollectCalculationsPerSegment( IEnumerable sectionResults, IEnumerable calculations) { - var calculationsPerSegment = new Dictionary>(); + if (sectionResults == null) + { + throw new ArgumentNullException("sectionResults"); + } - if (sectionResults == null || calculations == null) + if (calculations == null) { - return calculationsPerSegment; + throw new ArgumentNullException("calculations"); } SectionSegments[] sectionSegments = MakeSectionSegments(sectionResults); + var calculationsPerSegment = new Dictionary>(); + foreach (var calculation in calculations) { FailureMechanismSection section = FindSectionForCalculation(sectionSegments, calculation); @@ -74,15 +81,21 @@ /// whose are considered. /// The . /// The containing , or null. + /// When any input parameter is null. public static FailureMechanismSection FailureMechanismSectionForCalculation( IEnumerable sectionResults, GrassCoverErosionInwardsCalculation calculation) { - if (sectionResults == null || calculation == null) + if (sectionResults == null) { - return null; + throw new ArgumentNullException("sectionResults"); } + if (calculation == null) + { + throw new ArgumentNullException("calculation"); + } + SectionSegments[] sectionSegments = MakeSectionSegments(sectionResults); return FindSectionForCalculation(sectionSegments, calculation);