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);
            }
        }
        public void CreateWaternet_WaternetInputNull_ThrowsArgumentNullException()
        {
            // Call
            void Call() => MacroStabilityInputCreator.CreateWaternet(null);

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

            Assert.AreEqual("waternetInput", exception.ParamName);
        }
        public void CreateWaternet_ValidData_ReturnMacroStabilityInput()
        {
            // Setup
            WaternetCalculatorInput input = WaternetCalculatorInputTestFactory.CreateValidCalculatorInput();

            // Call
            MacroStabilityInput macroStabilityInput = MacroStabilityInputCreator.CreateWaternet(input);

            // Assert
            LayerWithSoil[] layersWithSoil = LayerWithSoilCreator.Create(input.SoilProfile, out IDictionary <SoilLayer, LayerWithSoil> _);
            CollectionAssert.AreEqual(layersWithSoil.Select(lws => lws.Soil).ToList(), macroStabilityInput.StabilityModel.Soils, new SoilComparer());
            KernelInputAssert.AssertSoilProfile(SoilProfileCreator.Create(layersWithSoil),
                                                macroStabilityInput.StabilityModel.ConstructionStages.Single().SoilProfile);

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

            KernelInputAssert.AssertSurfaceLine(SurfaceLineCreator.Create(input.SurfaceLine), preConstructionStage.SurfaceLine);
            Assert.IsTrue(preConstructionStage.CreateWaternet);
            KernelInputAssert.AssertWaternetCreatorInput(WaternetCreatorInputCreator.Create(input), preConstructionStage.WaternetCreatorInput);
        }
Beispiel #4
0
        private IWaternetKernel GetWaternetKernel()
        {
            MacroStabilityInput kernelInput = MacroStabilityInputCreator.CreateWaternet(Input);

            return(CreateWaternetKernel(kernelInput));
        }