public void Convert_ValidShearStrengthModel_ReturnExpectedShearStrengthModel(MacroStabilityInwardsShearStrengthModel originalShearStrengthModel, ShearStrengthModel expectedShearStrengthModel) { // Setup var profile = new MacroStabilityInwardsSoilProfileUnderSurfaceLine(new[] { new MacroStabilityInwardsSoilLayer2D(RingTestFactory.CreateRandomRing()) { Data = { ShearStrengthModel = originalShearStrengthModel } } }, new MacroStabilityInwardsPreconsolidationStress[0]); // Call SoilProfile soilProfile = SoilProfileConverter.Convert(profile); // Assert Assert.AreEqual(expectedShearStrengthModel, soilProfile.Layers.First().ShearStrengthModel); }
public void Create_ValidShearStrengthModel_ExpectedShearStrengthModel( ShearStrengthModel shearStrengthModel, ShearStrengthModelType expectedShearStrengthAbovePhreaticLevelModel, ShearStrengthModelType expectedShearStrengthBelowPhreaticLevelModel) { // Setup var profile = new SoilProfile(new[] { new SoilLayer(new Point2D[0], new SoilLayer.ConstructionProperties { ShearStrengthModel = shearStrengthModel }, Enumerable.Empty <SoilLayer>()) }, Enumerable.Empty <PreconsolidationStress>()); // Call LayerWithSoil[] layersWithSoil = LayerWithSoilCreator.Create(profile, out IDictionary <SoilLayer, LayerWithSoil> _); // Assert Assert.AreEqual(expectedShearStrengthAbovePhreaticLevelModel, layersWithSoil[0].Soil.ShearStrengthAbovePhreaticLevelModel); Assert.AreEqual(expectedShearStrengthBelowPhreaticLevelModel, layersWithSoil[0].Soil.ShearStrengthBelowPhreaticLevelModel); }
/// <summary> /// Converts a <see cref="ShearStrengthModel"/> into a <see cref="ShearStrengthModelType"/> /// for the <see cref="Deltares.MacroStability.CSharpWrapper.Input.Soil.ShearStrengthBelowPhreaticLevelModel"/>. /// </summary> /// <param name="shearStrengthModel">The <see cref="ShearStrengthModel"/> to convert.</param> /// <returns>A <see cref="ShearStrengthModelType"/> based on <paramref name="shearStrengthModel"/>.</returns> /// <exception cref="InvalidEnumArgumentException">Thrown when <paramref name="shearStrengthModel"/> /// is an invalid value.</exception> /// <exception cref="NotSupportedException">Thrown when <paramref name="shearStrengthModel"/> /// is a valid value, but unsupported.</exception> private static ShearStrengthModelType ConvertShearStrengthBelowPhreaticLevelModel(ShearStrengthModel shearStrengthModel) { if (!Enum.IsDefined(typeof(ShearStrengthModel), shearStrengthModel)) { throw new InvalidEnumArgumentException(nameof(shearStrengthModel), (int)shearStrengthModel, typeof(ShearStrengthModel)); } switch (shearStrengthModel) { case ShearStrengthModel.SuCalculated: case ShearStrengthModel.CPhiOrSuCalculated: return(ShearStrengthModelType.Shansep); case ShearStrengthModel.CPhi: return(ShearStrengthModelType.MohrCoulomb); default: throw new NotSupportedException(); } }