Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.KernelWrapper/Calculators/UpliftVan/UpliftVanCalculator.cs =================================================================== diff -u -rc54a379def1546f3938d79362ed6eb6ee9140f97 -r5af4cc02a453b09e6bd738f16a24b902ea82fb17 --- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.KernelWrapper/Calculators/UpliftVan/UpliftVanCalculator.cs (.../UpliftVanCalculator.cs) (revision c54a379def1546f3938d79362ed6eb6ee9140f97) +++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.KernelWrapper/Calculators/UpliftVan/UpliftVanCalculator.cs (.../UpliftVanCalculator.cs) (revision 5af4cc02a453b09e6bd738f16a24b902ea82fb17) @@ -122,16 +122,16 @@ MacroStabilityInput waternetDailyKernelInput = MacroStabilityInputCreator.CreateDailyWaternetForUpliftVan(input, soils, surfaceLine, soilProfile); MacroStabilityInput waternetExtremeKernelInput = MacroStabilityInputCreator.CreateExtremeWaternetForUpliftVan(input, soils, surfaceLine, soilProfile); - IWaternetKernel waternetDailyKernelWrapper = factory.CreateWaternetDailyKernel(waternetDailyKernelInput); - waternetDailyKernelWrapper.Calculate(); + IWaternetKernel waternetDailyKernel = factory.CreateWaternetDailyKernel(waternetDailyKernelInput); + waternetDailyKernel.Calculate(); - IWaternetKernel waternetExtremeKernelWrapper = factory.CreateWaternetExtremeKernel(waternetExtremeKernelInput); - waternetExtremeKernelWrapper.Calculate(); + IWaternetKernel waternetExtremeKernel = factory.CreateWaternetExtremeKernel(waternetExtremeKernelInput); + waternetExtremeKernel.Calculate(); MacroStabilityInput kernelInput = MacroStabilityInputCreator.CreateUpliftVan(input, soils, layerLookup, surfaceLine, soilProfile, - waternetDailyKernelWrapper.Waternet, - waternetExtremeKernelWrapper.Waternet); + waternetDailyKernel.Waternet, + waternetExtremeKernel.Waternet); return factory.CreateUpliftVanKernel(kernelInput); } Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.KernelWrapper/Calculators/Waternet/WaternetCalculator.cs =================================================================== diff -u -rc07f72d9a77743ab37c2ec417890c003399c6d75 -r5af4cc02a453b09e6bd738f16a24b902ea82fb17 --- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.KernelWrapper/Calculators/Waternet/WaternetCalculator.cs (.../WaternetCalculator.cs) (revision c07f72d9a77743ab37c2ec417890c003399c6d75) +++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.KernelWrapper/Calculators/Waternet/WaternetCalculator.cs (.../WaternetCalculator.cs) (revision 5af4cc02a453b09e6bd738f16a24b902ea82fb17) @@ -90,7 +90,7 @@ /// /// Creates a Waternet kernel. /// - /// The location to create the Waternet for. + /// The input of the kernel. /// The created . protected abstract IWaternetKernel CreateWaternetKernel(MacroStabilityInput kernelInput); Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.KernelWrapper/Creators/Input/LayerWithSoilCreator.cs =================================================================== diff -u -r6706d60d5fc1100ffdfaac1cec64e6f61ea9be74 -r5af4cc02a453b09e6bd738f16a24b902ea82fb17 --- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.KernelWrapper/Creators/Input/LayerWithSoilCreator.cs (.../LayerWithSoilCreator.cs) (revision 6706d60d5fc1100ffdfaac1cec64e6f61ea9be74) +++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.KernelWrapper/Creators/Input/LayerWithSoilCreator.cs (.../LayerWithSoilCreator.cs) (revision 5af4cc02a453b09e6bd738f16a24b902ea82fb17) @@ -120,7 +120,8 @@ } /// - /// Converts a into a . + /// Converts a into a + /// for the . /// /// The to convert. /// A based on . @@ -151,6 +152,7 @@ /// /// Converts a into a . + /// for the . /// /// The to convert. /// A based on . Fisheye: Tag 5af4cc02a453b09e6bd738f16a24b902ea82fb17 refers to a dead (removed) revision in file `Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.KernelWrapper/Creators/Input/LocationCreatorHelper.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.KernelWrapper/Creators/Input/UpliftVanWaternetCreatorInputCreator.cs =================================================================== diff -u -rccff17d5be60f6c1eed91d7140f964bfff890945 -r5af4cc02a453b09e6bd738f16a24b902ea82fb17 --- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.KernelWrapper/Creators/Input/UpliftVanWaternetCreatorInputCreator.cs (.../UpliftVanWaternetCreatorInputCreator.cs) (revision ccff17d5be60f6c1eed91d7140f964bfff890945) +++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.KernelWrapper/Creators/Input/UpliftVanWaternetCreatorInputCreator.cs (.../UpliftVanWaternetCreatorInputCreator.cs) (revision 5af4cc02a453b09e6bd738f16a24b902ea82fb17) @@ -53,7 +53,7 @@ throw new ArgumentNullException(nameof(input)); } - WaternetCreatorInput creatorInput = CreateBaseLocation(input); + WaternetCreatorInput creatorInput = CreateBaseWaternetCreatorInput(input); creatorInput.WaterLevelRiver = input.AssessmentLevel; creatorInput.HeadInPlLine3 = input.AssessmentLevel; creatorInput.HeadInPlLine4 = input.AssessmentLevel; @@ -68,11 +68,11 @@ } /// - /// Creates a based on the given under daily circumstances, + /// Creates a based on the given under daily circumstances, /// which can be used by . /// /// The to get the information from. - /// A new with the given information from . + /// A new with the given information from . /// Thrown when is null. /// Thrown when , /// or @@ -87,7 +87,7 @@ throw new ArgumentNullException(nameof(input)); } - WaternetCreatorInput creatorInput = CreateBaseLocation(input); + WaternetCreatorInput creatorInput = CreateBaseWaternetCreatorInput(input); creatorInput.WaterLevelRiver = input.WaterLevelRiverAverage; creatorInput.HeadInPlLine3 = input.WaterLevelRiverAverage; creatorInput.HeadInPlLine4 = input.WaterLevelRiverAverage; @@ -101,11 +101,11 @@ return creatorInput; } - private static WaternetCreatorInput CreateBaseLocation(UpliftVanCalculatorInput input) + private static WaternetCreatorInput CreateBaseWaternetCreatorInput(UpliftVanCalculatorInput input) { return new WaternetCreatorInput { - DikeSoilScenario = LocationCreatorHelper.ConvertDikeSoilScenario(input.DikeSoilScenario), + DikeSoilScenario = WaternetCreatorInputHelper.ConvertDikeSoilScenario(input.DikeSoilScenario), WaterLevelRiverAverage = input.WaterLevelRiverAverage, DrainageConstructionPresent = input.DrainageConstruction.IsPresent, DrainageConstruction = input.DrainageConstruction.IsPresent Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.KernelWrapper/Creators/Input/WaternetCreatorInputCreator.cs =================================================================== diff -u -r44e8b00d548969e48987e6d3227c02e6555b2767 -r5af4cc02a453b09e6bd738f16a24b902ea82fb17 --- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.KernelWrapper/Creators/Input/WaternetCreatorInputCreator.cs (.../WaternetCreatorInputCreator.cs) (revision 44e8b00d548969e48987e6d3227c02e6555b2767) +++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.KernelWrapper/Creators/Input/WaternetCreatorInputCreator.cs (.../WaternetCreatorInputCreator.cs) (revision 5af4cc02a453b09e6bd738f16a24b902ea82fb17) @@ -30,16 +30,16 @@ namespace Riskeer.MacroStabilityInwards.KernelWrapper.Creators.Input { /// - /// Creates instances which are required by . + /// Creates instances which are required by . /// internal static class WaternetCreatorInputCreator { /// - /// Creates a based on the given + /// Creates a based on the given /// which can be used by . /// /// The to get the information from. - /// A new with the given information from . + /// A new with the given information from . /// Thrown when is null. /// Thrown when , /// or @@ -56,7 +56,7 @@ return new WaternetCreatorInput { - DikeSoilScenario = LocationCreatorHelper.ConvertDikeSoilScenario(input.DikeSoilScenario), + DikeSoilScenario = WaternetCreatorInputHelper.ConvertDikeSoilScenario(input.DikeSoilScenario), WaterLevelRiver = input.AssessmentLevel, HeadInPlLine3 = input.AssessmentLevel, HeadInPlLine4 = input.AssessmentLevel, Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.KernelWrapper/Creators/Input/WaternetCreatorInputHelper.cs =================================================================== diff -u --- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.KernelWrapper/Creators/Input/WaternetCreatorInputHelper.cs (revision 0) +++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.KernelWrapper/Creators/Input/WaternetCreatorInputHelper.cs (revision 5af4cc02a453b09e6bd738f16a24b902ea82fb17) @@ -0,0 +1,68 @@ +// Copyright (C) Stichting Deltares 2019. 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 System.ComponentModel; +using Deltares.MacroStability.CSharpWrapper.Input; +using Riskeer.MacroStabilityInwards.Primitives; + +namespace Riskeer.MacroStabilityInwards.KernelWrapper.Creators.Input +{ + /// + /// Helper class to convert properties needed in the + /// and . + /// + internal static class WaternetCreatorInputHelper + { + /// + /// Converts a into a . + /// + /// The to convert. + /// A based on . + /// Thrown when + /// is an invalid value. + /// Thrown when + /// is a valid value, but unsupported. + public static DikeSoilScenario ConvertDikeSoilScenario(MacroStabilityInwardsDikeSoilScenario dikeSoilScenario) + { + if (!Enum.IsDefined(typeof(MacroStabilityInwardsDikeSoilScenario), dikeSoilScenario)) + { + throw new InvalidEnumArgumentException(nameof(dikeSoilScenario), + (int) dikeSoilScenario, + typeof(MacroStabilityInwardsDikeSoilScenario)); + } + + switch (dikeSoilScenario) + { + case MacroStabilityInwardsDikeSoilScenario.ClayDikeOnClay: + return DikeSoilScenario.ClayDikeOnClay; + case MacroStabilityInwardsDikeSoilScenario.SandDikeOnClay: + return DikeSoilScenario.SandDikeOnClay; + case MacroStabilityInwardsDikeSoilScenario.ClayDikeOnSand: + return DikeSoilScenario.ClayDikeOnSand; + case MacroStabilityInwardsDikeSoilScenario.SandDikeOnSand: + return DikeSoilScenario.SandDikeOnSand; + default: + throw new NotSupportedException(); + } + } + } +} \ No newline at end of file Fisheye: Tag 5af4cc02a453b09e6bd738f16a24b902ea82fb17 refers to a dead (removed) revision in file `Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.KernelWrapper.Test/Creators/Input/LocationCreatorHelperTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.KernelWrapper.Test/Creators/Input/WaternetCreatorInputHelperTest.cs =================================================================== diff -u --- Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.KernelWrapper.Test/Creators/Input/WaternetCreatorInputHelperTest.cs (revision 0) +++ Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.KernelWrapper.Test/Creators/Input/WaternetCreatorInputHelperTest.cs (revision 5af4cc02a453b09e6bd738f16a24b902ea82fb17) @@ -0,0 +1,64 @@ +// Copyright (C) Stichting Deltares 2019. 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.ComponentModel; +using Core.Common.TestUtil; +using Deltares.MacroStability.CSharpWrapper.Input; +using NUnit.Framework; +using Riskeer.MacroStabilityInwards.KernelWrapper.Creators.Input; +using Riskeer.MacroStabilityInwards.Primitives; + +namespace Riskeer.MacroStabilityInwards.KernelWrapper.Test.Creators.Input +{ + [TestFixture] + public class WaternetCreatorInputHelperTest + { + [Test] + public void ConvertDikeSoilScenario_InvalidDikeSoilScenario_ThrowInvalidEnumArgumentException() + { + // Setup + var dikeSoilScenario = (MacroStabilityInwardsDikeSoilScenario) 99; + + // Call + void Call() => WaternetCreatorInputHelper.ConvertDikeSoilScenario(dikeSoilScenario); + + // Assert + string message = $"The value of argument 'dikeSoilScenario' ({dikeSoilScenario}) is invalid for Enum type '{nameof(MacroStabilityInwardsDikeSoilScenario)}'."; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(Call, message); + } + + [Test] + [TestCase(MacroStabilityInwardsDikeSoilScenario.ClayDikeOnClay, DikeSoilScenario.ClayDikeOnClay)] + [TestCase(MacroStabilityInwardsDikeSoilScenario.ClayDikeOnSand, DikeSoilScenario.ClayDikeOnSand)] + [TestCase(MacroStabilityInwardsDikeSoilScenario.SandDikeOnClay, DikeSoilScenario.SandDikeOnClay)] + [TestCase(MacroStabilityInwardsDikeSoilScenario.SandDikeOnSand, DikeSoilScenario.SandDikeOnSand)] + public void ConvertDikeSoilScenario_ValidDikeSoilScenario_ReturnExpectedDikeSoilScenario( + MacroStabilityInwardsDikeSoilScenario macroStabilityInwardsDikeSoilScenario, + DikeSoilScenario expectedDikeSoilScenario) + { + // Call + DikeSoilScenario convertedDikeSoilScenario = WaternetCreatorInputHelper.ConvertDikeSoilScenario(macroStabilityInwardsDikeSoilScenario); + + // Assert + Assert.AreEqual(expectedDikeSoilScenario, convertedDikeSoilScenario); + } + } +} \ No newline at end of file