Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/LogNormalHydraRingVariable.cs =================================================================== diff -u --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/LogNormalHydraRingVariable.cs (revision 0) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/LogNormalHydraRingVariable.cs (revision 3d5e3ba31a910e7712b77eb49f112069ae1bf396) @@ -0,0 +1,93 @@ +// 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. + +namespace Ringtoets.HydraRing.Calculation.Data +{ + /// + /// Class for LogNormal Hydra-Ring variable related data. + /// + public class LogNormalHydraRingVariable : HydraRingVariable2 + { + private readonly double parameter1; + private readonly double parameter2; + private readonly double parameter3; + + /// + /// Creates a new instance of . + /// + /// The Hydra-Ring id corresponding to the variable that is considered. + /// The deviation type in case the variable is random. + /// The parameter1 value of the variable. + /// The parameter2 value of the variable. + /// The parameter3 value of the variable. + public LogNormalHydraRingVariable(int variableId, HydraRingDeviationType deviationType, double parameter1, double parameter2, double parameter3) + : base(variableId, deviationType) + { + this.parameter1 = parameter1; + this.parameter2 = parameter2; + this.parameter3 = parameter3; + } + + public override double Parameter1 + { + get + { + return parameter1; + } + } + + public override double? Parameter2 + { + get + { + return DeviationType == HydraRingDeviationType.Standard + ? parameter2 + : base.Parameter2; + } + } + + public override double? Parameter3 + { + get + { + return parameter3; + } + } + + public override double CoefficientOfVariation + { + get + { + return DeviationType == HydraRingDeviationType.Variation + ? parameter2 + : base.CoefficientOfVariation; + } + } + + public override HydraRingDistributionType DistributionType + { + get + { + return HydraRingDistributionType.LogNormal; + } + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Ringtoets.HydraRing.Calculation.csproj =================================================================== diff -u -r6fa6777d83fb74d42f0584ec98f04f1fbede993c -r3d5e3ba31a910e7712b77eb49f112069ae1bf396 --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Ringtoets.HydraRing.Calculation.csproj (.../Ringtoets.HydraRing.Calculation.csproj) (revision 6fa6777d83fb74d42f0584ec98f04f1fbede993c) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Ringtoets.HydraRing.Calculation.csproj (.../Ringtoets.HydraRing.Calculation.csproj) (revision 3d5e3ba31a910e7712b77eb49f112069ae1bf396) @@ -91,6 +91,7 @@ + Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/LogNormalHydraRingVariableTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/LogNormalHydraRingVariableTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/LogNormalHydraRingVariableTest.cs (revision 3d5e3ba31a910e7712b77eb49f112069ae1bf396) @@ -0,0 +1,50 @@ +// 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 NUnit.Framework; +using Ringtoets.HydraRing.Calculation.Data; + +namespace Ringtoets.HydraRing.Calculation.Test.Data +{ + [TestFixture] + public class LogNormalHydraRingVariableTest + { + [Test] + [TestCase(HydraRingDeviationType.Standard, 3.3, 0)] + [TestCase(HydraRingDeviationType.Variation, null, 3.3)] + public void Constructor_ExpectedValues(HydraRingDeviationType deviationType, double? expectedParameter2, double expectedCoefficientOfVariation) + { + // Call + var hydraRingVariable = new LogNormalHydraRingVariable(1, deviationType, 2.2, 3.3, 4.4); + + // Assert + Assert.IsInstanceOf(hydraRingVariable); + Assert.AreEqual(1, hydraRingVariable.VariableId); + Assert.AreEqual(HydraRingDistributionType.LogNormal, hydraRingVariable.DistributionType); + Assert.AreEqual(deviationType, hydraRingVariable.DeviationType); + Assert.AreEqual(2.2, hydraRingVariable.Parameter1); + Assert.AreEqual(expectedParameter2, hydraRingVariable.Parameter2); + Assert.AreEqual(4.4, hydraRingVariable.Parameter3); + Assert.IsNull(hydraRingVariable.Parameter4); + Assert.AreEqual(expectedCoefficientOfVariation, hydraRingVariable.CoefficientOfVariation); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Ringtoets.HydraRing.Calculation.Test.csproj =================================================================== diff -u -r6fa6777d83fb74d42f0584ec98f04f1fbede993c -r3d5e3ba31a910e7712b77eb49f112069ae1bf396 --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Ringtoets.HydraRing.Calculation.Test.csproj (.../Ringtoets.HydraRing.Calculation.Test.csproj) (revision 6fa6777d83fb74d42f0584ec98f04f1fbede993c) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Ringtoets.HydraRing.Calculation.Test.csproj (.../Ringtoets.HydraRing.Calculation.Test.csproj) (revision 3d5e3ba31a910e7712b77eb49f112069ae1bf396) @@ -90,6 +90,7 @@ +