Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/Input/WaveConditions/WaveConditionsCosineInput.cs =================================================================== diff -u --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/Input/WaveConditions/WaveConditionsCosineInput.cs (revision 0) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/Input/WaveConditions/WaveConditionsCosineInput.cs (revision 9dd80fda99e5d5b90931986f959b53c52da150b1) @@ -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. + +namespace Ringtoets.HydraRing.Calculation.Data.Input.WaveConditions +{ + /// + /// Container of all data necessary for performing a cosine based wave conditions calculation (Q-variant) via Hydra-Ring. + /// + public class WaveConditionsCosineInput : WaveConditionsInput + { + /// + /// Creates a new instance of the class. + /// + /// The id of the section to use during the calculation. + /// The id of the hydraulic station to use during the calculation. + /// The norm to use during the calculation. + public WaveConditionsCosineInput(int sectionId, long hydraulicBoundaryLocationId, double norm) : base(sectionId, hydraulicBoundaryLocationId, norm) {} + + public override int? GetSubMechanismModelId(int subMechanismId) + { + switch (subMechanismId) + { + case 4: + return 71; + case 5: + return 71; + default: + return null; + } + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/Input/WaveConditions/WaveConditionsTrapezoidInput.cs =================================================================== diff -u --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/Input/WaveConditions/WaveConditionsTrapezoidInput.cs (revision 0) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/Input/WaveConditions/WaveConditionsTrapezoidInput.cs (revision 9dd80fda99e5d5b90931986f959b53c52da150b1) @@ -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. + +namespace Ringtoets.HydraRing.Calculation.Data.Input.WaveConditions +{ + /// + /// Container of all data necessary for performing a trapezoid based wave conditions calculation (Q-variant) via Hydra-Ring. + /// + public class WaveConditionsTrapezoidInput : WaveConditionsInput + { + /// + /// Creates a new instance of the class. + /// + /// The id of the section to use during the calculation. + /// The id of the hydraulic station to use during the calculation. + /// The norm to use during the calculation. + public WaveConditionsTrapezoidInput(int sectionId, long hydraulicBoundaryLocationId, double norm) : base(sectionId, hydraulicBoundaryLocationId, norm) {} + + public override int? GetSubMechanismModelId(int subMechanismId) + { + switch (subMechanismId) + { + case 4: + return 70; + case 5: + return 70; + default: + return null; + } + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Ringtoets.HydraRing.Calculation.csproj =================================================================== diff -u -r9f2eb718d9c8913a47081582fb73dfa05f7f3319 -r9dd80fda99e5d5b90931986f959b53c52da150b1 --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Ringtoets.HydraRing.Calculation.csproj (.../Ringtoets.HydraRing.Calculation.csproj) (revision 9f2eb718d9c8913a47081582fb73dfa05f7f3319) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Ringtoets.HydraRing.Calculation.csproj (.../Ringtoets.HydraRing.Calculation.csproj) (revision 9dd80fda99e5d5b90931986f959b53c52da150b1) @@ -57,12 +57,14 @@ + + Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/WaveConditions/WaveConditionsCosineInputTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/WaveConditions/WaveConditionsCosineInputTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/WaveConditions/WaveConditionsCosineInputTest.cs (revision 9dd80fda99e5d5b90931986f959b53c52da150b1) @@ -0,0 +1,71 @@ +// 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 Core.Common.Utils; +using NUnit.Framework; +using Ringtoets.HydraRing.Calculation.Data; +using Ringtoets.HydraRing.Calculation.Data.Input.WaveConditions; + +namespace Ringtoets.HydraRing.Calculation.Test.Data.Input.WaveConditions +{ + [TestFixture] + public class WaveConditionsCosineInputTest + { + [Test] + public void Constructor_Always_ExpectedValues() + { + // Setup + const int norm = 111; + const int sectionId = 2; + const int hydraulicBoundaryLocationId = 3000; + + // Call + var waveConditionsCosineInput = new WaveConditionsCosineInput(sectionId, hydraulicBoundaryLocationId, norm); + + // Assert + const int expectedCalculationTypeId = 6; + const int expectedVariableId = 114; + double expectedBeta = StatisticsConverter.NormToBeta(norm); + Assert.IsInstanceOf(waveConditionsCosineInput); + Assert.AreEqual(HydraRingFailureMechanismType.QVariant, waveConditionsCosineInput.FailureMechanismType); + Assert.AreEqual(expectedCalculationTypeId, waveConditionsCosineInput.CalculationTypeId); + Assert.AreEqual(expectedVariableId, waveConditionsCosineInput.VariableId); + Assert.AreEqual(hydraulicBoundaryLocationId, waveConditionsCosineInput.HydraulicBoundaryLocationId); + Assert.IsNotNull(waveConditionsCosineInput.Section); + Assert.AreEqual(sectionId, waveConditionsCosineInput.Section.SectionId); + Assert.AreEqual(expectedBeta, waveConditionsCosineInput.Beta); + } + + [Test] + [TestCase(3, null)] + [TestCase(4, 71)] + [TestCase(5, 71)] + [TestCase(6, null)] + public void GetSubMechanismModelId_Always_ReturnsExpectedValues(int subMechanismModelId, int? expectedSubMechanismModelId) + { + // Call + var waveConditionsCosineInput = new WaveConditionsCosineInput(1, 1000, 111); + + // Assert + Assert.AreEqual(expectedSubMechanismModelId, waveConditionsCosineInput.GetSubMechanismModelId(subMechanismModelId)); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/WaveConditions/WaveConditionsTrapezoidInputTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/WaveConditions/WaveConditionsTrapezoidInputTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/WaveConditions/WaveConditionsTrapezoidInputTest.cs (revision 9dd80fda99e5d5b90931986f959b53c52da150b1) @@ -0,0 +1,71 @@ +// 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 Core.Common.Utils; +using NUnit.Framework; +using Ringtoets.HydraRing.Calculation.Data; +using Ringtoets.HydraRing.Calculation.Data.Input.WaveConditions; + +namespace Ringtoets.HydraRing.Calculation.Test.Data.Input.WaveConditions +{ + [TestFixture] + public class WaveConditionsTrapezoidInputTest + { + [Test] + public void Constructor_Always_ExpectedValues() + { + // Setup + const int norm = 111; + const int sectionId = 2; + const int hydraulicBoundaryLocationId = 3000; + + // Call + var waveConditionsTrapezoidInput = new WaveConditionsTrapezoidInput(sectionId, hydraulicBoundaryLocationId, norm); + + // Assert + const int expectedCalculationTypeId = 6; + const int expectedVariableId = 114; + double expectedBeta = StatisticsConverter.NormToBeta(norm); + Assert.IsInstanceOf(waveConditionsTrapezoidInput); + Assert.AreEqual(HydraRingFailureMechanismType.QVariant, waveConditionsTrapezoidInput.FailureMechanismType); + Assert.AreEqual(expectedCalculationTypeId, waveConditionsTrapezoidInput.CalculationTypeId); + Assert.AreEqual(expectedVariableId, waveConditionsTrapezoidInput.VariableId); + Assert.AreEqual(hydraulicBoundaryLocationId, waveConditionsTrapezoidInput.HydraulicBoundaryLocationId); + Assert.IsNotNull(waveConditionsTrapezoidInput.Section); + Assert.AreEqual(sectionId, waveConditionsTrapezoidInput.Section.SectionId); + Assert.AreEqual(expectedBeta, waveConditionsTrapezoidInput.Beta); + } + + [Test] + [TestCase(3, null)] + [TestCase(4, 70)] + [TestCase(5, 70)] + [TestCase(6, null)] + public void GetSubMechanismModelId_Always_ReturnsExpectedValues(int subMechanismModelId, int? expectedSubMechanismModelId) + { + // Call + var waveConditionsTrapezoidInput = new WaveConditionsTrapezoidInput(1, 1000, 111); + + // Assert + Assert.AreEqual(expectedSubMechanismModelId, waveConditionsTrapezoidInput.GetSubMechanismModelId(subMechanismModelId)); + } + } +} Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Ringtoets.HydraRing.Calculation.Test.csproj =================================================================== diff -u -r9f2eb718d9c8913a47081582fb73dfa05f7f3319 -r9dd80fda99e5d5b90931986f959b53c52da150b1 --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Ringtoets.HydraRing.Calculation.Test.csproj (.../Ringtoets.HydraRing.Calculation.Test.csproj) (revision 9f2eb718d9c8913a47081582fb73dfa05f7f3319) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Ringtoets.HydraRing.Calculation.Test.csproj (.../Ringtoets.HydraRing.Calculation.Test.csproj) (revision 9dd80fda99e5d5b90931986f959b53c52da150b1) @@ -58,13 +58,15 @@ + +