public void Calculate_CalculatorWithCompleteInput_InputCorrectlySetToKernel()
        {
            // Setup
            WaternetCalculatorInput input = WaternetCalculatorInputTestFactory.CreateCompleteCalculatorInput();

            using (new MacroStabilityInwardsKernelFactoryConfig())
            {
                var factory = (TestMacroStabilityInwardsKernelFactory)MacroStabilityInwardsKernelWrapperFactory.Instance;
                WaternetKernelStub waternetKernel = factory.LastCreatedWaternetExtremeKernel;
                waternetKernel.Waternet = new CSharpWrapperWaternet
                {
                    HeadLines      = new List <HeadLine>(),
                    ReferenceLines = new List <ReferenceLine>(),
                    PhreaticLine   = new HeadLine
                    {
                        Name = string.Empty
                    }
                };

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

                // Assert
                WaternetKernelInputAssert.AssertMacroStabilityInput(MacroStabilityInputCreator.CreateWaternet(input), waternetKernel.KernelInput);
            }
        }
Exemplo n.º 2
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);
            }
        }