Index: Core/Common/src/Core.Common.Base/Geometry/Math2D.cs =================================================================== diff -u -r57634f535a347ce49c2491f114d7238d5387c7a8 -rd71a89b689eceea043d5f7d93ea165fed0442159 --- Core/Common/src/Core.Common.Base/Geometry/Math2D.cs (.../Math2D.cs) (revision 57634f535a347ce49c2491f114d7238d5387c7a8) +++ Core/Common/src/Core.Common.Base/Geometry/Math2D.cs (.../Math2D.cs) (revision d71a89b689eceea043d5f7d93ea165fed0442159) @@ -23,9 +23,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; - using Core.Common.Base.Properties; - using MathNet.Numerics.LinearAlgebra; using MathNet.Numerics.LinearAlgebra.Double; @@ -120,20 +118,20 @@ var aLine = line1Point2.Y - line1Point1.Y; var bLine = line1Point1.X - line1Point2.X; - var cLine = aLine * line1Point1.X + bLine * line1Point1.Y; + var cLine = aLine*line1Point1.X + bLine*line1Point1.Y; var aOtherLine = line2Point2.Y - line2Point1.Y; var bOtherLine = line2Point1.X - line2Point2.X; - var cOtherLine = aOtherLine * line2Point1.X + bOtherLine * line2Point1.Y; + var cOtherLine = aOtherLine*line2Point1.X + bOtherLine*line2Point1.Y; - var determinant = aLine * bOtherLine - aOtherLine * bLine; + var determinant = aLine*bOtherLine - aOtherLine*bLine; if (Math.Abs(determinant) < epsilonForComparisons) { return null; } - var x = (bOtherLine * cLine - bLine * cOtherLine) / determinant; - var y = (aLine * cOtherLine - aOtherLine * cLine) / determinant; + var x = (bOtherLine*cLine - bLine*cOtherLine)/determinant; + var y = (aLine*cOtherLine - aOtherLine*cLine)/determinant; return new Point2D(x, y); } @@ -234,13 +232,13 @@ else { // Segments are at an angle and may intersect: - double sI = PerpDotProduct(v, w) / d; + double sI = PerpDotProduct(v, w)/d; if (sI < 0.0 || sI > 1.0) { return Segment2DIntersectSegment2DResult.CreateNoIntersectResult(); } - double tI = PerpDotProduct(u, w) / d; + double tI = PerpDotProduct(u, w)/d; if (tI < 0.0 || tI > 1.0) { return Segment2DIntersectSegment2DResult.CreateNoIntersectResult(); @@ -252,6 +250,19 @@ } /// + /// Gets the interpolated point between the two end points of the at + /// the of the length from the first end point. + /// + /// The segment to interpolate over. + /// The fraction of the length of the segment where to obtain a new point. + /// A new at the interpolated point. + public static Point2D GetInterpolatedPointAtFraction(Segment2D lineSegment, double fraction) + { + Vector segmentVector = lineSegment.SecondPoint - lineSegment.FirstPoint; + return lineSegment.FirstPoint + segmentVector.Multiply(fraction); + } + + /// /// Determines if two parallel vectors are collinear. /// /// The first 2D vector. @@ -271,13 +282,13 @@ Vector w2 = segment1.SecondPoint - segment2.FirstPoint; if (v[0] != 0.0) { - t0 = w[0] / v[0]; - t1 = w2[0] / v[0]; + t0 = w[0]/v[0]; + t1 = w2[0]/v[0]; } else { - t0 = w[1] / v[1]; - t1 = w2[1] / v[1]; + t0 = w[1]/v[1]; + t1 = w2[1]/v[1]; } // Require t0 to be smaller than t1, swapping if needed: if (t0 > t1) @@ -445,9 +456,8 @@ private static Point2D GetInterpolatedPoint(Segment2D lineSegment, double splitDistance) { - var interpolationFactor = splitDistance / lineSegment.Length; - Vector segmentVector = lineSegment.SecondPoint - lineSegment.FirstPoint; - return lineSegment.FirstPoint + segmentVector.Multiply(interpolationFactor); + var interpolationFactor = splitDistance/lineSegment.Length; + return GetInterpolatedPointAtFraction(lineSegment, interpolationFactor); } /// Index: Core/Common/test/Core.Common.Base.Test/Geometry/Math2DTest.cs =================================================================== diff -u -r3ce8a0c103af363c8e00798d95588ebe4d1e04a5 -rd71a89b689eceea043d5f7d93ea165fed0442159 --- Core/Common/test/Core.Common.Base.Test/Geometry/Math2DTest.cs (.../Math2DTest.cs) (revision 3ce8a0c103af363c8e00798d95588ebe4d1e04a5) +++ Core/Common/test/Core.Common.Base.Test/Geometry/Math2DTest.cs (.../Math2DTest.cs) (revision d71a89b689eceea043d5f7d93ea165fed0442159) @@ -1084,6 +1084,86 @@ Assert.AreEqual(expectedLength, length); } + [Test] + public void GetInterpolatedPoint_WithinLine_InterpolatesBetweenPoints() + { + // Setup + var pointA = new Point2D(1.8, 5.02); + var pointB = new Point2D(3.8, -2.2); + var segment = new Segment2D(pointA, pointB); + var fraction = 0.5; + + // Call + Point2D result = Math2D.GetInterpolatedPointAtFraction(segment, fraction); + + // Assert + Assert.AreEqual(new Point2D(2.8, (5.02 - 2.2) * fraction), result); + } + + [Test] + public void GetInterpolatedPoint_OnFirstEndPoint_ReturnsEndPointCoordinate() + { + // Setup + var pointA = new Point2D(1.8, 5.02); + var pointB = new Point2D(3.8, -2.2); + var segment = new Segment2D(pointA, pointB); + var fraction = 0.0; + + // Call + Point2D result = Math2D.GetInterpolatedPointAtFraction(segment, fraction); + + // Assert + Assert.AreEqual(pointA, result); + } + + [Test] + public void GetInterpolatedPoint_OnSecondEndPoint_ReturnsEndPointCoordinate() + { + // Setup + var pointA = new Point2D(1.8, 5.02); + var pointB = new Point2D(3.8, -2.2); + var segment = new Segment2D(pointA, pointB); + var fraction = 1.0; + + // Call + Point2D result = Math2D.GetInterpolatedPointAtFraction(segment, fraction); + + // Assert + Assert.AreEqual(pointB, result); + } + + [Test] + public void GetInterpolatedPoint_BeyondSecondEndPoint_ReturnsExtrapolatedPoint() + { + // Setup + var pointA = new Point2D(1.8, 5.02); + var pointB = new Point2D(3.8, -2.2); + var segment = new Segment2D(pointA, pointB); + var fraction = 1.5; + + // Call + Point2D result = Math2D.GetInterpolatedPointAtFraction(segment, fraction); + + // Assert + Assert.AreEqual(new Point2D(4.8, 5.02 + (-2.2 - 5.02) * fraction), result); + } + + [Test] + public void GetInterpolatedPoint_BeforeFirstEndPoint_ReturnsExtrapolatedPoint() + { + // Setup + var pointA = new Point2D(1.8, 5.02); + var pointB = new Point2D(3.8, -2.2); + var segment = new Segment2D(pointA, pointB); + var fraction = -0.5; + + // Call + Point2D result = Math2D.GetInterpolatedPointAtFraction(segment, fraction); + + // Assert + Assert.AreEqual(new Point2D(1.8 + (3.8 - 1.8) * fraction, 5.02 + ((-2.2 - 5.02) * fraction)), result); + } + private static void CollectionAssertAreEquivalent(Point2D[] expected, Point2D[] actual) { var comparer = new Point2DComparerWithTolerance(1e-6); Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/FailureMechanismContributionView.Designer.cs =================================================================== diff -u -r61849787ccd3c614e8ad17e2bf78a69aeb50d3f6 -rd71a89b689eceea043d5f7d93ea165fed0442159 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/FailureMechanismContributionView.Designer.cs (.../FailureMechanismContributionView.Designer.cs) (revision 61849787ccd3c614e8ad17e2bf78a69aeb50d3f6) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/FailureMechanismContributionView.Designer.cs (.../FailureMechanismContributionView.Designer.cs) (revision d71a89b689eceea043d5f7d93ea165fed0442159) @@ -48,12 +48,12 @@ // resources.ApplyResources(this.normInput, "normInput"); this.normInput.Maximum = new decimal(new int[] { - 200000, + 300000, 0, 0, 0}); this.normInput.Minimum = new decimal(new int[] { - 1, + 100, 0, 0, 0}); Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/FailureMechanismContributionViewTest.cs =================================================================== diff -u -r92232340450c767556aaecc1a048e21bcd75c94c -rd71a89b689eceea043d5f7d93ea165fed0442159 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/FailureMechanismContributionViewTest.cs (.../FailureMechanismContributionViewTest.cs) (revision 92232340450c767556aaecc1a048e21bcd75c94c) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/FailureMechanismContributionViewTest.cs (.../FailureMechanismContributionViewTest.cs) (revision d71a89b689eceea043d5f7d93ea165fed0442159) @@ -73,7 +73,7 @@ { // Setup var random = new Random(21); - var norm = random.Next(1, 200000); + var norm = random.Next(100, 300000); var otherContribution = random.Next(1, 100); var mockRepository = new MockRepository(); @@ -90,17 +90,23 @@ failureMechanism }, otherContribution, norm); + // Call using (var contributionView = new FailureMechanismContributionView { Data = contribution, AssessmentSection = assessmentSection }) { ShowFormWithView(contributionView); - var normTester = new ControlTester(normInputTextBoxName); // Assert + var normTester = new ControlTester(normInputTextBoxName); + var normControl = normTester.TheObject as NumericUpDown; + + Assert.NotNull(normControl); Assert.AreEqual(contribution.Norm.ToString(), normTester.Text); + Assert.AreEqual(300000, normControl.Maximum); + Assert.AreEqual(100, normControl.Minimum); } mockRepository.VerifyAll(); } @@ -110,7 +116,7 @@ { // Setup var random = new Random(21); - var norm = random.Next(1, 200000); + var norm = random.Next(100, 300000); var otherContribution = random.Next(1, 100); var mockRepository = new MockRepository(); Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/NormDependentFactorCollection.cs =================================================================== diff -u --- Ringtoets/Piping/src/Ringtoets.Piping.Data/NormDependentFactorCollection.cs (revision 0) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/NormDependentFactorCollection.cs (revision d71a89b689eceea043d5f7d93ea165fed0442159) @@ -0,0 +1,87 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Linq; +using Core.Common.Base.Geometry; + +namespace Ringtoets.Piping.Data +{ + internal class NormDependentFactorCollection + { + private Tuple[] points; + + /// + /// Creates a new instance of . The + /// are considered to be following a logarithmic function perfectly. + /// + /// Points that form a logarthmic function when fitted. + /// is null. + /// is contains fewer than 2 points. + public NormDependentFactorCollection(params Tuple[] points) + { + if (points == null) + { + throw new ArgumentNullException("points", "Point collection requires a value."); + } + if (points.Length < 2) + { + throw new ArgumentException("Need at least two points to be able to obtain norm dependent factors."); + } + + this.points = points.OrderBy(p => p.Item1).ToArray(); + } + + public double GetFactorFromNorm(int norm) + { + if (norm < points.First().Item1 || norm > points.Last().Item1) + { + var message = string.Format("The value of norm needs to be in range [{0},{1}].", points.First().Item1, points.Last().Item1); + throw new ArgumentOutOfRangeException("norm", message); + } + + int i = 1; + for (; i < points.Length; i++) + { + if (points[i].Item1 >= norm) + { + break; + } + } + + var normLog = Math.Log10(norm); + var firstPoint = ToPointInLogXScale(points[i-1]); + var secondPoint = ToPointInLogXScale(points[i]); + + return Math2D.GetInterpolatedPointAtFraction(new Segment2D( + firstPoint, + secondPoint), + (normLog - firstPoint.X) / (secondPoint.X - firstPoint.X)).Y; + } + + private Point2D ToPointInLogXScale(Tuple point) + { + var x1 = Math.Log10(point.Item1); + var y1 = point.Item2; + return new Point2D(x1, y1); + } + } +} \ No newline at end of file Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingProbabilityAssessmentInput.cs =================================================================== diff -u -rf4718385197b407ba9df173dfc6f4df74b75f4e1 -rd71a89b689eceea043d5f7d93ea165fed0442159 --- Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingProbabilityAssessmentInput.cs (.../PipingProbabilityAssessmentInput.cs) (revision f4718385197b407ba9df173dfc6f4df74b75f4e1) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingProbabilityAssessmentInput.cs (.../PipingProbabilityAssessmentInput.cs) (revision d71a89b689eceea043d5f7d93ea165fed0442159) @@ -34,6 +34,24 @@ private double a; private RoundedDouble upliftCriticalSafetyFactor; + private readonly NormDependentFactorCollection heaveNormDependentFactorCollection = new NormDependentFactorCollection( + Tuple.Create(100, 0.16), + Tuple.Create(300, 0.15), + Tuple.Create(1000, 0.13), + Tuple.Create(3000, 0.12), + Tuple.Create(10000, 0.11), + Tuple.Create(30000, 0.10), + Tuple.Create(300000, 0.09)); + + private readonly NormDependentFactorCollection sellmeNormDependentFactorCollection = new NormDependentFactorCollection( + Tuple.Create(100, 0.32), + Tuple.Create(300, 0.28), + Tuple.Create(1000, 0.24), + Tuple.Create(3000, 0.21), + Tuple.Create(10000, 0.19), + Tuple.Create(30000, 0.17), + Tuple.Create(300000, 0.13)); + /// /// Creates a new instance of . /// @@ -42,7 +60,7 @@ A = 0.4; B = 300.0; SectionLength = double.NaN; - + upliftCriticalSafetyFactor = new RoundedDouble(1, 1.2); } @@ -88,6 +106,28 @@ } /// + /// Gets the norm dependent factor which is used in the relation between safety factor and reliability index + /// for the Sellmeijer failure mechanism. + /// + /// The norm for which to obtain the factor. + /// A factor which can be used in a semi-probabilistic assessment. + public double GetSellmeijerNormDependentFactor(int norm) + { + return sellmeNormDependentFactorCollection.GetFactorFromNorm(norm); + } + + /// + /// Gets the norm dependent factor which is used in the relation between safety factor and reliability index + /// for the heave failure mechanism. + /// + /// The norm for which to obtain the factor. + /// A factor which can be used in a semi-probabilistic assessment. + public double GetHeaveNormDependentFactor(int norm) + { + return heaveNormDependentFactorCollection.GetFactorFromNorm(norm); + } + + /// /// Gets 'b' parameter used to factor in the 'length effect' when determining the /// maximum tolerated probability of failure. /// Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/Ringtoets.Piping.Data.csproj =================================================================== diff -u -r2363244674e6b7b97bead9a6855806420d368d80 -rd71a89b689eceea043d5f7d93ea165fed0442159 --- Ringtoets/Piping/src/Ringtoets.Piping.Data/Ringtoets.Piping.Data.csproj (.../Ringtoets.Piping.Data.csproj) (revision 2363244674e6b7b97bead9a6855806420d368d80) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/Ringtoets.Piping.Data.csproj (.../Ringtoets.Piping.Data.csproj) (revision d71a89b689eceea043d5f7d93ea165fed0442159) @@ -48,6 +48,7 @@ + Index: Ringtoets/Piping/src/Ringtoets.Piping.Service/PipingSemiProbabilisticCalculationService.cs =================================================================== diff -u -r845bead95b248fd299e02c02e9ae0892eebc6335 -rd71a89b689eceea043d5f7d93ea165fed0442159 --- Ringtoets/Piping/src/Ringtoets.Piping.Service/PipingSemiProbabilisticCalculationService.cs (.../PipingSemiProbabilisticCalculationService.cs) (revision 845bead95b248fd299e02c02e9ae0892eebc6335) +++ Ringtoets/Piping/src/Ringtoets.Piping.Service/PipingSemiProbabilisticCalculationService.cs (.../PipingSemiProbabilisticCalculationService.cs) (revision d71a89b689eceea043d5f7d93ea165fed0442159) @@ -19,6 +19,7 @@ private readonly double constantA; private readonly double constantB; private readonly double assessmentSectionLength; + private readonly double upliftCriticalSafetyFactor; private readonly double contribution; // Intermediate results @@ -49,7 +50,7 @@ /// The constant b. /// The length of the assessment section. /// The contribution of piping to the total failure. - private PipingSemiProbabilisticCalculationService(double upliftFactorOfSafety, double heaveFactorOfSafety, double sellmeijerFactorOfSafety, int returnPeriod, double constantA, double constantB, double assessmentSectionLength, double contribution) + private PipingSemiProbabilisticCalculationService(double upliftFactorOfSafety, double heaveFactorOfSafety, double sellmeijerFactorOfSafety, int returnPeriod, double constantA, double constantB, double assessmentSectionLength, double upliftCriticalSafetyFactor, double contribution) { this.heaveFactorOfSafety = heaveFactorOfSafety; this.upliftFactorOfSafety = upliftFactorOfSafety; @@ -58,6 +59,7 @@ this.constantA = constantA; this.constantB = constantB; this.assessmentSectionLength = assessmentSectionLength; + this.upliftCriticalSafetyFactor = upliftCriticalSafetyFactor; this.contribution = contribution; } @@ -86,6 +88,7 @@ pipingProbabilityAssessmentInput.A, pipingProbabilityAssessmentInput.B, pipingProbabilityAssessmentInput.SectionLength, + pipingProbabilityAssessmentInput.UpliftCriticalSafetyFactor, contribution/100); calculator.Calculate(); Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/NormDependentFactorCollectionTest.cs =================================================================== diff -u --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/NormDependentFactorCollectionTest.cs (revision 0) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/NormDependentFactorCollectionTest.cs (revision d71a89b689eceea043d5f7d93ea165fed0442159) @@ -0,0 +1,103 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Linq; +using NUnit.Framework; + +namespace Ringtoets.Piping.Data.Test +{ + [TestFixture] + public class NormDependentFactorCollectionTest + { + [Test] + public void Constructor_WithoutPoints_ThrowArgumentNullException() + { + // Call + TestDelegate test = () => new NormDependentFactorCollection(null); + + // Assert + Assert.Throws(test); + } + + [Test] + [TestCase(0)] + [TestCase(1)] + public void Constructor_WithTooFewPoints_ThrowArgumentException(int pointCount) + { + // Setup + var points = Enumerable.Repeat(Tuple.Create(1,0.2), pointCount).ToArray(); + + // Call + TestDelegate test = () => new NormDependentFactorCollection(points); + + // Assert + Assert.Throws(test); + } + + [Test] + [TestCase(-5)] + [TestCase(0)] + [TestCase(31)] + [TestCase(50)] + public void GetFactorFromNorm_NormOutsideRange_ThrowArgumentOutOfRangeException(int norm) + { + // Setup + var points = new[] + { + Tuple.Create(1, 0.2), + Tuple.Create(30, 0.5) + }; + NormDependentFactorCollection collection = new NormDependentFactorCollection(points); + + // Call + TestDelegate test = () => collection.GetFactorFromNorm(norm); + + // Assert + Assert.Throws(test); + } + + [Test] + [TestCase(1, 0.2)] + [TestCase(10, 0.403098)] + [TestCase(20, 0.464236)] + [TestCase(30, 0.5)] + [TestCase(40, 0.556317)] + [TestCase(50, 0.6)] + public void GetFactorFromNorm_NormInsideRange_ReturnsInterpolatedValue(int norm, double expectedValue) + { + // Setup + var points = new[] + { + Tuple.Create(1, 0.2), + Tuple.Create(30, 0.5), + Tuple.Create(50, 0.6) + }; + NormDependentFactorCollection collection = new NormDependentFactorCollection(points); + + // Call + var result = collection.GetFactorFromNorm(norm); + + // Assert + Assert.AreEqual(expectedValue, result, 1e-6); + } + } +} \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingProbabilityAssessmentInputTest.cs =================================================================== diff -u -re159c065240db0cf858fed2fc110acf6e1f07204 -rd71a89b689eceea043d5f7d93ea165fed0442159 --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingProbabilityAssessmentInputTest.cs (.../PipingProbabilityAssessmentInputTest.cs) (revision e159c065240db0cf858fed2fc110acf6e1f07204) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingProbabilityAssessmentInputTest.cs (.../PipingProbabilityAssessmentInputTest.cs) (revision d71a89b689eceea043d5f7d93ea165fed0442159) @@ -115,5 +115,75 @@ // Assert Assert.AreEqual(value, pipingProbabilityAssessmentInput.UpliftCriticalSafetyFactor, pipingProbabilityAssessmentInput.UpliftCriticalSafetyFactor.GetAccuracy()); } + + [Test] + [TestCase(99)] + [TestCase(300001)] + public void GetSellmeijerNormDependentFactor_NormOutOfRange_ThrowsArgumentOutOfRangeException(int norm) + { + // Setup + var pipingProbabilityAssessmentInput = new PipingProbabilityAssessmentInput(); + + // Call + TestDelegate test = () => pipingProbabilityAssessmentInput.GetSellmeijerNormDependentFactor(norm); + + // Assert + Assert.Throws(test); + } + + [Test] + [TestCase(100, 0.32)] + [TestCase(300, 0.28)] + [TestCase(1000, 0.24)] + [TestCase(3000, 0.21)] + [TestCase(10000, 0.19)] + [TestCase(30000, 0.17)] + [TestCase(300000, 0.13)] + public void GetSellmeijerNormDependentFactor_NormInRange_ReturnsExpectedValue(int norm, double expectedValue) + { + // Setup + var pipingProbabilityAssessmentInput = new PipingProbabilityAssessmentInput(); + + // Call + var result = pipingProbabilityAssessmentInput.GetSellmeijerNormDependentFactor(norm); + + // Assert + Assert.AreEqual(expectedValue, result); + } + + [Test] + [TestCase(99)] + [TestCase(300001)] + public void GetHeaveNormDependentFactor_NormOutOfRange_ThrowsArgumentOutOfRangeException(int norm) + { + // Setup + var pipingProbabilityAssessmentInput = new PipingProbabilityAssessmentInput(); + + // Call + TestDelegate test = () => pipingProbabilityAssessmentInput.GetHeaveNormDependentFactor(norm); + + // Assert + Assert.Throws(test); + } + + [Test] + [TestCase(100, 0.16)] + [TestCase(300, 0.15)] + [TestCase(1000, 0.13)] + [TestCase(3000, 0.12)] + [TestCase(10000, 0.11)] + [TestCase(30000, 0.10)] + [TestCase(300000, 0.09)] + public void GetHeaveNormDependentFactor_NormInRange_ReturnsExpectedValue(int norm, double expectedValue) + { + // Setup + var pipingProbabilityAssessmentInput = new PipingProbabilityAssessmentInput(); + + // Call + var result = pipingProbabilityAssessmentInput.GetHeaveNormDependentFactor(norm); + + // Assert + Assert.AreEqual(expectedValue, result); + } } } \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Ringtoets.Piping.Data.Test.csproj =================================================================== diff -u -r2363244674e6b7b97bead9a6855806420d368d80 -rd71a89b689eceea043d5f7d93ea165fed0442159 --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Ringtoets.Piping.Data.Test.csproj (.../Ringtoets.Piping.Data.Test.csproj) (revision 2363244674e6b7b97bead9a6855806420d368d80) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Ringtoets.Piping.Data.Test.csproj (.../Ringtoets.Piping.Data.Test.csproj) (revision d71a89b689eceea043d5f7d93ea165fed0442159) @@ -58,6 +58,7 @@ +