Index: Riskeer/Common/src/Riskeer.Common.Forms/Providers/ILengthEffectProvider.cs
===================================================================
diff -u
--- Riskeer/Common/src/Riskeer.Common.Forms/Providers/ILengthEffectProvider.cs (revision 0)
+++ Riskeer/Common/src/Riskeer.Common.Forms/Providers/ILengthEffectProvider.cs (revision a0bb29e75720a0d7ab00b8d9319ce26544a8c603)
@@ -0,0 +1,39 @@
+// Copyright (C) Stichting Deltares 2021. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer 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.
+
+namespace Riskeer.Common.Forms.Providers
+{
+ ///
+ /// Interface for providing length effect properties.
+ ///
+ public interface ILengthEffectProvider
+ {
+ ///
+ /// Gets whether the length effect should be used.
+ ///
+ bool UseLengthEffect { get; }
+
+ ///
+ /// Gets the n value of the section.
+ ///
+ double SectionN { get; }
+ }
+}
\ No newline at end of file
Index: Riskeer/Common/src/Riskeer.Common.Forms/Providers/LengthEffectProvider.cs
===================================================================
diff -u
--- Riskeer/Common/src/Riskeer.Common.Forms/Providers/LengthEffectProvider.cs (revision 0)
+++ Riskeer/Common/src/Riskeer.Common.Forms/Providers/LengthEffectProvider.cs (revision a0bb29e75720a0d7ab00b8d9319ce26544a8c603)
@@ -0,0 +1,61 @@
+// Copyright (C) Stichting Deltares 2021. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer 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;
+
+namespace Riskeer.Common.Forms.Providers
+{
+ ///
+ /// Provider for length effect properties.
+ ///
+ public class LengthEffectProvider : ILengthEffectProvider
+ {
+ private readonly Func getUseLengthEffectFunc;
+ private readonly Func getSectionNFunc;
+
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The to get whether
+ /// the length effect should be used.
+ /// The to get the section n.
+ /// Thrown when any parameter is null.
+ public LengthEffectProvider(Func getUseLengthEffectFunc, Func getSectionNFunc)
+ {
+ if (getUseLengthEffectFunc == null)
+ {
+ throw new ArgumentNullException(nameof(getUseLengthEffectFunc));
+ }
+
+ if (getSectionNFunc == null)
+ {
+ throw new ArgumentNullException(nameof(getSectionNFunc));
+ }
+
+ this.getUseLengthEffectFunc = getUseLengthEffectFunc;
+ this.getSectionNFunc = getSectionNFunc;
+ }
+
+ public bool UseLengthEffect => getUseLengthEffectFunc();
+
+ public double SectionN => getSectionNFunc();
+ }
+}
\ No newline at end of file
Index: Riskeer/Common/test/Riskeer.Common.Forms.Test/Providers/LengthEffectProviderTest.cs
===================================================================
diff -u
--- Riskeer/Common/test/Riskeer.Common.Forms.Test/Providers/LengthEffectProviderTest.cs (revision 0)
+++ Riskeer/Common/test/Riskeer.Common.Forms.Test/Providers/LengthEffectProviderTest.cs (revision a0bb29e75720a0d7ab00b8d9319ce26544a8c603)
@@ -0,0 +1,71 @@
+// Copyright (C) Stichting Deltares 2021. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer 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 Core.Common.TestUtil;
+using NUnit.Framework;
+using Riskeer.Common.Forms.Providers;
+
+namespace Riskeer.Common.Forms.Test.Providers
+{
+ [TestFixture]
+ public class LengthEffectProviderTest
+ {
+ [Test]
+ public void Constructor_GetUseLengthEffectFuncNull_ThrowsArgumentNullException()
+ {
+ // Call
+ void Call() => new LengthEffectProvider(null, () => double.NaN);
+
+ // Assert
+ var exception = Assert.Throws(Call);
+ Assert.AreEqual("getUseLengthEffectFunc", exception.ParamName);
+ }
+
+ [Test]
+ public void Constructor_GetSectionNFuncNull_ThrowsArgumentNullException()
+ {
+ // Call
+ void Call() => new LengthEffectProvider(() => true, null);
+
+ // Assert
+ var exception = Assert.Throws(Call);
+ Assert.AreEqual("getSectionNFunc", exception.ParamName);
+ }
+
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Setup
+ var random = new Random(21);
+ bool useLengthEffect = random.NextBoolean();
+ double sectionN = random.NextDouble();
+
+ // Call
+ var provider = new LengthEffectProvider(() => useLengthEffect, () => sectionN);
+
+ // Assert
+ Assert.IsInstanceOf(provider);
+ Assert.AreEqual(useLengthEffect, provider.UseLengthEffect);
+ Assert.AreEqual(sectionN, provider.SectionN);
+ }
+ }
+}
\ No newline at end of file