public void Calculate_KernelReturnsLogMessages_ReturnsExpectedLogMessages()
        {
            // Setup
            UpliftVanCalculatorInput input = UpliftVanCalculatorInputTestFactory.Create();

            using (new MacroStabilityInwardsKernelFactoryConfig())
            {
                var factory = (TestMacroStabilityInwardsKernelFactory)MacroStabilityInwardsKernelWrapperFactory.Instance;
                UpliftVanKernelStub upliftVanKernel = factory.LastCreatedUpliftVanKernel;
                upliftVanKernel.ReturnLogMessages = true;
                SetCompleteKernelOutput(upliftVanKernel);

                SetValidKernelOutput(factory.LastCreatedWaternetDailyKernel);
                SetValidKernelOutput(factory.LastCreatedWaternetExtremeKernel);

                // Call
                new UpliftVanCalculator(input, factory).Calculate();

                // Assert
                Assert.AreEqual(3, upliftVanKernel.CalculationMessages.Count());

                MessageHelper.AssertMessage(MessageType.Warning, "Calculation Warning", upliftVanKernel.CalculationMessages.ElementAt(0));
                MessageHelper.AssertMessage(MessageType.Error, "Calculation Error", upliftVanKernel.CalculationMessages.ElementAt(1));
                MessageHelper.AssertMessage(MessageType.Info, "Calculation Info", upliftVanKernel.CalculationMessages.ElementAt(2));
            }
        }
        private static void AssertConstructionStages(
            UpliftVanCalculatorInput input, StabilityInput stabilityModel, SoilProfile soilProfile,
            Waternet dailyWaternet, Waternet extremeWaternet, IDictionary <SoilLayer, LayerWithSoil> layerLookup)
        {
            Assert.AreEqual(2, stabilityModel.ConstructionStages.Count);

            ConstructionStage dailyConstructionStage = stabilityModel.ConstructionStages.ElementAt(0);

            Assert.AreSame(soilProfile, dailyConstructionStage.SoilProfile);
            Assert.AreSame(dailyWaternet, dailyConstructionStage.Waternet);
            CollectionAssert.AreEqual(FixedSoilStressCreator.Create(layerLookup),
                                      dailyConstructionStage.FixedSoilStresses, new FixedSoilStressComparer());
            CollectionAssert.AreEqual(PreconsolidationStressCreator.Create(input.SoilProfile.PreconsolidationStresses),
                                      dailyConstructionStage.PreconsolidationStresses, new PreconsolidationStressComparer());
            AssertMultiplicationFactors(dailyConstructionStage.MultiplicationFactorsCPhiForUplift.Single());
            AssertIrrelevantValues(dailyConstructionStage);

            ConstructionStage extremeConstructionStage = stabilityModel.ConstructionStages.ElementAt(1);

            Assert.AreSame(soilProfile, extremeConstructionStage.SoilProfile);
            Assert.AreSame(extremeWaternet, extremeConstructionStage.Waternet);
            CollectionAssert.IsEmpty(extremeConstructionStage.FixedSoilStresses);
            CollectionAssert.IsEmpty(extremeConstructionStage.PreconsolidationStresses);
            AssertMultiplicationFactors(extremeConstructionStage.MultiplicationFactorsCPhiForUplift.Single());
            AssertIrrelevantValues(extremeConstructionStage);
        }
Beispiel #3
0
        private static IUpliftVanCalculator GetCalculator(MacroStabilityInwardsCalculation calculation, GeneralMacroStabilityInwardsInput generalInput, RoundedDouble normativeAssessmentLevel)
        {
            UpliftVanCalculatorInput upliftVanCalculatorInput = CreateInputFromData(calculation.InputParameters, generalInput, normativeAssessmentLevel);
            IUpliftVanCalculator     calculator = MacroStabilityInwardsCalculatorFactory.Instance.CreateUpliftVanCalculator(upliftVanCalculatorInput, MacroStabilityInwardsKernelWrapperFactory.Instance);

            return(calculator);
        }
