using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Deltares.Dam.Data; using Deltares.Dam.Data.DamEngineIo; using Deltares.DamEngine.Io.XmlInput; using Deltares.Geotechnics.SurfaceLines; using NUnit.Framework; namespace Deltares.Dam.Tests.DamEngineIo { [TestFixture] public class ConversionHelperTests { [Test] [TestCase(InputDamProjectType.Assessment, DamProjectType.Assessment)] [TestCase(InputDamProjectType.AssessmentRegional, DamProjectType.Assessment)] [TestCase(InputDamProjectType.Design, DamProjectType.Design)] [TestCase(InputDamProjectType.Operational, DamProjectType.Calamity)] //[TestCase(InputDamProjectType.NWO, DamProjectType.NWO)] // not implemented yet public void CanConvertToDamProjectType(InputDamProjectType inputDamProjectType, DamProjectType damProjectType) { Assert.AreEqual(damProjectType, ConversionHelper.ConvertToDamProjectType(inputDamProjectType)); } [Test] [TestCase(DamProjectType.Assessment, InputDamProjectType.Assessment)] [TestCase(DamProjectType.Design, InputDamProjectType.Design)] [TestCase(DamProjectType.Calamity, InputDamProjectType.Operational)] // [TestCase(DamProjectType.NWO, InputDamProjectType.NWO)] // not implemented yet public void CanConvertToInputDamProjectType(DamProjectType damProjectType, InputDamProjectType inputDamProjectType) { Assert.AreEqual(inputDamProjectType, ConversionHelper.ConvertToInputDamProjectType(damProjectType)); } [Test] [TestCase(PLLineCreationMethod.ExpertKnowledgeLinearInDike, LocationWaternetOptionsPhreaticLineCreationMethod.ExpertKnowledgeLinearInDike)] [TestCase(PLLineCreationMethod.ExpertKnowledgeRRD, LocationWaternetOptionsPhreaticLineCreationMethod.ExpertKnowledgeRRD)] [TestCase(PLLineCreationMethod.GaugesWithFallbackToExpertKnowledgeRRD, LocationWaternetOptionsPhreaticLineCreationMethod.GaugesWithFallbackToExpertKnowledgeRRD)] [TestCase(PLLineCreationMethod.None, LocationWaternetOptionsPhreaticLineCreationMethod.None)] [TestCase(PLLineCreationMethod.Sensors, LocationWaternetOptionsPhreaticLineCreationMethod.Sensors)] public void CanConvertToPlLineCreationMethod(PLLineCreationMethod plLineCreationMethod, LocationWaternetOptionsPhreaticLineCreationMethod inputPhreaticLineCreationMethod) { Assert.AreEqual(inputPhreaticLineCreationMethod, ConversionHelper.ConvertToInputPhreaticLineCreationMethod(plLineCreationMethod)); } [Test] [TestCase(LocationWaternetOptionsPhreaticLineCreationMethod.ExpertKnowledgeLinearInDike, PLLineCreationMethod.ExpertKnowledgeLinearInDike)] [TestCase(LocationWaternetOptionsPhreaticLineCreationMethod.ExpertKnowledgeRRD, PLLineCreationMethod.ExpertKnowledgeRRD)] [TestCase(LocationWaternetOptionsPhreaticLineCreationMethod.GaugesWithFallbackToExpertKnowledgeRRD, PLLineCreationMethod.GaugesWithFallbackToExpertKnowledgeRRD)] [TestCase(LocationWaternetOptionsPhreaticLineCreationMethod.None, PLLineCreationMethod.None)] [TestCase(LocationWaternetOptionsPhreaticLineCreationMethod.Sensors, PLLineCreationMethod.Sensors)] public void CanConvertToInputPlLineCreationMethod(LocationWaternetOptionsPhreaticLineCreationMethod inputPhreaticLineCreationMethod, PLLineCreationMethod plLineCreationMethod) { Assert.AreEqual(plLineCreationMethod, ConversionHelper.ConvertToPhreaticLineCreationMethod(inputPhreaticLineCreationMethod)); } [Test] [TestCase(LocationWaternetOptionsIntrusionVerticalWaterPressure.FullHydroStatic, IntrusionVerticalWaterPressureType.FullHydroStatic)] [TestCase(LocationWaternetOptionsIntrusionVerticalWaterPressure.HydroStatic, IntrusionVerticalWaterPressureType.HydroStatic)] [TestCase(LocationWaternetOptionsIntrusionVerticalWaterPressure.Linear, IntrusionVerticalWaterPressureType.Linear)] [TestCase(LocationWaternetOptionsIntrusionVerticalWaterPressure.SemiTimeDependent, IntrusionVerticalWaterPressureType.SemiTimeDependent)] [TestCase(LocationWaternetOptionsIntrusionVerticalWaterPressure.Standard, IntrusionVerticalWaterPressureType.Standard)] public void CanConvertToIntrusionVerticalWaterPressureType(LocationWaternetOptionsIntrusionVerticalWaterPressure inputIntrusionVerticalWaterPressureType, IntrusionVerticalWaterPressureType intrusionVerticalWaterPressureType) { Assert.AreEqual(intrusionVerticalWaterPressureType, ConversionHelper.ConvertToIntrusionVerticalWaterPressure(inputIntrusionVerticalWaterPressureType)); } [Test] [TestCase(IntrusionVerticalWaterPressureType.FullHydroStatic, LocationWaternetOptionsIntrusionVerticalWaterPressure.FullHydroStatic)] [TestCase(IntrusionVerticalWaterPressureType.HydroStatic, LocationWaternetOptionsIntrusionVerticalWaterPressure.HydroStatic)] [TestCase(IntrusionVerticalWaterPressureType.Linear, LocationWaternetOptionsIntrusionVerticalWaterPressure.Linear)] [TestCase(IntrusionVerticalWaterPressureType.SemiTimeDependent, LocationWaternetOptionsIntrusionVerticalWaterPressure.SemiTimeDependent)] [TestCase(IntrusionVerticalWaterPressureType.Standard, LocationWaternetOptionsIntrusionVerticalWaterPressure.Standard)] public void CanConvertToInputIntrusionVerticalWaterPressureType(IntrusionVerticalWaterPressureType intrusionVerticalWaterPressureType, LocationWaternetOptionsIntrusionVerticalWaterPressure inputIntrusionVerticalWaterPressureType) { Assert.AreEqual(inputIntrusionVerticalWaterPressureType, ConversionHelper.ConvertToInputIntrusionVerticalWaterPressure(intrusionVerticalWaterPressureType)); } [Test] [TestCase(ConversionHelper.CpNone, CharacteristicPointType.None)] [TestCase(ConversionHelper.CpSurfaceLevelOutside, CharacteristicPointType.SurfaceLevelOutside)] [TestCase(ConversionHelper.CpDikeToeAtRiver, CharacteristicPointType.DikeToeAtRiver)] [TestCase(ConversionHelper.CpShoulderTopOutside, CharacteristicPointType.ShoulderTopOutside)] [TestCase(ConversionHelper.CpShoulderBaseOutside, CharacteristicPointType.ShoulderBaseOutside)] [TestCase(ConversionHelper.CpDikeTopAtRiver, CharacteristicPointType.DikeTopAtRiver)] [TestCase(ConversionHelper.CpDikeLine, CharacteristicPointType.DikeLine)] [TestCase(ConversionHelper.CpTrafficLoadOutside, CharacteristicPointType.TrafficLoadOutside)] [TestCase(ConversionHelper.CpTrafficLoadInside, CharacteristicPointType.TrafficLoadInside)] [TestCase(ConversionHelper.CpDikeTopAtPolder, CharacteristicPointType.DikeTopAtPolder)] [TestCase(ConversionHelper.CpShoulderBaseInside, CharacteristicPointType.ShoulderBaseInside)] [TestCase(ConversionHelper.CpShoulderTopInside, CharacteristicPointType.ShoulderTopInside)] [TestCase(ConversionHelper.CpDikeToeAtPolder, CharacteristicPointType.DikeToeAtPolder)] [TestCase(ConversionHelper.CpDitchDikeSide, CharacteristicPointType.DitchDikeSide)] [TestCase(ConversionHelper.CpBottomDitchDikeSide, CharacteristicPointType.BottomDitchDikeSide)] [TestCase(ConversionHelper.CpBottomDitchPolderSide, CharacteristicPointType.BottomDitchPolderSide)] [TestCase(ConversionHelper.CpDitchPolderSide, CharacteristicPointType.DitchPolderSide)] [TestCase(ConversionHelper.CpSurfaceLevelInside, CharacteristicPointType.SurfaceLevelInside)] public void CanConvertToCharacteristicPointType(int inputPointType, CharacteristicPointType characteristicPointType) { Assert.AreEqual(characteristicPointType, ConversionHelper.ConvertToDamPointType(inputPointType)); } [Test] [TestCase(CharacteristicPointType.None, ConversionHelper.CpNone)] [TestCase(CharacteristicPointType.SurfaceLevelOutside, ConversionHelper.CpSurfaceLevelOutside)] [TestCase(CharacteristicPointType.DikeToeAtRiver, ConversionHelper.CpDikeToeAtRiver)] [TestCase(CharacteristicPointType.ShoulderTopOutside, ConversionHelper.CpShoulderTopOutside)] [TestCase(CharacteristicPointType.ShoulderBaseOutside, ConversionHelper.CpShoulderBaseOutside)] [TestCase(CharacteristicPointType.DikeTopAtRiver, ConversionHelper.CpDikeTopAtRiver)] [TestCase(CharacteristicPointType.DikeLine, ConversionHelper.CpDikeLine)] [TestCase(CharacteristicPointType.TrafficLoadOutside, ConversionHelper.CpTrafficLoadOutside)] [TestCase(CharacteristicPointType.TrafficLoadInside, ConversionHelper.CpTrafficLoadInside)] [TestCase(CharacteristicPointType.DikeTopAtPolder, ConversionHelper.CpDikeTopAtPolder)] [TestCase(CharacteristicPointType.ShoulderBaseInside, ConversionHelper.CpShoulderBaseInside)] [TestCase(CharacteristicPointType.ShoulderTopInside, ConversionHelper.CpShoulderTopInside)] [TestCase(CharacteristicPointType.DikeToeAtPolder, ConversionHelper.CpDikeToeAtPolder)] [TestCase(CharacteristicPointType.DitchDikeSide, ConversionHelper.CpDitchDikeSide)] [TestCase(CharacteristicPointType.BottomDitchDikeSide, ConversionHelper.CpBottomDitchDikeSide)] [TestCase(CharacteristicPointType.BottomDitchPolderSide, ConversionHelper.CpBottomDitchPolderSide)] [TestCase(CharacteristicPointType.DitchPolderSide, ConversionHelper.CpDitchPolderSide)] [TestCase(CharacteristicPointType.SurfaceLevelInside, ConversionHelper.CpSurfaceLevelInside)] public void CanConvertToInputPointType(CharacteristicPointType characteristicPointType, int inputPointType) { Assert.AreEqual(inputPointType, ConversionHelper.ConvertToInputPointType(characteristicPointType)); } } }