// Copyright (C) Stichting Deltares 2024. All rights reserved.
//
// This file is part of the Dam Engine.
//
// The Dam Engine is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero 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 Deltares.DamEngine.Data.General;
using Deltares.DamEngine.Data.General.Sensors;
using Deltares.DamEngine.Data.General.TimeSeries;
using Deltares.DamEngine.Data.Geotechnics;
using Deltares.DamEngine.Data.Standard.Calculation;
using Deltares.DamEngine.Data.Standard.Logging;
using Deltares.DamEngine.Io.XmlInput;
using Deltares.DamEngine.Io.XmlOutput;
using NUnit.Framework;
namespace Deltares.DamEngine.Interface.Tests;
[TestFixture]
public class ConversionHelperTests
{
[Test]
[TestCase(InputDamProjectType.Design, DamProjectType.Design)]
[TestCase(InputDamProjectType.Operational, DamProjectType.Operational)]
public void CanConvertToDamProjectType(InputDamProjectType inputDamProjectType, DamProjectType damProjectType)
{
Assert.That(ConversionHelper.ConvertToDamProjectType(inputDamProjectType), Is.EqualTo(damProjectType));
}
[Test]
[TestCase(DamProjectType.Design, InputDamProjectType.Design)]
[TestCase(DamProjectType.Operational, InputDamProjectType.Operational)]
public void CanConvertToInputDamProjectType(DamProjectType damProjectType, InputDamProjectType inputDamProjectType)
{
Assert.That(ConversionHelper.ConvertToInputDamProjectType(damProjectType), Is.EqualTo(inputDamProjectType));
}
[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.That(ConversionHelper.ConvertToInputPhreaticLineCreationMethod(plLineCreationMethod), Is.EqualTo(inputPhreaticLineCreationMethod));
}
[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.That(ConversionHelper.ConvertToPhreaticLineCreationMethod(inputPhreaticLineCreationMethod), Is.EqualTo(plLineCreationMethod));
}
[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.That(ConversionHelper.ConvertToIntrusionVerticalWaterPressure(inputIntrusionVerticalWaterPressureType), Is.EqualTo(intrusionVerticalWaterPressureType));
}
[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.That(ConversionHelper.ConvertToInputIntrusionVerticalWaterPressure(intrusionVerticalWaterPressureType), Is.EqualTo(inputIntrusionVerticalWaterPressureType));
}
[Test]
[TestCase(0, CalculationResult.NoRun)]
[TestCase(1, CalculationResult.Succeeded)]
[TestCase(2, CalculationResult.NoInput)]
[TestCase(3, CalculationResult.NoLicense)]
[TestCase(4, CalculationResult.UserAbort)]
[TestCase(5, CalculationResult.InvalidInputStructure)]
[TestCase(6, CalculationResult.InvalidInputData)]
[TestCase(7, CalculationResult.RunFailed)]
[TestCase(8, CalculationResult.UnexpectedError)]
public void CanConvertToOutputCalculationResult(int result, CalculationResult calculationResult)
{
Assert.That(ConversionHelper.ConvertToOutputCalculationResult(calculationResult), Is.EqualTo(result));
}
[Test]
[TestCase(CalculationResult.NoRun, 0)]
[TestCase(CalculationResult.Succeeded, 1)]
[TestCase(CalculationResult.NoInput, 2)]
[TestCase(CalculationResult.NoLicense, 3)]
[TestCase(CalculationResult.UserAbort, 4)]
[TestCase(CalculationResult.InvalidInputStructure, 5)]
[TestCase(CalculationResult.InvalidInputData, 6)]
[TestCase(CalculationResult.RunFailed, 7)]
[TestCase(CalculationResult.UnexpectedError, 8)]
public void CanConvertToCalculationResult(CalculationResult result, int calculationResult)
{
Assert.That(ConversionHelper.ConvertToCalculationResult(calculationResult), Is.EqualTo(result));
}
[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.That(ConversionHelper.ConvertToDamPointType(inputPointType), Is.EqualTo(characteristicPointType));
}
[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.That(ConversionHelper.ConvertToInputPointType(characteristicPointType), Is.EqualTo(inputPointType));
}
[Test]
[TestCase(0, WaterpressureInterpolationModel.Automatic)]
[TestCase(1, WaterpressureInterpolationModel.Hydrostatic)]
public void CanConvertToWaterpressureInterpolationModel(int inputInterpolationModel, WaterpressureInterpolationModel interpolationModel)
{
Assert.That(ConversionHelper.ConvertToWaterpressureInterpolationModel(inputInterpolationModel), Is.EqualTo(interpolationModel));
}
[Test]
[TestCase(SoilProfileType.ProfileType1D, SegmentSoilGeometryProbabilitySoilProfileType.ProfileType1D)]
[TestCase(SoilProfileType.ProfileType2D, SegmentSoilGeometryProbabilitySoilProfileType.ProfileType2D)]
public void CanConvertToInputSoilGeometryType(SoilProfileType soilProfileType, SegmentSoilGeometryProbabilitySoilProfileType inputSoilGeometryType)
{
Assert.That(ConversionHelper.ConvertToInputSoilGeometryType(soilProfileType), Is.EqualTo(inputSoilGeometryType));
}
[Test]
[TestCase(SegmentSoilGeometryProbabilitySoilProfileType.ProfileType1D, SoilProfileType.ProfileType1D)]
[TestCase(SegmentSoilGeometryProbabilitySoilProfileType.ProfileType2D, SoilProfileType.ProfileType2D)]
public void CanConvertToSoilGeometryType(SegmentSoilGeometryProbabilitySoilProfileType inputSoilGeometryType, SoilProfileType soilProfileType)
{
Assert.That(ConversionHelper.ConvertToSoilGeometryType(inputSoilGeometryType), Is.EqualTo(soilProfileType));
}
[Test]
[TestCase(FailureMechanismSystemType.StabilityInside, InputFailureMechanismSystemType.StabilityInside)]
[TestCase(FailureMechanismSystemType.StabilityOutside, InputFailureMechanismSystemType.StabilityOutside)]
[TestCase(FailureMechanismSystemType.Piping, InputFailureMechanismSystemType.Piping)]
public void CanConvertToInputFailureMechanismSystemType(FailureMechanismSystemType failureMechanismSystemType, InputFailureMechanismSystemType inputFailureMechanismSystemType)
{
Assert.That(ConversionHelper.ConvertToInputFailureMechanismSystemType(failureMechanismSystemType), Is.EqualTo(inputFailureMechanismSystemType));
}
[Test]
[TestCase(InputFailureMechanismSystemType.StabilityInside, FailureMechanismSystemType.StabilityInside)]
[TestCase(InputFailureMechanismSystemType.StabilityOutside, FailureMechanismSystemType.StabilityOutside)]
[TestCase(InputFailureMechanismSystemType.Piping, FailureMechanismSystemType.Piping)]
public void CanConvertToFailureMechanismSystemType(InputFailureMechanismSystemType inputFailureMechanismSystemType, FailureMechanismSystemType failureMechanismSystemType)
{
Assert.That(ConversionHelper.ConvertToFailureMechanismSystemType(inputFailureMechanismSystemType), Is.EqualTo(failureMechanismSystemType));
}
[Test]
[TestCase(SegmentFailureMechanismType.All, SegmentSoilGeometryProbabilitySegmentFailureMechanismType.All)]
[TestCase(SegmentFailureMechanismType.Stability, SegmentSoilGeometryProbabilitySegmentFailureMechanismType.Stability)]
[TestCase(SegmentFailureMechanismType.Piping, SegmentSoilGeometryProbabilitySegmentFailureMechanismType.Piping)]
public void CanConvertToInputFailureMechanismSystemType(SegmentFailureMechanismType failureMechanismSystemType, SegmentSoilGeometryProbabilitySegmentFailureMechanismType inputFailureMechanismSystemType)
{
Assert.That(ConversionHelper.ConvertToInputSegmentFailureMechanismSystemType(failureMechanismSystemType), Is.EqualTo(inputFailureMechanismSystemType));
}
[Test]
[TestCase(SegmentSoilGeometryProbabilitySegmentFailureMechanismType.All, SegmentFailureMechanismType.All)]
[TestCase(SegmentSoilGeometryProbabilitySegmentFailureMechanismType.Stability, SegmentFailureMechanismType.Stability)]
[TestCase(SegmentSoilGeometryProbabilitySegmentFailureMechanismType.Piping, SegmentFailureMechanismType.Piping)]
public void CanConvertToFailureMechanismSystemType(SegmentSoilGeometryProbabilitySegmentFailureMechanismType inputFailureMechanismSystemType, SegmentFailureMechanismType failureMechanismSystemType)
{
Assert.That(ConversionHelper.ConvertToSegmentFailureMechanismSystemType(inputFailureMechanismSystemType), Is.EqualTo(failureMechanismSystemType));
}
[Test]
[TestCase(MStabModelType.Bishop, InputStabilityModelType.Bishop)]
[TestCase(MStabModelType.UpliftVan, InputStabilityModelType.UpliftVan)]
[TestCase(MStabModelType.BishopUpliftVan, InputStabilityModelType.BishopUpliftVan)]
[TestCase(MStabModelType.UpliftVan, InputStabilityModelType.UpliftVan)]
public void CanConvertToInputStabilityModelType(MStabModelType mStabModelType, InputStabilityModelType inputStabilityModelType)
{
Assert.That(ConversionHelper.ConvertToInputStabilityModelType(mStabModelType), Is.EqualTo(inputStabilityModelType));
}
[Test]
[TestCase(InputStabilityModelType.Bishop, MStabModelType.Bishop)]
[TestCase(InputStabilityModelType.UpliftVan, MStabModelType.UpliftVan)]
[TestCase(InputStabilityModelType.BishopUpliftVan, MStabModelType.BishopUpliftVan)]
[TestCase(InputStabilityModelType.UpliftVan, MStabModelType.UpliftVan)]
public void CanConvertToMStabModelType(InputStabilityModelType inputStabilityModelType, MStabModelType mStabModelType)
{
Assert.That(ConversionHelper.ConvertToStabilityModelType(inputStabilityModelType), Is.EqualTo(mStabModelType));
}
[Test]
[TestCase(AnalysisType.AdaptGeometry, InputAnalysisType.AdaptGeometry)]
[TestCase(AnalysisType.NoAdaption, InputAnalysisType.NoAdaption)]
public void CanConvertToInputAnalysisType(AnalysisType analysisType, InputAnalysisType inputAnalysisType)
{
Assert.That(ConversionHelper.ConvertToInputAnalysisType(analysisType), Is.EqualTo(inputAnalysisType));
}
[Test]
[TestCase(InputAnalysisType.AdaptGeometry, AnalysisType.AdaptGeometry)]
[TestCase(InputAnalysisType.NoAdaption, AnalysisType.NoAdaption)]
public void CanConvertToAnalysisType(InputAnalysisType inputAnalysisType, AnalysisType analysisType)
{
Assert.That(ConversionHelper.ConvertToAnalysisType(inputAnalysisType), Is.EqualTo(analysisType));
}
[Test]
[TestCase(MStabZonesType.NoZones, LocationStabilityOptionsZoneType.NoZones)]
[TestCase(MStabZonesType.ForbiddenZone, LocationStabilityOptionsZoneType.ForbiddenZones)]
public void CanConvertToInputZoneType(MStabZonesType zoneType, LocationStabilityOptionsZoneType inputZoneType)
{
Assert.That(ConversionHelper.ConvertToInputZoneType(zoneType), Is.EqualTo(inputZoneType));
}
[Test]
[TestCase(LocationStabilityOptionsZoneType.NoZones, MStabZonesType.NoZones)]
[TestCase(LocationStabilityOptionsZoneType.ForbiddenZones, MStabZonesType.ForbiddenZone)]
public void CanConvertToZoneType(LocationStabilityOptionsZoneType inputZoneType, MStabZonesType zoneType)
{
Assert.That(ConversionHelper.ConvertToZoneType(inputZoneType), Is.EqualTo(zoneType));
}
[Test]
[TestCase(MStabSearchMethod.Grid, StabilityParametersSearchMethod.CalculationGrid)]
[TestCase(MStabSearchMethod.BeeSwarm, StabilityParametersSearchMethod.BeeSwarm)]
public void CanConvertToInputSearchMethod(MStabSearchMethod searchMethod, StabilityParametersSearchMethod inputSearchMethod)
{
Assert.That(ConversionHelper.ConvertToInputSearchMethod(searchMethod), Is.EqualTo(inputSearchMethod));
}
[Test]
[TestCase(StabilityParametersSearchMethod.CalculationGrid, MStabSearchMethod.Grid)]
[TestCase(StabilityParametersSearchMethod.BeeSwarm, MStabSearchMethod.BeeSwarm)]
public void CanConvertToSearchMethod(StabilityParametersSearchMethod inputSearchMethod, MStabSearchMethod searchMethod)
{
Assert.That(ConversionHelper.ConvertToSearchMethod(inputSearchMethod), Is.EqualTo(searchMethod));
}
[Test]
[TestCase(LogMessageType.Error, MessageMessageType.Error)]
[TestCase(LogMessageType.Debug, MessageMessageType.Info)]
[TestCase(LogMessageType.FatalError, MessageMessageType.Error)]
[TestCase(LogMessageType.Info, MessageMessageType.Info)]
[TestCase(LogMessageType.Trace, MessageMessageType.Info)]
[TestCase(LogMessageType.Warning, MessageMessageType.Warning)]
public void CanConvertToInputMessageType(LogMessageType logMessageType, MessageMessageType messageType)
{
Assert.That(ConversionHelper.ConvertToInputMessageType(logMessageType), Is.EqualTo(messageType));
}
[Test]
[TestCase(MessageMessageType.Error, LogMessageType.Error)]
[TestCase(MessageMessageType.Info, LogMessageType.Info)]
[TestCase(MessageMessageType.Warning, LogMessageType.Warning)]
public void CanConvertToMessageType(MessageMessageType messageType, LogMessageType logMessageType)
{
Assert.That(ConversionHelper.ConvertToLogMessageType(messageType), Is.EqualTo(logMessageType));
}
[Test]
[TestCase(ShearStrengthModel.CPhi, SoilShearStrengthModel.CPhi)]
[TestCase(ShearStrengthModel.SuCalculated, SoilShearStrengthModel.SuCalculated)]
[TestCase(ShearStrengthModel.SigmaTauCurve, SoilShearStrengthModel.SigmaTauCurve)]
public void CanConvertToSoilShearStrengthModel(ShearStrengthModel shearStrengthModel, SoilShearStrengthModel soilShearStrengthModel)
{
Assert.That(ConversionHelper.ConvertToSoilShearStrengthModel(shearStrengthModel), Is.EqualTo(soilShearStrengthModel));
}
[Test]
[TestCase(GridSizeDetermination.Automatic, StabilityParametersBishopSearchAreaDetermination.Automatic)]
[TestCase(GridSizeDetermination.Specified, StabilityParametersBishopSearchAreaDetermination.Specified)]
public void CanConvertToInputBishopSearchAreaDetermination(GridSizeDetermination gridDetermination, StabilityParametersBishopSearchAreaDetermination inputGridDetermination)
{
Assert.That(ConversionHelper.ConvertToInputBishopSearchAreaDetermination(gridDetermination), Is.EqualTo(inputGridDetermination));
}
[Test]
[TestCase(StabilityParametersBishopSearchAreaDetermination.Automatic, GridSizeDetermination.Automatic)]
[TestCase(StabilityParametersBishopSearchAreaDetermination.Specified, GridSizeDetermination.Specified)]
public void CanConvertToBishopSearchAreaDetermination(StabilityParametersBishopSearchAreaDetermination inputGridDetermination, GridSizeDetermination gridDetermination)
{
Assert.That(ConversionHelper.ConvertToBishopSearchAreaDetermination(inputGridDetermination), Is.EqualTo(gridDetermination));
}
[Test]
[TestCase(GridSizeDetermination.Automatic, StabilityParametersUpliftVanGridDetermination.Automatic)]
[TestCase(GridSizeDetermination.Specified, StabilityParametersUpliftVanGridDetermination.Specified)]
public void CanConvertToInputUpliftVanGridSizeDetermination(GridSizeDetermination gridDetermination, StabilityParametersUpliftVanGridDetermination inputGridDetermination)
{
Assert.That(ConversionHelper.ConvertToInputUpliftVanGridDetermination(gridDetermination), Is.EqualTo(inputGridDetermination));
}
[Test]
[TestCase(StabilityParametersUpliftVanGridDetermination.Automatic, GridSizeDetermination.Automatic)]
[TestCase(StabilityParametersUpliftVanGridDetermination.Specified, GridSizeDetermination.Specified)]
public void CanConvertToUpliftVanGridSizeDetermination(StabilityParametersUpliftVanGridDetermination inputGridDetermination, GridSizeDetermination gridDetermination)
{
Assert.That(ConversionHelper.ConvertToUpliftVanGridDetermination(inputGridDetermination), Is.EqualTo(gridDetermination));
}
[Test]
[TestCase(SoilShearStrengthModel.CPhi, ShearStrengthModel.CPhi)]
[TestCase(SoilShearStrengthModel.SuCalculated, ShearStrengthModel.SuCalculated)]
[TestCase(SoilShearStrengthModel.SigmaTauCurve, ShearStrengthModel.SigmaTauCurve)]
public void CanConvertToShearStrengthModel(SoilShearStrengthModel soilShearStrengthModel, ShearStrengthModel shearStrengthModel)
{
Assert.That(ConversionHelper.ConvertToShearStrengthModel(soilShearStrengthModel), Is.EqualTo(shearStrengthModel));
}
[Test]
[TestCase(TangentLinesDefinition.OnBoundaryLines, StabilityParametersUpliftVanTangentLinesDefinition.OnBoundaryLines)]
[TestCase(TangentLinesDefinition.Specified, StabilityParametersUpliftVanTangentLinesDefinition.Specified)]
[TestCase(TangentLinesDefinition.Automatic, StabilityParametersUpliftVanTangentLinesDefinition.Automatic)]
public void CanConvertToInputTangentLinesDefinition(TangentLinesDefinition tangentLineType, StabilityParametersUpliftVanTangentLinesDefinition inputTangentLineType)
{
Assert.That(ConversionHelper.ConvertToInputTangentLinesDefinition(tangentLineType), Is.EqualTo(inputTangentLineType));
}
[Test]
[TestCase(StabilityParametersUpliftVanTangentLinesDefinition.OnBoundaryLines, TangentLinesDefinition.OnBoundaryLines)]
[TestCase(StabilityParametersUpliftVanTangentLinesDefinition.Specified, TangentLinesDefinition.Specified)]
[TestCase(StabilityParametersUpliftVanTangentLinesDefinition.Automatic, TangentLinesDefinition.Automatic)]
public void CanConvertToTangentLinesDefinition(StabilityParametersUpliftVanTangentLinesDefinition inputTangentLineType, TangentLinesDefinition tangentLineType)
{
Assert.That(ConversionHelper.ConvertToTangentLinesDefinition(inputTangentLineType), Is.EqualTo(tangentLineType));
}
[Test]
[TestCase(LocationDesignOptionsStabilityDesignMethod.SlopeAdaptionBeforeShoulderAdaption, StabilityDesignMethod.SlopeAdaptionBeforeShoulderAdaption)]
[TestCase(LocationDesignOptionsStabilityDesignMethod.OptimizedSlopeAndShoulderAdaption, StabilityDesignMethod.OptimizedSlopeAndShoulderAdaption)]
public void CanConvertToInputStabilityDesignMethod(LocationDesignOptionsStabilityDesignMethod inputStabilityDesignMethod, StabilityDesignMethod stabilityDesignMethod)
{
Assert.That(ConversionHelper.ConvertToDamStabilityDesignMethod(inputStabilityDesignMethod), Is.EqualTo(stabilityDesignMethod));
}
[Test]
[TestCase(StabilityDesignMethod.SlopeAdaptionBeforeShoulderAdaption, LocationDesignOptionsStabilityDesignMethod.SlopeAdaptionBeforeShoulderAdaption)]
[TestCase(StabilityDesignMethod.OptimizedSlopeAndShoulderAdaption, LocationDesignOptionsStabilityDesignMethod.OptimizedSlopeAndShoulderAdaption)]
public void CanConvertToDamStabilityDesignMethod(StabilityDesignMethod stabilityDesignMethod, LocationDesignOptionsStabilityDesignMethod inputStabilityDesignMethod)
{
Assert.That(ConversionHelper.ConvertToInputStabilityDesignMethod(stabilityDesignMethod), Is.EqualTo(inputStabilityDesignMethod));
}
[Test]
[TestCase(PipingModelType.Bligh, InputPipingModelType.Bligh)]
[TestCase(PipingModelType.Wti2017, InputPipingModelType.WtiSellmeijerRevised)]
public void CanConvertToInputPipingModelType(PipingModelType pipingModelType, InputPipingModelType inputPipingModelType)
{
Assert.That(ConversionHelper.ConvertToInputPipingModelType(pipingModelType), Is.EqualTo(inputPipingModelType));
}
[Test]
[TestCase(InputPipingModelType.Bligh, PipingModelType.Bligh)]
[TestCase(InputPipingModelType.WtiSellmeijerRevised, PipingModelType.Wti2017)]
public void CanConvertToPipingModelType(InputPipingModelType inputPipingModelType, PipingModelType pipingModelType)
{
Assert.That(ConversionHelper.ConvertToPipingModelType(inputPipingModelType), Is.EqualTo(pipingModelType));
}
[Test]
[TestCase(DesignResultStabilityDesignResultsStabilityModelType.Bishop, MStabModelType.Bishop)]
[TestCase(DesignResultStabilityDesignResultsStabilityModelType.UpliftVan, MStabModelType.UpliftVan)]
[TestCase(DesignResultStabilityDesignResultsStabilityModelType.BishopUpliftVan, MStabModelType.BishopUpliftVan)]
[TestCase(DesignResultStabilityDesignResultsStabilityModelType.UpliftVan, MStabModelType.UpliftVan)]
public void CanConvertToOutputStabilityModelType(DesignResultStabilityDesignResultsStabilityModelType outputStabilityModelType,
MStabModelType stabilityModelType)
{
Assert.That(ConversionHelper.ConvertToOutputStabilityModelType(stabilityModelType), Is.EqualTo(outputStabilityModelType));
}
[Test]
[TestCase(MStabModelType.Bishop, DesignResultStabilityDesignResultsStabilityModelType.Bishop)]
[TestCase(MStabModelType.UpliftVan, DesignResultStabilityDesignResultsStabilityModelType.UpliftVan)]
[TestCase(MStabModelType.BishopUpliftVan, DesignResultStabilityDesignResultsStabilityModelType.BishopUpliftVan)]
[TestCase(MStabModelType.UpliftVan, DesignResultStabilityDesignResultsStabilityModelType.UpliftVan)]
public void CanConvertToStabilityModelType(MStabModelType stabilityModelType,
DesignResultStabilityDesignResultsStabilityModelType outputStabilityModelType)
{
Assert.That(ConversionHelper.ConvertToStabilityModelType(outputStabilityModelType), Is.EqualTo(stabilityModelType));
}
[Test]
[TestCase(ConversionHelper.TimeStepUnitSecond, TimeStepUnit.Second)]
[TestCase(ConversionHelper.TimeStepUnitMinute, TimeStepUnit.Minute)]
[TestCase(ConversionHelper.TimeStepUnitHour, TimeStepUnit.Hour)]
[TestCase(ConversionHelper.TimeStepUnitDay, TimeStepUnit.Day)]
[TestCase(ConversionHelper.TimeStepUnitMonth, TimeStepUnit.Month)]
[TestCase(ConversionHelper.TimeStepUnitWeek, TimeStepUnit.Week)]
[TestCase(ConversionHelper.TimeStepUnitYear, TimeStepUnit.Year)]
[TestCase(ConversionHelper.TimeStepUnitNonequidistant, TimeStepUnit.Nonequidistant)]
public void CanConvertToTimeStepUnit(uint inputTimeStepUnit, TimeStepUnit timeStepUnit)
{
Assert.That(ConversionHelper.ConvertToTimeStepUnit(inputTimeStepUnit), Is.EqualTo(timeStepUnit));
}
[Test]
[TestCase(TimeStepUnit.Second, ConversionHelper.TimeStepUnitSecond)]
[TestCase(TimeStepUnit.Minute, ConversionHelper.TimeStepUnitMinute)]
[TestCase(TimeStepUnit.Hour, ConversionHelper.TimeStepUnitHour)]
[TestCase(TimeStepUnit.Day, ConversionHelper.TimeStepUnitDay)]
[TestCase(TimeStepUnit.Month, ConversionHelper.TimeStepUnitMonth)]
[TestCase(TimeStepUnit.Week, ConversionHelper.TimeStepUnitWeek)]
[TestCase(TimeStepUnit.Year, ConversionHelper.TimeStepUnitYear)]
[TestCase(TimeStepUnit.Nonequidistant, ConversionHelper.TimeStepUnitNonequidistant)]
public void CanConvertToInputTimeStepUnit(TimeStepUnit timeStepUnit, uint inputTimeStepUnit)
{
Assert.That(ConversionHelper.ConvertToInputTimeStepUnit(timeStepUnit), Is.EqualTo(inputTimeStepUnit));
}
[TestCase(ConversionHelper.PlLineTypePl1, PlLineType.Pl1)]
[TestCase(ConversionHelper.PlLineTypePl2, PlLineType.Pl2)]
[TestCase(ConversionHelper.PlLineTypePl3, PlLineType.Pl3)]
[TestCase(ConversionHelper.PlLineTypePl4, PlLineType.Pl4)]
public void CanConvertToPlLineType(uint inputPlLineType, PlLineType plLineType)
{
Assert.That(ConversionHelper.ConvertToPlLineType(inputPlLineType), Is.EqualTo(plLineType));
}
[TestCase(PlLineType.Pl1, ConversionHelper.PlLineTypePl1)]
[TestCase(PlLineType.Pl2, ConversionHelper.PlLineTypePl2)]
[TestCase(PlLineType.Pl3, ConversionHelper.PlLineTypePl3)]
[TestCase(PlLineType.Pl4, ConversionHelper.PlLineTypePl4)]
public void CanConvertToInputPlLineType(PlLineType plLineType, uint inputPlLineType)
{
Assert.That(ConversionHelper.ConvertToInputPlLineType(plLineType), Is.EqualTo(inputPlLineType));
}
[TestCase(ConversionHelper.SensorTypePiezometricHead, SensorType.PiezometricHead)]
[TestCase(ConversionHelper.SensorTypeWaterLevel, SensorType.WaterLevel)]
[TestCase(ConversionHelper.SensorTypePolderLevel, SensorType.PolderLevel)]
public void CanConvertToSensorType(uint inputSensorType, SensorType sensorType)
{
Assert.That(ConversionHelper.ConvertToSensorType(inputSensorType), Is.EqualTo(sensorType));
}
[TestCase(SensorType.PiezometricHead, ConversionHelper.SensorTypePiezometricHead)]
[TestCase(SensorType.WaterLevel, ConversionHelper.SensorTypeWaterLevel)]
[TestCase(SensorType.PolderLevel, ConversionHelper.SensorTypePolderLevel)]
public void CanConvertToInputSensorType(SensorType sensorType, uint inputSensorType)
{
Assert.That(ConversionHelper.ConvertToInputSensorType(sensorType), Is.EqualTo(inputSensorType));
}
[TestCase(ConversionHelper.DataSourceTypeSensorsIgnore, DataSourceTypeSensors.Ignore)]
[TestCase(ConversionHelper.DataSourceTypeSensorsLocationData, DataSourceTypeSensors.LocationData)]
[TestCase(ConversionHelper.DataSourceTypeSensorsSensor, DataSourceTypeSensors.Sensor)]
public void CanConvertToSensorType(uint inputdataSourceTypeSensors, DataSourceTypeSensors dataSourceTypeSensors)
{
Assert.That(ConversionHelper.ConvertToDataSourceTypeSensors(inputdataSourceTypeSensors), Is.EqualTo(dataSourceTypeSensors));
}
[TestCase(DataSourceTypeSensors.Ignore, ConversionHelper.DataSourceTypeSensorsIgnore)]
[TestCase(DataSourceTypeSensors.LocationData, ConversionHelper.DataSourceTypeSensorsLocationData)]
[TestCase(DataSourceTypeSensors.Sensor, ConversionHelper.DataSourceTypeSensorsSensor)]
public void CanConvertToInputSensorType(DataSourceTypeSensors dataSourceTypeSensors, uint inputdataSourceTypeSensors)
{
Assert.That(ConversionHelper.ConvertToInputDataSourceTypeSensors(dataSourceTypeSensors), Is.EqualTo(inputdataSourceTypeSensors));
}
[TestCase(FailureMechanismSystemType.StabilityInside, OperationalStaticDataFailureMechanismSystemType.StabilityInside)]
[TestCase(FailureMechanismSystemType.StabilityOutside, OperationalStaticDataFailureMechanismSystemType.StabilityOutside)]
public void CanConvertToOutputOperationalFailureMechanismSystemType(FailureMechanismSystemType failureMechanismSystemType, OperationalStaticDataFailureMechanismSystemType expectedFailureMechanismSystemType)
{
Assert.That(ConversionHelper.ConvertToOutputOperationalFailureMechanismSystemType(failureMechanismSystemType), Is.EqualTo(expectedFailureMechanismSystemType));
}
[Test]
public void CanNotConvertPipingToOutputOperationalFailureMechanismSystemType()
{
Assert.Throws(() => ConversionHelper.ConvertToOutputOperationalFailureMechanismSystemType(FailureMechanismSystemType.Piping));
}
[TestCase(MStabModelType.Bishop, OperationalStaticDataStabilityModel.Bishop)]
[TestCase(MStabModelType.UpliftVan, OperationalStaticDataStabilityModel.UpliftVan)]
[TestCase(MStabModelType.BishopUpliftVan, OperationalStaticDataStabilityModel.BishopUpliftVan)]
public void CanConvertToOutputOperationalStabilityModel(MStabModelType stabilityModelType, OperationalStaticDataStabilityModel expectedStabilityModel)
{
Assert.That(ConversionHelper.ConvertToOutputOperationalStabilityModel(stabilityModelType), Is.EqualTo(expectedStabilityModel));
}
}