Beispiel #4
0
        /// <summary>
        /// Creates <see cref="MacroStabilityInput"/> objects based on the given input for the extreme Waternet calculation.
        /// </summary>
        /// <param name="upliftVanInput">The <see cref="UpliftVanCalculatorInput"/> containing all the values required
        /// for performing the Waternet calculation.</param>
        /// <param name="soils">The collection of <see cref="Soil"/>.</param>
        /// <param name="surfaceLine">The <see cref="SurfaceLine"/>.</param>
        /// <param name="soilProfile">The <see cref="SoilProfile"/>.</param>
        /// <returns>The created <see cref="MacroStabilityInput"/>.</returns>
        /// <exception cref="ArgumentNullException">Thrown when any parameter is <c>null</c>.</exception>
        public static MacroStabilityInput CreateExtremeWaternetForUpliftVan(UpliftVanCalculatorInput upliftVanInput, ICollection <Soil> soils,
                                                                            SurfaceLine surfaceLine, SoilProfile soilProfile)
        {
            if (upliftVanInput == null)
            {
                throw new ArgumentNullException(nameof(upliftVanInput));
            }

            if (soils == null)
            {
                throw new ArgumentNullException(nameof(soils));
            }

            if (surfaceLine == null)
            {
                throw new ArgumentNullException(nameof(surfaceLine));
            }

            if (soilProfile == null)
            {
                throw new ArgumentNullException(nameof(soilProfile));
            }

            return(CreateWaternet(soils, surfaceLine, soilProfile, UpliftVanWaternetCreatorInputCreator.CreateExtreme(upliftVanInput)));
        }
        public void CreateExtremeWaternetForUpliftVan_ValidData_ReturnMacroStabilityInput()
        {
            // Setup
            UpliftVanCalculatorInput input = UpliftVanCalculatorInputTestFactory.Create();

            LayerWithSoil[] layersWithSoil = LayerWithSoilCreator.Create(input.SoilProfile, out IDictionary <SoilLayer, LayerWithSoil> _);
            List <Soil>     soils          = layersWithSoil.Select(lws => lws.Soil).ToList();

            SurfaceLine surfaceLine = SurfaceLineCreator.Create(input.SurfaceLine);
            SoilProfile soilProfile = SoilProfileCreator.Create(layersWithSoil);

            // Call
            MacroStabilityInput macroStabilityInput = MacroStabilityInputCreator.CreateExtremeWaternetForUpliftVan(
                input, soils, surfaceLine, soilProfile);

            // Assert
            CollectionAssert.AreEqual(soils, macroStabilityInput.StabilityModel.Soils, new SoilComparer());
            Assert.AreSame(soilProfile, macroStabilityInput.StabilityModel.ConstructionStages.Single().SoilProfile);

            PreConstructionStage preConstructionStage = macroStabilityInput.PreprocessingInput.PreConstructionStages.Single();

            Assert.AreSame(surfaceLine, preConstructionStage.SurfaceLine);
            Assert.IsTrue(preConstructionStage.CreateWaternet);
            KernelInputAssert.AssertWaternetCreatorInput(UpliftVanWaternetCreatorInputCreator.CreateExtreme(input), preConstructionStage.WaternetCreatorInput);
        }
        public void CreateUpliftVan_ValidDataWithManualTangentLines_ReturnMacroStabilityInput()
        {
            // Setup
            var    random            = new Random(21);
            double tangentZTop       = random.NextDouble();
            double tangentZBottom    = random.NextDouble();
            int    tangentLineNumber = random.Next();

            UpliftVanCalculatorInput input = UpliftVanCalculatorInputTestFactory.Create(tangentZTop, tangentZBottom, tangentLineNumber);

            LayerWithSoil[] layersWithSoil = LayerWithSoilCreator.Create(input.SoilProfile, out IDictionary <SoilLayer, LayerWithSoil> layerLookup);
            List <Soil>     soils          = layersWithSoil.Select(lws => lws.Soil).ToList();

            SurfaceLine surfaceLine = SurfaceLineCreator.Create(input.SurfaceLine);
            SoilProfile soilProfile = SoilProfileCreator.Create(layersWithSoil);

            var dailyWaternet   = new Waternet();
            var extremeWaternet = new Waternet();

            // Call
            MacroStabilityInput macroStabilityInput = MacroStabilityInputCreator.CreateUpliftVan(
                input, soils, layerLookup, surfaceLine, soilProfile, dailyWaternet, extremeWaternet);

            // Assert
            SearchAreaConditions searchAreaConditions = macroStabilityInput.PreprocessingInput.SearchAreaConditions;

            Assert.AreEqual(input.SlipPlane.TangentLinesAutomaticAtBoundaries, searchAreaConditions.AutoTangentLines);
            Assert.AreEqual(input.SlipPlane.TangentLineNumber, searchAreaConditions.TangentLineNumber);
            Assert.AreEqual(input.SlipPlane.TangentZTop, searchAreaConditions.TangentLineZTop);
            Assert.AreEqual(input.SlipPlane.TangentZBottom, searchAreaConditions.TangentLineZBottom);
        }
        public void Calculate_KernelWithCompleteOutput_OutputCorrectlyReturnedByCalculator()
        {
            // Setup
            UpliftVanCalculatorInput input = UpliftVanCalculatorInputTestFactory.Create();

            using (new MacroStabilityInwardsKernelFactoryConfig())
            {
                var factory = (TestMacroStabilityInwardsKernelFactory)MacroStabilityInwardsKernelWrapperFactory.Instance;
                UpliftVanKernelStub upliftVanKernel = factory.LastCreatedUpliftVanKernel;
                SetCompleteKernelOutput(upliftVanKernel);

                SetValidKernelOutput(factory.LastCreatedWaternetDailyKernel);
                SetValidKernelOutput(factory.LastCreatedWaternetExtremeKernel);

                // Call
                UpliftVanCalculatorResult result = new UpliftVanCalculator(input, factory).Calculate();

                // Assert
                Assert.IsNotNull(result);
                Assert.AreEqual(upliftVanKernel.FactorOfStability, result.FactorOfStability);
                Assert.AreEqual(upliftVanKernel.ForbiddenZonesXEntryMax, result.ForbiddenZonesXEntryMax);
                Assert.AreEqual(upliftVanKernel.ForbiddenZonesXEntryMin, result.ForbiddenZonesXEntryMin);
                UpliftVanCalculatorOutputAssert.AssertUpliftVanSlidingCurveResult(UpliftVanSlidingCurveResultCreator.Create(upliftVanKernel.SlidingCurveResult),
                                                                                  result.SlidingCurveResult);
                UpliftVanCalculatorOutputAssert.AssertUpliftVanCalculationGridResult(UpliftVanCalculationGridResultCreator.Create(upliftVanKernel.UpliftVanCalculationGridResult),
                                                                                     result.CalculationGridResult);
            }
        }
