Exemple #1
0
        public void Convert_SoilProfileNull_ThrowsArgumentNullException()
        {
            // Call
            TestDelegate call = () => SoilProfileConverter.Convert(null);

            // Assert
            var exception = Assert.Throws <ArgumentNullException>(call);

            Assert.AreEqual("soilProfile", exception.ParamName);
        }
Exemple #2
0
        public void Convert_WithSoilProfile_ReturnSoilProfile()
        {
            // Setup
            var random = new Random(22);

            MacroStabilityInwardsSoilLayer2D soilLayer1 = CreateRandomSoilLayer(22, new[]
            {
                CreateRandomSoilLayer(23, Enumerable.Empty <MacroStabilityInwardsSoilLayer2D>()),
                CreateRandomSoilLayer(24, Enumerable.Empty <MacroStabilityInwardsSoilLayer2D>())
            });

            MacroStabilityInwardsSoilLayer2D soilLayer2 = CreateRandomSoilLayer(25, new[]
            {
                CreateRandomSoilLayer(26, new[]
                {
                    CreateRandomSoilLayer(27, Enumerable.Empty <MacroStabilityInwardsSoilLayer2D>())
                })
            });

            var preconsolidationStress = new MacroStabilityInwardsPreconsolidationStress(new Point2D(random.NextDouble(), random.NextDouble()),
                                                                                         new VariationCoefficientLogNormalDistribution
            {
                Mean = (RoundedDouble)0.05,
                CoefficientOfVariation = random.NextRoundedDouble()
            });

            var profile = new MacroStabilityInwardsSoilProfileUnderSurfaceLine(
                new[]
            {
                soilLayer1,
                soilLayer2
            },
                new[]
            {
                preconsolidationStress
            });

            // Call
            SoilProfile soilProfile = SoilProfileConverter.Convert(profile);

            // Assert
            CalculatorInputAssert.AssertSoilProfile(profile, soilProfile);
        }
Exemple #3
0
        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);
        }
Exemple #4
0
        public void Convert_SoilProfileWithSoilLayerWithEmptyName_ReturnSoilProfile()
        {
            // Setup
            MacroStabilityInwardsSoilLayer2D soilLayer = CreateRandomSoilLayer(22, Enumerable.Empty <MacroStabilityInwardsSoilLayer2D>());

            soilLayer.Data.MaterialName = string.Empty;

            var profile = new MacroStabilityInwardsSoilProfileUnderSurfaceLine(
                new[]
            {
                soilLayer
            },
                new IMacroStabilityInwardsPreconsolidationStress[0]);

            // Call
            SoilProfile soilProfile = SoilProfileConverter.Convert(profile);

            // Assert
            Assert.AreEqual(1, soilProfile.Layers.Count());
            Assert.AreEqual("Onbekend", soilProfile.Layers.First().MaterialName);
        }
Exemple #5
0
 private static WaternetCalculatorInput.ConstructionProperties CreateCalculatorInputConstructionProperties(IMacroStabilityInwardsWaternetInput input, IGeneralMacroStabilityInwardsWaternetInput generalInput)
 {
     return(new WaternetCalculatorInput.ConstructionProperties
     {
         SurfaceLine = input.SurfaceLine,
         SoilProfile = SoilProfileConverter.Convert(input.SoilProfileUnderSurfaceLine),
         DrainageConstruction = DrainageConstructionConverter.Convert(input),
         DikeSoilScenario = input.DikeSoilScenario,
         WaterLevelRiverAverage = input.WaterLevelRiverAverage,
         MinimumLevelPhreaticLineAtDikeTopRiver = input.MinimumLevelPhreaticLineAtDikeTopRiver,
         MinimumLevelPhreaticLineAtDikeTopPolder = input.MinimumLevelPhreaticLineAtDikeTopPolder,
         LeakageLengthOutwardsPhreaticLine3 = input.LeakageLengthOutwardsPhreaticLine3,
         LeakageLengthInwardsPhreaticLine3 = input.LeakageLengthInwardsPhreaticLine3,
         LeakageLengthOutwardsPhreaticLine4 = input.LeakageLengthOutwardsPhreaticLine4,
         LeakageLengthInwardsPhreaticLine4 = input.LeakageLengthInwardsPhreaticLine4,
         PiezometricHeadPhreaticLine2Outwards = input.PiezometricHeadPhreaticLine2Outwards,
         PiezometricHeadPhreaticLine2Inwards = input.PiezometricHeadPhreaticLine2Inwards,
         AdjustPhreaticLine3And4ForUplift = input.AdjustPhreaticLine3And4ForUplift,
         WaterVolumetricWeight = generalInput.WaterVolumetricWeight
     });
 }
