Index: Riskeer/Piping/src/Riskeer.Piping.Data/PipingInput.cs =================================================================== diff -u -r86594ccd7329d320872573a1d066fe18959d3cea -ra45855b1a31ad8cdf4d0814cfd73ab0c19292ab0 --- Riskeer/Piping/src/Riskeer.Piping.Data/PipingInput.cs (.../PipingInput.cs) (revision 86594ccd7329d320872573a1d066fe18959d3cea) +++ Riskeer/Piping/src/Riskeer.Piping.Data/PipingInput.cs (.../PipingInput.cs) (revision a45855b1a31ad8cdf4d0814cfd73ab0c19292ab0) @@ -104,9 +104,9 @@ if (!double.IsNaN(newEntryPointL)) { - if (!double.IsNaN(exitPointL)) + if (!double.IsNaN(exitPointL) && newEntryPointL >= exitPointL) { - ValidateEntryExitPoint(newEntryPointL, exitPointL); + throw new ArgumentOutOfRangeException(nameof(value), Resources.PipingInput_EntryPointL_greater_or_equal_to_ExitPointL); } if (surfaceLine != null) @@ -143,9 +143,9 @@ if (!double.IsNaN(newExitPointL)) { - if (!double.IsNaN(entryPointL)) + if (!double.IsNaN(entryPointL) && entryPointL >= newExitPointL) { - ValidateEntryExitPoint(entryPointL, newExitPointL); + throw new ArgumentOutOfRangeException(nameof(value), Resources.PipingInput_EntryPointL_greater_or_equal_to_ExitPointL); } if (surfaceLine != null) @@ -296,22 +296,14 @@ } } - private static void ValidateEntryExitPoint(RoundedDouble entryPointLocalXCoordinate, RoundedDouble exitPointLocalXCoordinate) + private void ValidatePointOnSurfaceLine(RoundedDouble value) { - if (entryPointLocalXCoordinate >= exitPointLocalXCoordinate) + if (!surfaceLine.ValidateInRange(value)) { - throw new ArgumentOutOfRangeException(null, Resources.PipingInput_EntryPointL_greater_or_equal_to_ExitPointL); - } - } - - private void ValidatePointOnSurfaceLine(RoundedDouble newLocalXCoordinate) - { - if (!surfaceLine.ValidateInRange(newLocalXCoordinate)) - { var validityRange = new Range(surfaceLine.LocalGeometry.First().X, surfaceLine.LocalGeometry.Last().X); string outOfRangeMessage = string.Format(Resources.PipingInput_ValidatePointOnSurfaceLine_Length_must_be_in_Range_0_, validityRange.ToString(FormattableConstants.ShowAtLeastOneDecimal, CultureInfo.CurrentCulture)); - throw new ArgumentOutOfRangeException(null, outOfRangeMessage); + throw new ArgumentOutOfRangeException(nameof(value), outOfRangeMessage); } }