Beispiel #8
0
 private static void SetTangentLineProperties(UpliftVanCalculatorInput upliftVanInput, MacroStabilityInput macroStabilityInput)
 {
     if (!upliftVanInput.SlipPlane.TangentLinesAutomaticAtBoundaries)
     {
         macroStabilityInput.PreprocessingInput.SearchAreaConditions.TangentLineNumber  = upliftVanInput.SlipPlane.TangentLineNumber;
         macroStabilityInput.PreprocessingInput.SearchAreaConditions.TangentLineZTop    = upliftVanInput.SlipPlane.TangentZTop;
         macroStabilityInput.PreprocessingInput.SearchAreaConditions.TangentLineZBottom = upliftVanInput.SlipPlane.TangentZBottom;
     }
 }
        public void CreateDaily_WithInput_ReturnWaternetCreatorInput([Values(true, false)] bool drainageConstructionPresent,
                                                                     [Values(true, false)] bool useDefaultOffsets)
        {
            // Setup
            var random = new Random(21);
            DrainageConstruction drainageConstruction = drainageConstructionPresent
                                                            ? new DrainageConstruction(random.Next(), random.Next())
                                                            : new DrainageConstruction();
            PhreaticLineOffsets phreaticLineOffsets = useDefaultOffsets
                                                          ? new PhreaticLineOffsets()
                                                          : new PhreaticLineOffsets(random.Next(), random.Next(),
                                                                                    random.Next(), random.Next());

            var input = new UpliftVanCalculatorInput(
                new UpliftVanCalculatorInput.ConstructionProperties
            {
                SurfaceLine                             = new MacroStabilityInwardsSurfaceLine("test"),
                SoilProfile                             = new TestSoilProfile(),
                SlipPlane                               = new UpliftVanSlipPlane(),
                DikeSoilScenario                        = MacroStabilityInwardsDikeSoilScenario.SandDikeOnClay,
                AssessmentLevel                         = random.NextDouble(),
                WaterLevelRiverAverage                  = random.NextDouble(),
                WaterLevelPolderDaily                   = random.NextDouble(),
                DrainageConstruction                    = drainageConstruction,
                PhreaticLineOffsetsExtreme              = new PhreaticLineOffsets(),
                PhreaticLineOffsetsDaily                = phreaticLineOffsets,
                MinimumLevelPhreaticLineAtDikeTopRiver  = random.NextDouble(),
                MinimumLevelPhreaticLineAtDikeTopPolder = random.NextDouble(),
                AdjustPhreaticLine3And4ForUplift        = random.NextBoolean(),
                LeakageLengthOutwardsPhreaticLine3      = random.NextDouble(),
                LeakageLengthInwardsPhreaticLine3       = random.NextDouble(),
                LeakageLengthOutwardsPhreaticLine4      = random.NextDouble(),
                LeakageLengthInwardsPhreaticLine4       = random.NextDouble(),
                PiezometricHeadPhreaticLine2Outwards    = random.NextDouble(),
                PiezometricHeadPhreaticLine2Inwards     = random.NextDouble(),
                PenetrationLengthDaily                  = random.NextDouble()
            });

            // Call
            WaternetCreatorInput waternetCreatorInput = UpliftVanWaternetCreatorInputCreator.CreateDaily(input);

            // Assert
            Assert.AreEqual(input.WaterLevelRiverAverage, waternetCreatorInput.HeadInPlLine3);
            Assert.AreEqual(input.WaterLevelRiverAverage, waternetCreatorInput.HeadInPlLine4);
            Assert.AreEqual(input.WaterLevelRiverAverage, waternetCreatorInput.WaterLevelRiver);
            Assert.AreEqual(input.WaterLevelPolderDaily, waternetCreatorInput.WaterLevelPolder);
            Assert.AreEqual(input.PhreaticLineOffsetsDaily.UseDefaults, waternetCreatorInput.UseDefaultOffsets);
            Assert.AreEqual(input.PhreaticLineOffsetsDaily.BelowDikeTopAtRiver, waternetCreatorInput.PlLineOffsetBelowPointBRingtoetsWti2017);
            Assert.AreEqual(input.PhreaticLineOffsetsDaily.BelowDikeTopAtPolder, waternetCreatorInput.PlLineOffsetBelowDikeTopAtPolder);
            Assert.AreEqual(input.PhreaticLineOffsetsDaily.BelowShoulderBaseInside, waternetCreatorInput.PlLineOffsetBelowShoulderBaseInside);
            Assert.AreEqual(input.PhreaticLineOffsetsDaily.BelowDikeToeAtPolder, waternetCreatorInput.PlLineOffsetBelowDikeToeAtPolder);
            Assert.AreEqual(input.PenetrationLengthDaily, waternetCreatorInput.PenetrationLength);

            AssertGeneralWaternetCreatorInputValues(input, waternetCreatorInput);
            AssertIrrelevantValues(waternetCreatorInput);
        }
        public void Constructor_FactoryNull_ArgumentNullException()
        {
            // Setup
            UpliftVanCalculatorInput input = UpliftVanCalculatorInputTestFactory.Create();

            // Call
            void Call() => new UpliftVanCalculator(input, null);

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

            Assert.AreEqual("factory", exception.ParamName);
        }
Beispiel #11
0
        /// <summary>
        /// Creates a new instance of <see cref="UpliftVanCalculator"/>.
        /// </summary>
        /// <param name="input">The <see cref="UpliftVanCalculatorInput"/> containing all the values required
        /// for performing the Uplift Van calculation.</param>
        /// <param name="factory">The factory responsible for creating the Uplift Van kernel.</param>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="input"/> or <paramref name="factory"/> is <c>null</c>.</exception>
        public UpliftVanCalculator(UpliftVanCalculatorInput input, IMacroStabilityInwardsKernelFactory factory)
        {
            if (input == null)
            {
                throw new ArgumentNullException(nameof(input));
            }

            if (factory == null)
            {
                throw new ArgumentNullException(nameof(factory));
            }

            this.input   = input;
            this.factory = factory;
        }