Exemple #6
0
        public void Convert_InvalidShearStrengthModel_ThrowInvalidEnumArgumentException()
        {
            // Setup
            var profile = new MacroStabilityInwardsSoilProfileUnderSurfaceLine(new[]
            {
                new MacroStabilityInwardsSoilLayer2D(RingTestFactory.CreateRandomRing())
                {
                    Data =
                    {
                        ShearStrengthModel = (MacroStabilityInwardsShearStrengthModel)99
                    }
                }
            }, new MacroStabilityInwardsPreconsolidationStress[0]);

            // Call
            TestDelegate test = () => SoilProfileConverter.Convert(profile);

            // Assert
            const string message = "The value of argument 'shearStrengthModel' (99) is invalid for Enum type 'MacroStabilityInwardsShearStrengthModel'.";

            TestHelper.AssertThrowsArgumentExceptionAndTestMessage <InvalidEnumArgumentException>(test, message);
        }
Exemple #7
0
        private static UpliftVanCalculatorInput CreateInputFromData(MacroStabilityInwardsInput inputParameters, GeneralMacroStabilityInwardsInput generalInput, RoundedDouble normativeAssessmentLevel)
        {
            RoundedDouble effectiveAssessmentLevel = GetEffectiveAssessmentLevel(inputParameters, normativeAssessmentLevel);

            return(new UpliftVanCalculatorInput(
                       new UpliftVanCalculatorInput.ConstructionProperties
            {
                AssessmentLevel = effectiveAssessmentLevel,
                SurfaceLine = inputParameters.SurfaceLine,
                SoilProfile = SoilProfileConverter.Convert(inputParameters.SoilProfileUnderSurfaceLine),
                DrainageConstruction = DrainageConstructionConverter.Convert(inputParameters),
                PhreaticLineOffsetsExtreme = PhreaticLineOffsetsConverter.Convert(inputParameters.LocationInputExtreme),
                PhreaticLineOffsetsDaily = PhreaticLineOffsetsConverter.Convert(inputParameters.LocationInputDaily),
                SlipPlane = UpliftVanSlipPlaneConverter.Convert(inputParameters),
                SlipPlaneConstraints = UpliftVanSlipPlaneConstraintsConverter.Convert(inputParameters),
                DikeSoilScenario = inputParameters.DikeSoilScenario,
                WaterLevelRiverAverage = inputParameters.WaterLevelRiverAverage,
                WaterLevelPolderExtreme = inputParameters.LocationInputExtreme.WaterLevelPolder,
                WaterLevelPolderDaily = inputParameters.LocationInputDaily.WaterLevelPolder,
                MinimumLevelPhreaticLineAtDikeTopRiver = inputParameters.MinimumLevelPhreaticLineAtDikeTopRiver,
                MinimumLevelPhreaticLineAtDikeTopPolder = inputParameters.MinimumLevelPhreaticLineAtDikeTopPolder,
                LeakageLengthOutwardsPhreaticLine3 = inputParameters.LeakageLengthOutwardsPhreaticLine3,
                LeakageLengthInwardsPhreaticLine3 = inputParameters.LeakageLengthInwardsPhreaticLine3,
                LeakageLengthOutwardsPhreaticLine4 = inputParameters.DikeSoilScenario != MacroStabilityInwardsDikeSoilScenario.ClayDikeOnSand
                                                             ? inputParameters.LeakageLengthOutwardsPhreaticLine4
                                                             : 1.0,
                LeakageLengthInwardsPhreaticLine4 = inputParameters.DikeSoilScenario != MacroStabilityInwardsDikeSoilScenario.ClayDikeOnSand
                                                            ? inputParameters.LeakageLengthInwardsPhreaticLine4
                                                            : 1.0,
                PiezometricHeadPhreaticLine2Outwards = inputParameters.PiezometricHeadPhreaticLine2Outwards,
                PiezometricHeadPhreaticLine2Inwards = inputParameters.PiezometricHeadPhreaticLine2Inwards,
                PenetrationLengthExtreme = inputParameters.LocationInputExtreme.PenetrationLength,
                PenetrationLengthDaily = inputParameters.LocationInputDaily.PenetrationLength,
                AdjustPhreaticLine3And4ForUplift = inputParameters.AdjustPhreaticLine3And4ForUplift,
                MoveGrid = inputParameters.MoveGrid,
                MaximumSliceWidth = inputParameters.MaximumSliceWidth,
                WaterVolumetricWeight = generalInput.WaterVolumetricWeight
            }));
        }