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);
        }
Ejemplo n.º 2
0
        private IUpliftVanKernel CreateUpliftVanKernel()
        {
            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);

            MacroStabilityInput waternetDailyKernelInput   = MacroStabilityInputCreator.CreateDailyWaternetForUpliftVan(input, soils, surfaceLine, soilProfile);
            MacroStabilityInput waternetExtremeKernelInput = MacroStabilityInputCreator.CreateExtremeWaternetForUpliftVan(input, soils, surfaceLine, soilProfile);

            IWaternetKernel waternetDailyKernel = factory.CreateWaternetDailyKernel(waternetDailyKernelInput);

            waternetDailyKernel.Calculate();

            IWaternetKernel waternetExtremeKernel = factory.CreateWaternetExtremeKernel(waternetExtremeKernelInput);

            waternetExtremeKernel.Calculate();

            MacroStabilityInput kernelInput = MacroStabilityInputCreator.CreateUpliftVan(input, soils, layerLookup,
                                                                                         surfaceLine, soilProfile,
                                                                                         waternetDailyKernel.Waternet,
                                                                                         waternetExtremeKernel.Waternet);

            return(factory.CreateUpliftVanKernel(kernelInput));
        }
        public void CreateExtremeWaternetForUpliftVan_SoilProfileNull_ThrowsArgumentNullException()
        {
            // Call
            void Call() => MacroStabilityInputCreator.CreateExtremeWaternetForUpliftVan(
                UpliftVanCalculatorInputTestFactory.Create(), new List <Soil>(), new SurfaceLine(), null);

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

            Assert.AreEqual("soilProfile", exception.ParamName);
        }
        public void CreateExtremeWaternetForUpliftVan_UpliftVanInputNull_ThrowsArgumentNullException()
        {
            // Call
            void Call() => MacroStabilityInputCreator.CreateExtremeWaternetForUpliftVan(
                null, new List <Soil>(), new SurfaceLine(), new SoilProfile());

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

            Assert.AreEqual("upliftVanInput", exception.ParamName);
        }
Ejemplo n.º 5
0
        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);
            }
        }