Beispiel #12
0
        private static void AssertMacroStabilityInwardsCalculationActivity(Activity activity,
                                                                           MacroStabilityInwardsCalculationScenario calculation,
                                                                           HydraulicBoundaryLocationCalculation hydraulicBoundaryLocationCalculation)
        {
            using (new MacroStabilityInwardsCalculatorFactoryConfig())
            {
                activity.Run();

                var testFactory = (TestMacroStabilityInwardsCalculatorFactory)MacroStabilityInwardsCalculatorFactory.Instance;
                UpliftVanCalculatorInput upliftVanCalculatorInput = testFactory.LastCreatedUpliftVanCalculator.Input;

                Assert.AreEqual(calculation.InputParameters.LeakageLengthInwardsPhreaticLine3, upliftVanCalculatorInput.LeakageLengthInwardsPhreaticLine3);
                Assert.AreEqual(hydraulicBoundaryLocationCalculation.Output.Result, upliftVanCalculatorInput.AssessmentLevel);
            }
        }
        public void Constructor_ValidParameters_ExpectedValues()
        {
            // Setup
            var mocks   = new MockRepository();
            var factory = mocks.Stub <IMacroStabilityInwardsKernelFactory>();

            mocks.ReplayAll();

            UpliftVanCalculatorInput input = UpliftVanCalculatorInputTestFactory.Create();

            // Call
            var calculator = new UpliftVanCalculator(input, factory);

            // Assert
            Assert.IsInstanceOf <IUpliftVanCalculator>(calculator);
            mocks.VerifyAll();
        }
        public void Constructor_EmptyConstructionProperties_ExpectedValues()
        {
            // Setup
            var surfaceLine          = new MacroStabilityInwardsSurfaceLine(string.Empty);
            var soilProfile          = new TestSoilProfile();
            var drainageConstruction = new DrainageConstruction();
            var phreaticLineOffsets  = new PhreaticLineOffsets();
            var slipPlane            = new UpliftVanSlipPlane();
            var slipPlaneConstraints = new UpliftVanSlipPlaneConstraints(double.NaN, double.NaN);

            // Call
            var input = new UpliftVanCalculatorInput(
                new UpliftVanCalculatorInput.ConstructionProperties
            {
                SurfaceLine                = surfaceLine,
                SoilProfile                = soilProfile,
                DrainageConstruction       = drainageConstruction,
                PhreaticLineOffsetsExtreme = phreaticLineOffsets,
                PhreaticLineOffsetsDaily   = phreaticLineOffsets,
                SlipPlane            = slipPlane,
                SlipPlaneConstraints = slipPlaneConstraints
            });

            // Assert
            Assert.IsNaN(input.AssessmentLevel);
            Assert.IsNaN(input.WaterLevelRiverAverage);
            Assert.IsNaN(input.WaterLevelPolderExtreme);
            Assert.IsNaN(input.WaterLevelPolderDaily);
            Assert.IsNaN(input.MinimumLevelPhreaticLineAtDikeTopRiver);
            Assert.IsNaN(input.MinimumLevelPhreaticLineAtDikeTopPolder);
            Assert.IsNaN(input.LeakageLengthOutwardsPhreaticLine3);
            Assert.IsNaN(input.LeakageLengthInwardsPhreaticLine3);
            Assert.IsNaN(input.LeakageLengthOutwardsPhreaticLine4);
            Assert.IsNaN(input.LeakageLengthInwardsPhreaticLine4);
            Assert.IsNaN(input.PiezometricHeadPhreaticLine2Outwards);
            Assert.IsNaN(input.PiezometricHeadPhreaticLine2Inwards);
            Assert.IsNaN(input.PenetrationLengthDaily);
            Assert.IsNaN(input.PenetrationLengthExtreme);
            Assert.IsNaN(input.MaximumSliceWidth);
            Assert.IsNaN(input.WaterVolumetricWeight);

            Assert.IsFalse(input.AdjustPhreaticLine3And4ForUplift);
            Assert.IsFalse(input.MoveGrid);

            Assert.AreEqual(MacroStabilityInwardsDikeSoilScenario.ClayDikeOnClay, input.DikeSoilScenario);
        }
        public void Validate_CalculatorWithValidInput_ReturnEmptyEnumerable()
        {
            // Setup
            UpliftVanCalculatorInput input = UpliftVanCalculatorInputTestFactory.Create();

            using (new MacroStabilityInwardsKernelFactoryConfig())
            {
                var factory = (TestMacroStabilityInwardsKernelFactory)MacroStabilityInwardsKernelWrapperFactory.Instance;

                SetValidKernelOutput(factory.LastCreatedWaternetDailyKernel);
                SetValidKernelOutput(factory.LastCreatedWaternetExtremeKernel);

                // Call
                IEnumerable <MacroStabilityInwardsKernelMessage> kernelMessages = new UpliftVanCalculator(input, factory).Validate();

                // Assert
                CollectionAssert.IsEmpty(kernelMessages);
            }
        }
        public void Validate_CalculatorWithValidInput_KernelValidateMethodCalled()
        {
            // Setup
            UpliftVanCalculatorInput input = UpliftVanCalculatorInputTestFactory.Create();

            using (new MacroStabilityInwardsKernelFactoryConfig())
            {
                var factory = (TestMacroStabilityInwardsKernelFactory)MacroStabilityInwardsKernelWrapperFactory.Instance;

                SetValidKernelOutput(factory.LastCreatedWaternetDailyKernel);
                SetValidKernelOutput(factory.LastCreatedWaternetExtremeKernel);

                // Call
                new UpliftVanCalculator(input, factory).Validate();

                // Assert
                Assert.IsTrue(factory.LastCreatedUpliftVanKernel.Validated);
            }
        }
        /// <summary>
        /// Creates a <see cref="WaternetCreatorInput"/> based on the given <paramref name="input"/> under daily circumstances,
        /// which can be used by <see cref="IUpliftVanKernel"/>.
        /// </summary>
        /// <param name="input">The <see cref="UpliftVanCalculatorInput"/> to get the information from.</param>
        /// <returns>A new <see cref="WaternetCreatorInput"/> with the given information from <paramref name="input"/>.</returns>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="input"/> is <c>null</c>.</exception>
        /// <exception cref="InvalidEnumArgumentException">Thrown when <see cref="UpliftVanCalculatorInput.DikeSoilScenario"/>
        /// is an invalid value.</exception>
        /// <exception cref="NotSupportedException">Thrown when <see cref="UpliftVanCalculatorInput.DikeSoilScenario"/>
        /// is a valid value, but unsupported.</exception>
        public static WaternetCreatorInput CreateDaily(UpliftVanCalculatorInput input)
        {
            if (input == null)
            {
                throw new ArgumentNullException(nameof(input));
            }

            WaternetCreatorInput creatorInput = CreateBaseWaternetCreatorInput(input);

            creatorInput.WaterLevelRiver   = input.WaterLevelRiverAverage;
            creatorInput.HeadInPlLine3     = input.WaterLevelRiverAverage;
            creatorInput.HeadInPlLine4     = input.WaterLevelRiverAverage;
            creatorInput.WaterLevelPolder  = input.WaterLevelPolderDaily;
            creatorInput.UseDefaultOffsets = input.PhreaticLineOffsetsDaily.UseDefaults;
            creatorInput.PlLineOffsetBelowPointBRingtoetsWti2017 = input.PhreaticLineOffsetsDaily.BelowDikeTopAtRiver;
            creatorInput.PlLineOffsetBelowDikeTopAtPolder        = input.PhreaticLineOffsetsDaily.BelowDikeTopAtPolder;
            creatorInput.PlLineOffsetBelowShoulderBaseInside     = input.PhreaticLineOffsetsDaily.BelowShoulderBaseInside;
            creatorInput.PlLineOffsetBelowDikeToeAtPolder        = input.PhreaticLineOffsetsDaily.BelowDikeToeAtPolder;
            creatorInput.PenetrationLength = input.PenetrationLengthDaily;
            return(creatorInput);
        }
 private static WaternetCreatorInput CreateBaseWaternetCreatorInput(UpliftVanCalculatorInput input)
 {
     return(new WaternetCreatorInput
     {
         DikeSoilScenario = WaternetCreatorInputHelper.ConvertDikeSoilScenario(input.DikeSoilScenario),
         WaterLevelRiverAverage = input.WaterLevelRiverAverage,
         DrainageConstructionPresent = input.DrainageConstruction.IsPresent,
         DrainageConstruction = input.DrainageConstruction.IsPresent
                                    ? new Point2D(input.DrainageConstruction.XCoordinate, input.DrainageConstruction.ZCoordinate)
                                    : null,
         MinimumLevelPhreaticLineAtDikeTopRiver = input.MinimumLevelPhreaticLineAtDikeTopRiver,
         MinimumLevelPhreaticLineAtDikeTopPolder = input.MinimumLevelPhreaticLineAtDikeTopPolder,
         AdjustPl3And4ForUplift = input.AdjustPhreaticLine3And4ForUplift,
         LeakageLengthOutwardsPl3 = input.LeakageLengthOutwardsPhreaticLine3,
         LeakageLengthInwardsPl3 = input.LeakageLengthInwardsPhreaticLine3,
         LeakageLengthOutwardsPl4 = input.LeakageLengthOutwardsPhreaticLine4,
         LeakageLengthInwardsPl4 = input.LeakageLengthInwardsPhreaticLine4,
         HeadInPlLine2Outwards = input.PiezometricHeadPhreaticLine2Outwards,
         HeadInPlLine2Inwards = input.PiezometricHeadPhreaticLine2Inwards,
         UnitWeightWater = input.WaterVolumetricWeight
     });
 }
        public void Calculate_CalculatorWithCompleteInput_InputCorrectlySetToKernel()
        {
            // Setup
            UpliftVanCalculatorInput input = UpliftVanCalculatorInputTestFactory.Create();

            using (new MacroStabilityInwardsKernelFactoryConfig())
            {
                var factory = (TestMacroStabilityInwardsKernelFactory)MacroStabilityInwardsKernelWrapperFactory.Instance;
                UpliftVanKernelStub upliftVanKernel       = factory.LastCreatedUpliftVanKernel;
                WaternetKernelStub  waternetDailyKernel   = factory.LastCreatedWaternetDailyKernel;
                WaternetKernelStub  waternetExtremeKernel = factory.LastCreatedWaternetExtremeKernel;

                SetValidKernelOutput(waternetDailyKernel);
                SetValidKernelOutput(waternetExtremeKernel);

                SetValidKernelOutput(upliftVanKernel);

                LayerWithSoil[]          layersWithSoil = LayerWithSoilCreator.Create(input.SoilProfile, out IDictionary <SoilLayer, LayerWithSoil> layerLookup);
                List <Soil>              soils          = layersWithSoil.Select(lws => lws.Soil).ToList();
                SurfaceLine              surfaceLine    = SurfaceLineCreator.Create(input.SurfaceLine);
                CSharpWrapperSoilProfile soilProfile    = SoilProfileCreator.Create(layersWithSoil);

                // Call
                new UpliftVanCalculator(input, factory).Calculate();

                // Assert
                WaternetKernelInputAssert.AssertMacroStabilityInput(
                    MacroStabilityInputCreator.CreateDailyWaternetForUpliftVan(input, soils, surfaceLine, soilProfile),
                    waternetDailyKernel.KernelInput);
                WaternetKernelInputAssert.AssertMacroStabilityInput(
                    MacroStabilityInputCreator.CreateExtremeWaternetForUpliftVan(input, soils, surfaceLine, soilProfile),
                    waternetExtremeKernel.KernelInput);
                UpliftVanKernelInputAssert.AssertMacroStabilityInput(
                    MacroStabilityInputCreator.CreateUpliftVan(
                        input, soils, layerLookup, surfaceLine, soilProfile,
                        waternetDailyKernel.Waternet, waternetExtremeKernel.Waternet),
                    upliftVanKernel.KernelInput);
            }
        }
        public void CreateExtreme_ValidDikeSoilScenario_ReturnInputWithDikeSoilScenario(MacroStabilityInwardsDikeSoilScenario macroStabilityInwardsDikeSoilScenario,
                                                                                        DikeSoilScenario expectedDikeSoilScenario)
        {
            // Setup
            var input = new UpliftVanCalculatorInput(
                new UpliftVanCalculatorInput.ConstructionProperties
            {
                DrainageConstruction       = new DrainageConstruction(),
                PhreaticLineOffsetsExtreme = new PhreaticLineOffsets(),
                PhreaticLineOffsetsDaily   = new PhreaticLineOffsets(),
                SurfaceLine      = new MacroStabilityInwardsSurfaceLine("test"),
                SoilProfile      = new TestSoilProfile(),
                SlipPlane        = new UpliftVanSlipPlane(),
                DikeSoilScenario = macroStabilityInwardsDikeSoilScenario
            });

            // Call
            WaternetCreatorInput waternetCreatorInput = UpliftVanWaternetCreatorInputCreator.CreateExtreme(input);

            // Assert
            Assert.AreEqual(expectedDikeSoilScenario, waternetCreatorInput.DikeSoilScenario);
        }
        private static void AssertGeneralWaternetCreatorInputValues(UpliftVanCalculatorInput input, WaternetCreatorInput waternetCreatorInput)
        {
            Assert.AreEqual(input.WaterLevelRiverAverage, waternetCreatorInput.WaterLevelRiverAverage);
            Assert.AreEqual(input.DrainageConstruction.IsPresent, waternetCreatorInput.DrainageConstructionPresent);
            if (input.DrainageConstruction.IsPresent)
            {
                Assert.AreEqual(input.DrainageConstruction.XCoordinate, waternetCreatorInput.DrainageConstruction.X);
                Assert.AreEqual(input.DrainageConstruction.ZCoordinate, waternetCreatorInput.DrainageConstruction.Z);
            }

            Assert.AreEqual(input.MinimumLevelPhreaticLineAtDikeTopRiver, waternetCreatorInput.MinimumLevelPhreaticLineAtDikeTopRiver);
            Assert.AreEqual(input.MinimumLevelPhreaticLineAtDikeTopPolder, waternetCreatorInput.MinimumLevelPhreaticLineAtDikeTopPolder);
            Assert.AreEqual(DikeSoilScenario.SandDikeOnClay, waternetCreatorInput.DikeSoilScenario);
            Assert.AreEqual(input.AdjustPhreaticLine3And4ForUplift, waternetCreatorInput.AdjustPl3And4ForUplift);
            Assert.AreEqual(input.LeakageLengthOutwardsPhreaticLine3, waternetCreatorInput.LeakageLengthOutwardsPl3);
            Assert.AreEqual(input.LeakageLengthInwardsPhreaticLine3, waternetCreatorInput.LeakageLengthInwardsPl3);
            Assert.AreEqual(input.LeakageLengthOutwardsPhreaticLine4, waternetCreatorInput.LeakageLengthOutwardsPl4);
            Assert.AreEqual(input.LeakageLengthInwardsPhreaticLine4, waternetCreatorInput.LeakageLengthInwardsPl4);
            Assert.AreEqual(input.PiezometricHeadPhreaticLine2Outwards, waternetCreatorInput.HeadInPlLine2Outwards);
            Assert.AreEqual(input.PiezometricHeadPhreaticLine2Inwards, waternetCreatorInput.HeadInPlLine2Inwards);
            Assert.AreEqual(input.WaterVolumetricWeight, waternetCreatorInput.UnitWeightWater);
        }
        public void CreateExtreme_InvalidDikeSoilScenario_ThrowInvalidEnumArgumentException()
        {
            // Setup
            var input = new UpliftVanCalculatorInput(
                new UpliftVanCalculatorInput.ConstructionProperties
            {
                SurfaceLine = new MacroStabilityInwardsSurfaceLine("test"),
                SoilProfile = new TestSoilProfile(),
                PhreaticLineOffsetsExtreme = new PhreaticLineOffsets(),
                PhreaticLineOffsetsDaily   = new PhreaticLineOffsets(),
                DrainageConstruction       = new DrainageConstruction(),
                SlipPlane        = new UpliftVanSlipPlane(),
                DikeSoilScenario = (MacroStabilityInwardsDikeSoilScenario)99
            });

            // Call
            void Call() => UpliftVanWaternetCreatorInputCreator.CreateExtreme(input);

            // Assert
            string message = $"The value of argument 'dikeSoilScenario' ({99}) is invalid for Enum type '{nameof(MacroStabilityInwardsDikeSoilScenario)}'.";

            TestHelper.AssertThrowsArgumentExceptionAndTestMessage <InvalidEnumArgumentException>(Call, message);
        }
        public void Calculate_KernelThrowsUpliftVanKernelWrapperException_ThrowUpliftVanCalculatorException()
        {
            // Setup
            UpliftVanCalculatorInput input = UpliftVanCalculatorInputTestFactory.Create();

            using (new MacroStabilityInwardsKernelFactoryConfig())
            {
                var factory = (TestMacroStabilityInwardsKernelFactory)MacroStabilityInwardsKernelWrapperFactory.Instance;
                UpliftVanKernelStub upliftVanKernel = factory.LastCreatedUpliftVanKernel;
                upliftVanKernel.ThrowExceptionOnCalculate = true;

                SetValidKernelOutput(factory.LastCreatedWaternetDailyKernel);
                SetValidKernelOutput(factory.LastCreatedWaternetExtremeKernel);

                // Call
                void Call() => new UpliftVanCalculator(input, factory).Calculate();

                // Assert
                var exception = Assert.Throws <UpliftVanCalculatorException>(Call);
                Assert.IsInstanceOf <UpliftVanKernelWrapperException>(exception.InnerException);
                Assert.AreEqual(exception.InnerException.Message, exception.Message);
                CollectionAssert.IsEmpty(exception.KernelMessages);
            }
        }
        public void Calculate_KernelThrowsUpliftVanKernelWrapperExceptionWithLogMessages_ThrowUpliftVanCalculatorException()
        {
            // Setup
            UpliftVanCalculatorInput input = UpliftVanCalculatorInputTestFactory.Create();

            using (new MacroStabilityInwardsKernelFactoryConfig())
            {
                var factory = (TestMacroStabilityInwardsKernelFactory)MacroStabilityInwardsKernelWrapperFactory.Instance;
                UpliftVanKernelStub upliftVanKernel = factory.LastCreatedUpliftVanKernel;
                upliftVanKernel.ThrowExceptionOnCalculate = true;
                upliftVanKernel.ReturnLogMessages         = true;

                SetValidKernelOutput(factory.LastCreatedWaternetDailyKernel);
                SetValidKernelOutput(factory.LastCreatedWaternetExtremeKernel);

                // Call
                void Call() => new UpliftVanCalculator(input, factory).Calculate();

                // Assert
                var exception = Assert.Throws <UpliftVanCalculatorException>(Call);
                Assert.IsInstanceOf <UpliftVanKernelWrapperException>(exception.InnerException);
                Assert.AreEqual(exception.InnerException.Message, exception.Message);

                IEnumerable <Message> expectedMessages = GetSupportMessages(upliftVanKernel.CalculationMessages);
                Assert.AreEqual(expectedMessages.Count(), exception.KernelMessages.Count());

                for (var i = 0; i < expectedMessages.Count(); i++)
                {
                    Message upliftVanKernelCalculationMessage = expectedMessages.ElementAt(i);
                    MacroStabilityInwardsKernelMessage exceptionKernelMessage = exception.KernelMessages.ElementAt(i);

                    Assert.AreEqual(upliftVanKernelCalculationMessage.Content, exceptionKernelMessage.Message);
                    Assert.AreEqual(GetMessageType(upliftVanKernelCalculationMessage.MessageType), exceptionKernelMessage.Type);
                }
            }
        }
