Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/Hydraulics/DikeHeightCalculationInputTest.cs =================================================================== diff -u -r716dae0b1b95fb38ad2aa6630f9ba694aa4631b2 -r25b96faf582aeda6b257d3f2394b7f0e22b977ba --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/Hydraulics/DikeHeightCalculationInputTest.cs (.../DikeHeightCalculationInputTest.cs) (revision 716dae0b1b95fb38ad2aa6630f9ba694aa4631b2) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/Hydraulics/DikeHeightCalculationInputTest.cs (.../DikeHeightCalculationInputTest.cs) (revision 25b96faf582aeda6b257d3f2394b7f0e22b977ba) @@ -65,30 +65,30 @@ var expectedRingBreakWater = new HydraRingBreakWater(2, 3.3); // Call - DikeHeightCalculationInput dikeHeightCalculationInput = new DikeHeightCalculationInput(hydraulicBoundaryLocationId, norm, section, - expectedRingProfilePoints, expectedRingForelandPoints, expectedRingBreakWater, - modelFactorCriticalOvertopping, - factorFbMean, factorFbStandardDeviation, - factorFnMean, factorFnStandardDeviation, - modelFactorOvertopping, - criticalOvertoppingMean, criticalOvertoppingStandardDeviation, - modelFactorFrunupMean, modelFactorFrunupStandardDeviation, - exponentModelFactorShallowMean, exponentModelFactorShallowStandardDeviation); + var input = new DikeHeightCalculationInput(hydraulicBoundaryLocationId, norm, section, + expectedRingProfilePoints, expectedRingForelandPoints, expectedRingBreakWater, + modelFactorCriticalOvertopping, + factorFbMean, factorFbStandardDeviation, + factorFnMean, factorFnStandardDeviation, + modelFactorOvertopping, + criticalOvertoppingMean, criticalOvertoppingStandardDeviation, + modelFactorFrunupMean, modelFactorFrunupStandardDeviation, + exponentModelFactorShallowMean, exponentModelFactorShallowStandardDeviation); // Assert double expectedBeta = StatisticsConverter.NormToBeta(norm); - Assert.IsInstanceOf(dikeHeightCalculationInput); - Assert.AreEqual(9, dikeHeightCalculationInput.CalculationTypeId); - Assert.AreEqual(hydraulicBoundaryLocationId, dikeHeightCalculationInput.HydraulicBoundaryLocationId); - Assert.AreEqual(HydraRingFailureMechanismType.DikesHeight, dikeHeightCalculationInput.FailureMechanismType); - Assert.AreEqual(1, dikeHeightCalculationInput.VariableId); - Assert.IsNotNull(dikeHeightCalculationInput.Section); - HydraRingDataEqualityHelper.AreEqual(GetDefaultDikeHeightVariables().ToArray(), dikeHeightCalculationInput.Variables.ToArray()); - CollectionAssert.AreEqual(expectedRingProfilePoints, dikeHeightCalculationInput.ProfilePoints); - CollectionAssert.AreEqual(expectedRingForelandPoints, dikeHeightCalculationInput.ForelandsPoints); - Assert.AreEqual(expectedRingBreakWater, dikeHeightCalculationInput.BreakWater); - Assert.AreEqual(expectedBeta, dikeHeightCalculationInput.Beta); - Assert.AreSame(section, dikeHeightCalculationInput.Section); + Assert.IsInstanceOf(input); + Assert.AreEqual(9, input.CalculationTypeId); + Assert.AreEqual(hydraulicBoundaryLocationId, input.HydraulicBoundaryLocationId); + Assert.AreEqual(HydraRingFailureMechanismType.DikesHeight, input.FailureMechanismType); + Assert.AreEqual(1, input.VariableId); + Assert.IsNotNull(input.Section); + HydraRingDataEqualityHelper.AreEqual(GetDefaultDikeHeightVariables().ToArray(), input.Variables.ToArray()); + CollectionAssert.AreEqual(expectedRingProfilePoints, input.ProfilePoints); + CollectionAssert.AreEqual(expectedRingForelandPoints, input.ForelandsPoints); + Assert.AreEqual(expectedRingBreakWater, input.BreakWater); + Assert.AreEqual(expectedBeta, input.Beta); + Assert.AreSame(section, input.Section); } [Test] @@ -102,14 +102,14 @@ HydraRingSection section = new HydraRingSection(1, double.NaN, double.NaN); // Call - DikeHeightCalculationInput dikeHeightCalculationInput = new DikeHeightCalculationInput(1, 1000, section, - new List(), - new List(), - new HydraRingBreakWater(0, 1.1), - 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13); + var input = new DikeHeightCalculationInput(1, 1000, section, + new List(), + new List(), + new HydraRingBreakWater(0, 1.1), + 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13); // Assert - Assert.AreEqual(expectedSubMechanismModelId, dikeHeightCalculationInput.GetSubMechanismModelId(subMechanismModelId)); + Assert.AreEqual(expectedSubMechanismModelId, input.GetSubMechanismModelId(subMechanismModelId)); } private static IEnumerable GetDefaultDikeHeightVariables() Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/Hydraulics/OvertoppingRateCalculationInputTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/Hydraulics/OvertoppingRateCalculationInputTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/Hydraulics/OvertoppingRateCalculationInputTest.cs (revision 25b96faf582aeda6b257d3f2394b7f0e22b977ba) @@ -0,0 +1,125 @@ +// 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.Collections.Generic; +using System.Linq; +using Core.Common.Utils; +using NUnit.Framework; +using Ringtoets.HydraRing.Calculation.Data; +using Ringtoets.HydraRing.Calculation.Data.Input.Hydraulics; +using Ringtoets.HydraRing.Calculation.Data.Input.Overtopping; +using Ringtoets.HydraRing.Calculation.TestUtil; + +namespace Ringtoets.HydraRing.Calculation.Test.Data.Input.Hydraulics +{ + [TestFixture] + public class OvertoppingRateCalculationInputTest + { + [Test] + public void Constructor_Always_ExpectedValues() + { + // Setup + var norm = 10000; + int hydraulicBoundaryLocationId = 1000; + HydraRingSection section = new HydraRingSection(1, double.NaN, double.NaN); + + const double dikeHeight = 1.1; + const double modelFactorCriticalOvertopping = 2.2; + const double factorFbMean = 3.3; + const double factorFbStandardDeviation = 4.4; + const double factorFnMean = 5.5; + const double factorFnStandardDeviation = 6.6; + const double modelFactorOvertopping = 7.7; + const double modelFactorFrunupMean = 8.8; + const double modelFactorFrunupStandardDeviation = 9.9; + const double exponentModelFactorShallowMean = 10.10; + const double exponentModelFactorShallowStandardDeviation = 11.11; + var expectedRingProfilePoints = new List + { + new HydraRingRoughnessProfilePoint(1.1, 2.2, 3.3) + }; + var expectedRingForelandPoints = new List + { + new HydraRingForelandPoint(2.2, 3.3) + }; + var expectedRingBreakWater = new HydraRingBreakWater(2, 3.3); + + // Call + var input = new OvertoppingRateCalculationInput(hydraulicBoundaryLocationId, norm, section, + expectedRingProfilePoints, expectedRingForelandPoints, expectedRingBreakWater, + dikeHeight, + modelFactorCriticalOvertopping, + factorFbMean, factorFbStandardDeviation, + factorFnMean, factorFnStandardDeviation, + modelFactorOvertopping, + modelFactorFrunupMean, modelFactorFrunupStandardDeviation, + exponentModelFactorShallowMean, exponentModelFactorShallowStandardDeviation); + + // Assert + double expectedBeta = StatisticsConverter.NormToBeta(norm); + Assert.IsInstanceOf(input); + Assert.AreEqual(9, input.CalculationTypeId); + Assert.AreEqual(hydraulicBoundaryLocationId, input.HydraulicBoundaryLocationId); + Assert.AreEqual(HydraRingFailureMechanismType.DikesHeight, input.FailureMechanismType); + Assert.AreEqual(17, input.VariableId); + Assert.IsNotNull(input.Section); + HydraRingDataEqualityHelper.AreEqual(GetDefaultOvertoppingRateVariables().ToArray(), input.Variables.ToArray()); + CollectionAssert.AreEqual(expectedRingProfilePoints, input.ProfilePoints); + CollectionAssert.AreEqual(expectedRingForelandPoints, input.ForelandsPoints); + Assert.AreEqual(expectedRingBreakWater, input.BreakWater); + Assert.AreEqual(expectedBeta, input.Beta); + Assert.AreSame(section, input.Section); + } + + [Test] + [TestCase(101, null)] + [TestCase(102, 94)] + [TestCase(103, 95)] + [TestCase(104, null)] + public void GetSubMechanismModelId_Always_ReturnsExpectedValues(int subMechanismModelId, int? expectedSubMechanismModelId) + { + // Setup + HydraRingSection section = new HydraRingSection(1, double.NaN, double.NaN); + + // Call + var input = new OvertoppingRateCalculationInput(1, 1000, section, + new List(), + new List(), + new HydraRingBreakWater(0, 1.1), + 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12); + + // Assert + Assert.AreEqual(expectedSubMechanismModelId, input.GetSubMechanismModelId(subMechanismModelId)); + } + + private static IEnumerable GetDefaultOvertoppingRateVariables() + { + yield return new HydraRingVariable(1, HydraRingDistributionType.Deterministic, 1.1, HydraRingDeviationType.Standard, double.NaN, double.NaN, double.NaN); + yield return new HydraRingVariable(8, HydraRingDistributionType.Deterministic, 2.2, HydraRingDeviationType.Standard, double.NaN, double.NaN, double.NaN); + yield return new HydraRingVariable(10, HydraRingDistributionType.Normal, double.NaN, HydraRingDeviationType.Standard, 3.3, 4.4, double.NaN); + yield return new HydraRingVariable(11, HydraRingDistributionType.Normal, double.NaN, HydraRingDeviationType.Standard, 5.5, 6.6, double.NaN); + yield return new HydraRingVariable(12, HydraRingDistributionType.Deterministic, 7.7, HydraRingDeviationType.Standard, double.NaN, double.NaN, double.NaN); + yield return new HydraRingVariable(17, HydraRingDistributionType.Deterministic, 0.0, HydraRingDeviationType.Standard, double.NaN, double.NaN, double.NaN); + yield return new HydraRingVariable(120, HydraRingDistributionType.Normal, double.NaN, HydraRingDeviationType.Standard, 8.8, 9.9, double.NaN); + yield return new HydraRingVariable(123, HydraRingDistributionType.Normal, double.NaN, HydraRingDeviationType.Standard, 10.10, 11.11, double.NaN); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Ringtoets.HydraRing.Calculation.Test.csproj =================================================================== diff -u -rcf68267c3449619bd75f0aea70ab158d74ab24fb -r25b96faf582aeda6b257d3f2394b7f0e22b977ba --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Ringtoets.HydraRing.Calculation.Test.csproj (.../Ringtoets.HydraRing.Calculation.Test.csproj) (revision cf68267c3449619bd75f0aea70ab158d74ab24fb) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Ringtoets.HydraRing.Calculation.Test.csproj (.../Ringtoets.HydraRing.Calculation.Test.csproj) (revision 25b96faf582aeda6b257d3f2394b7f0e22b977ba) @@ -66,6 +66,7 @@ +