Beispiel #25
0
 public IUpliftVanCalculator CreateUpliftVanCalculator(UpliftVanCalculatorInput input, IMacroStabilityInwardsKernelFactory factory)
 {
     return(new UpliftVanCalculator(input, factory));
 }
        public IUpliftVanCalculator CreateUpliftVanCalculator(UpliftVanCalculatorInput input, IMacroStabilityInwardsKernelFactory factory)
        {
            LastCreatedUpliftVanCalculator.Input = input;

            return(LastCreatedUpliftVanCalculator);
        }
Beispiel #27
0
        /// <summary>
        /// Creates <see cref="MacroStabilityInput"/> objects based on the given input for the Uplift Van calculation.
        /// </summary>
        /// <param name="upliftVanInput">The <see cref="UpliftVanCalculatorInput"/> containing all the values required
        /// for performing the Uplift Van calculation.</param>
        /// <param name="soils">The collection of <see cref="Soil"/>.</param>
        /// <param name="layerLookup">The lookup between <see cref="Soil"/> and <see cref="SoilLayer"/>.</param>
        /// <param name="surfaceLine">The <see cref="SurfaceLine"/>.</param>
        /// <param name="soilProfile">The <see cref="SoilProfile"/>.</param>
        /// <param name="dailyWaternet">The calculated <see cref="Waternet"/> for daily circumstances.</param>
        /// <param name="extremeWaternet">The calculated <see cref="Waternet"/> for extreme circumstances.</param>
        /// <returns>The created <see cref="MacroStabilityInput"/>.</returns>
        /// <exception cref="ArgumentNullException">Thrown when any parameter is <c>null</c>.</exception>
        public static MacroStabilityInput CreateUpliftVan(UpliftVanCalculatorInput upliftVanInput, ICollection <Soil> soils,
                                                          IDictionary <SoilLayer, LayerWithSoil> layerLookup, SurfaceLine surfaceLine,
                                                          SoilProfile soilProfile, Waternet dailyWaternet, Waternet extremeWaternet)
        {
            if (upliftVanInput == null)
            {
                throw new ArgumentNullException(nameof(upliftVanInput));
            }

            if (soils == null)
            {
                throw new ArgumentNullException(nameof(soils));
            }

            if (layerLookup == null)
            {
                throw new ArgumentNullException(nameof(layerLookup));
            }

            if (surfaceLine == null)
            {
                throw new ArgumentNullException(nameof(surfaceLine));
            }

            if (soilProfile == null)
            {
                throw new ArgumentNullException(nameof(soilProfile));
            }

            if (dailyWaternet == null)
            {
                throw new ArgumentNullException(nameof(dailyWaternet));
            }

            if (extremeWaternet == null)
            {
                throw new ArgumentNullException(nameof(extremeWaternet));
            }

            var macroStabilityInput = new MacroStabilityInput
            {
                StabilityModel =
                {
                    Orientation        = Orientation.Inwards,
                    SearchAlgorithm    = SearchAlgorithm.Grid,
                    ModelOption        = StabilityModelOptionType.UpliftVan,
                    ConstructionStages =
                    {
                        AddConstructionStage(soilProfile,                                                                                         dailyWaternet, FixedSoilStressCreator.Create(layerLookup).ToList(),
                                             PreconsolidationStressCreator.Create(upliftVanInput.SoilProfile.PreconsolidationStresses).ToList()),
                        AddConstructionStage(soilProfile,                                                                                         extremeWaternet)
                    },
                    Soils                           = soils,
                    MoveGrid                        = upliftVanInput.MoveGrid,
                    MaximumSliceWidth               = upliftVanInput.MaximumSliceWidth,
                    UpliftVanCalculationGrid        = UpliftVanCalculationGridCreator.Create(upliftVanInput.SlipPlane),
                    SlipPlaneConstraints            = SlipPlaneConstraintsCreator.Create(upliftVanInput.SlipPlaneConstraints),
                    NumberOfRefinementsGrid         = upliftVanInput.SlipPlane.GridNumberOfRefinements,
                    NumberOfRefinementsTangentLines = upliftVanInput.SlipPlane.TangentLineNumberOfRefinements
                },
                PreprocessingInput =
                {
                    SearchAreaConditions            =
                    {
                        MaxSpacingBetweenBoundaries =                                                        0.8,
                        OnlyAbovePleistoceen        = true,
                        AutoSearchArea          = upliftVanInput.SlipPlane.GridAutomaticDetermined,
                        AutoTangentLines        = upliftVanInput.SlipPlane.TangentLinesAutomaticAtBoundaries,
                        AutomaticForbiddenZones = upliftVanInput.SlipPlaneConstraints.AutomaticForbiddenZones
                    },
                    PreConstructionStages           =
                    {
                        AddPreConstructionStage(surfaceLine),
                        AddPreConstructionStage(surfaceLine)
                    }
                }
            };

            SetTangentLineProperties(upliftVanInput, macroStabilityInput);

            return(macroStabilityInput);
        }
        public void Constructor_WithConstructionProperties_PropertiesAreSet()
        {
            // Setup
            var random = new Random(11);

            double hRiverValue             = random.NextDouble();
            var    surfaceLine             = new MacroStabilityInwardsSurfaceLine(string.Empty);
            var    soilProfile             = new TestSoilProfile();
            var    drainageConstruction    = new DrainageConstruction();
            var    phreaticLineOffsets     = new PhreaticLineOffsets();
            var    slipPlane               = new UpliftVanSlipPlane();
            var    slipPlaneConstraints    = new UpliftVanSlipPlaneConstraints(random.NextDouble(), random.NextDouble());
            double waterLevelRiverAverage  = random.NextDouble();
            double waterLevelPolderExtreme = random.NextDouble();
            double waterLevelPolderDaily   = random.NextDouble();
            double minimumLevelPhreaticLineAtDikeTopRiver  = random.NextDouble();
            double minimumLevelPhreaticLineAtDikeTopPolder = random.NextDouble();
            double leakageLengthOutwardsPhreaticLine3      = random.NextDouble();
            double leakageLengthInwardsPhreaticLine3       = random.NextDouble();
            double leakageLengthOutwardsPhreaticLine4      = random.NextDouble();
            double leakageLengthInwardsPhreaticLine4       = random.NextDouble();
            double piezometricHeadPhreaticLine2Outwards    = random.NextDouble();
            double piezometricHeadPhreaticLine2Inwards     = random.NextDouble();
            double penetrationLengthExtreme         = random.NextDouble();
            double penetrationLengthDaily           = random.NextDouble();
            bool   adjustPhreaticLine3And4ForUplift = random.NextBoolean();
            var    dikeSoilScenario      = random.NextEnumValue <MacroStabilityInwardsDikeSoilScenario>();
            bool   moveGrid              = random.NextBoolean();
            double maximumSliceWidth     = random.NextDouble();
            double waterVolumetricWeight = random.NextDouble();

            // Call
            var input = new UpliftVanCalculatorInput(
                new UpliftVanCalculatorInput.ConstructionProperties
            {
                AssessmentLevel            = hRiverValue,
                SurfaceLine                = surfaceLine,
                SoilProfile                = soilProfile,
                DrainageConstruction       = drainageConstruction,
                PhreaticLineOffsetsExtreme = phreaticLineOffsets,
                PhreaticLineOffsetsDaily   = phreaticLineOffsets,
                SlipPlane               = slipPlane,
                SlipPlaneConstraints    = slipPlaneConstraints,
                WaterLevelRiverAverage  = waterLevelRiverAverage,
                WaterLevelPolderExtreme = waterLevelPolderExtreme,
                WaterLevelPolderDaily   = waterLevelPolderDaily,
                MinimumLevelPhreaticLineAtDikeTopRiver  = minimumLevelPhreaticLineAtDikeTopRiver,
                MinimumLevelPhreaticLineAtDikeTopPolder = minimumLevelPhreaticLineAtDikeTopPolder,
                LeakageLengthOutwardsPhreaticLine3      = leakageLengthOutwardsPhreaticLine3,
                LeakageLengthInwardsPhreaticLine3       = leakageLengthInwardsPhreaticLine3,
                LeakageLengthOutwardsPhreaticLine4      = leakageLengthOutwardsPhreaticLine4,
                LeakageLengthInwardsPhreaticLine4       = leakageLengthInwardsPhreaticLine4,
                PiezometricHeadPhreaticLine2Outwards    = piezometricHeadPhreaticLine2Outwards,
                PiezometricHeadPhreaticLine2Inwards     = piezometricHeadPhreaticLine2Inwards,
                PenetrationLengthExtreme         = penetrationLengthExtreme,
                PenetrationLengthDaily           = penetrationLengthDaily,
                AdjustPhreaticLine3And4ForUplift = adjustPhreaticLine3And4ForUplift,
                DikeSoilScenario      = dikeSoilScenario,
                MoveGrid              = moveGrid,
                MaximumSliceWidth     = maximumSliceWidth,
                WaterVolumetricWeight = waterVolumetricWeight
            });

            // Assert
            Assert.AreEqual(hRiverValue, input.AssessmentLevel);
            Assert.AreSame(surfaceLine, input.SurfaceLine);
            Assert.AreSame(soilProfile, input.SoilProfile);
            Assert.AreSame(drainageConstruction, input.DrainageConstruction);
            Assert.AreSame(phreaticLineOffsets, input.PhreaticLineOffsetsDaily);
            Assert.AreSame(phreaticLineOffsets, input.PhreaticLineOffsetsExtreme);
            Assert.AreSame(slipPlane, input.SlipPlane);
            Assert.AreSame(slipPlaneConstraints, input.SlipPlaneConstraints);

            Assert.AreEqual(waterLevelRiverAverage, input.WaterLevelRiverAverage);
            Assert.AreEqual(waterLevelPolderExtreme, input.WaterLevelPolderExtreme);
            Assert.AreEqual(waterLevelPolderDaily, input.WaterLevelPolderDaily);
            Assert.AreEqual(minimumLevelPhreaticLineAtDikeTopRiver, input.MinimumLevelPhreaticLineAtDikeTopRiver);
            Assert.AreEqual(minimumLevelPhreaticLineAtDikeTopPolder, input.MinimumLevelPhreaticLineAtDikeTopPolder);
            Assert.AreEqual(leakageLengthOutwardsPhreaticLine3, input.LeakageLengthOutwardsPhreaticLine3);
            Assert.AreEqual(leakageLengthInwardsPhreaticLine3, input.LeakageLengthInwardsPhreaticLine3);
            Assert.AreEqual(leakageLengthOutwardsPhreaticLine4, input.LeakageLengthOutwardsPhreaticLine4);
            Assert.AreEqual(leakageLengthInwardsPhreaticLine4, input.LeakageLengthInwardsPhreaticLine4);
            Assert.AreEqual(piezometricHeadPhreaticLine2Outwards, input.PiezometricHeadPhreaticLine2Outwards);
            Assert.AreEqual(piezometricHeadPhreaticLine2Inwards, input.PiezometricHeadPhreaticLine2Inwards);
            Assert.AreEqual(penetrationLengthExtreme, input.PenetrationLengthExtreme);
            Assert.AreEqual(penetrationLengthDaily, input.PenetrationLengthDaily);
            Assert.AreEqual(adjustPhreaticLine3And4ForUplift, input.AdjustPhreaticLine3And4ForUplift);

            Assert.AreEqual(dikeSoilScenario, input.DikeSoilScenario);
            Assert.AreEqual(moveGrid, input.MoveGrid);
            Assert.AreEqual(maximumSliceWidth, input.MaximumSliceWidth);
            Assert.AreEqual(waterVolumetricWeight, input.WaterVolumetricWeight);
        }
        public void CreateUpliftVan_ValidData_ReturnMacroStabilityInput()
        {
            // Setup
            UpliftVanCalculatorInput input = UpliftVanCalculatorInputTestFactory.Create();

            LayerWithSoil[] layersWithSoil = LayerWithSoilCreator.Create(input.SoilProfile, out IDictionary <SoilLayer, LayerWithSoil> layerLookup);
            List <Soil>     soils          = layersWithSoil.Select(lws => lws.Soil).ToList();

            SurfaceLine surfaceLine = SurfaceLineCreator.Create(input.SurfaceLine);
            SoilProfile soilProfile = SoilProfileCreator.Create(layersWithSoil);

            var dailyWaternet   = new Waternet();
            var extremeWaternet = new Waternet();

            // Call
            MacroStabilityInput macroStabilityInput = MacroStabilityInputCreator.CreateUpliftVan(
                input, soils, layerLookup, surfaceLine, soilProfile, dailyWaternet, extremeWaternet);

            // Assert
            StabilityInput stabilityModel = macroStabilityInput.StabilityModel;

            Assert.AreEqual(Orientation.Inwards, stabilityModel.Orientation);
            Assert.AreEqual(SearchAlgorithm.Grid, stabilityModel.SearchAlgorithm);
            Assert.AreEqual(StabilityModelOptionType.UpliftVan, stabilityModel.ModelOption);

            CollectionAssert.AreEqual(soils, stabilityModel.Soils, new SoilComparer());
            Assert.AreEqual(input.MoveGrid, stabilityModel.MoveGrid);
            Assert.AreEqual(input.MaximumSliceWidth, stabilityModel.MaximumSliceWidth);

            UpliftVanKernelInputAssert.AssertUpliftVanCalculationGrid(
                UpliftVanCalculationGridCreator.Create(input.SlipPlane), stabilityModel.UpliftVanCalculationGrid);

            UpliftVanKernelInputAssert.AssertSlipPlaneConstraints(
                SlipPlaneConstraintsCreator.Create(input.SlipPlaneConstraints), stabilityModel.SlipPlaneConstraints);

            AssertConstructionStages(input, stabilityModel, soilProfile, dailyWaternet, extremeWaternet, layerLookup);

            Assert.AreEqual(input.SlipPlane.GridNumberOfRefinements, stabilityModel.NumberOfRefinementsGrid);
            Assert.AreEqual(input.SlipPlane.TangentLineNumberOfRefinements, stabilityModel.NumberOfRefinementsTangentLines);

            SearchAreaConditions searchAreaConditions = macroStabilityInput.PreprocessingInput.SearchAreaConditions;

            Assert.AreEqual(0.8, searchAreaConditions.MaxSpacingBetweenBoundaries);
            Assert.IsTrue(searchAreaConditions.OnlyAbovePleistoceen);
            Assert.AreEqual(input.SlipPlane.GridAutomaticDetermined, searchAreaConditions.AutoSearchArea);
            Assert.AreEqual(input.SlipPlane.TangentLinesAutomaticAtBoundaries, searchAreaConditions.AutoTangentLines);
            Assert.AreEqual(1, searchAreaConditions.TangentLineNumber);
            Assert.AreEqual(0, searchAreaConditions.TangentLineZTop);
            Assert.AreEqual(0, searchAreaConditions.TangentLineZBottom);
            Assert.AreEqual(input.SlipPlaneConstraints.AutomaticForbiddenZones, searchAreaConditions.AutomaticForbiddenZones);

            Assert.AreEqual(2, macroStabilityInput.PreprocessingInput.PreConstructionStages.Count);

            foreach (PreConstructionStage preConstructionStage in macroStabilityInput.PreprocessingInput.PreConstructionStages)
            {
                Assert.IsFalse(preConstructionStage.CreateWaternet);
                Assert.AreSame(surfaceLine, preConstructionStage.SurfaceLine);
                Assert.IsNull(preConstructionStage.WaternetCreatorInput); // Not needed as Waternet is already calculated
            }

            AssertIrrelevantValues(stabilityModel, searchAreaConditions);
        }