Пример #1
0
        public void Constructor_ExpectedValues()
        {
            // Call
            var importer = new StabilityStoneCoverWaveConditionsCalculationConfigurationImporter(
                "",
                new CalculationGroup(),
                Enumerable.Empty <HydraulicBoundaryLocation>(),
                Enumerable.Empty <ForeshoreProfile>(),
                new FailureMechanismContribution(0.1, 0.1),
                Enumerable.Empty <HydraulicBoundaryLocationCalculationsForTargetProbability>());

            // Assert
            Assert.IsInstanceOf <WaveConditionsCalculationConfigurationImporter <
                                     StabilityStoneCoverWaveConditionsCalculation,
                                     StabilityStoneCoverWaveConditionsCalculationConfigurationReader,
                                     StabilityStoneCoverWaveConditionsCalculationConfiguration> >(importer);
        }
Пример #2
0
        public void Import_ValidConfigurationWithValidData_DataAddedToModel()
        {
            // Setup
            string filePath = Path.Combine(path, "validConfigurationFullCalculation.xml");

            var calculationGroup          = new CalculationGroup();
            var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "Locatie", 10, 20);
            var foreshoreProfile          = new ForeshoreProfile(new Point2D(0, 0), new[]
            {
                new Point2D(0, 0),
                new Point2D(1, 1),
                new Point2D(2, 2)
            }, new BreakWater(BreakWaterType.Caisson, 0), new ForeshoreProfile.ConstructionProperties
            {
                Id   = "Voorlandprofiel",
                Name = "VoorlandProfielName"
            });

            var calculationsForTargetProbability = new HydraulicBoundaryLocationCalculationsForTargetProbability(0.02);

            var importer = new StabilityStoneCoverWaveConditionsCalculationConfigurationImporter(
                filePath,
                calculationGroup,
                new[]
            {
                hydraulicBoundaryLocation
            },
                new[]
            {
                foreshoreProfile
            },
                new FailureMechanismContribution(0.1, 0.05),
                new[]
            {
                calculationsForTargetProbability
            });

            // Call
            bool successful = importer.Import();

            // Assert
            Assert.IsTrue(successful);

            var expectedCalculation = new StabilityStoneCoverWaveConditionsCalculation
            {
                Name            = "Berekening 1",
                InputParameters =
                {
                    HydraulicBoundaryLocation     = hydraulicBoundaryLocation,
                    CalculationsTargetProbability = calculationsForTargetProbability,
                    WaterLevelType           = WaveConditionsInputWaterLevelType.UserDefinedTargetProbability,
                    UpperBoundaryRevetment   = (RoundedDouble)10,
                    LowerBoundaryRevetment   = (RoundedDouble)2,
                    UpperBoundaryWaterLevels = (RoundedDouble)9,
                    LowerBoundaryWaterLevels = (RoundedDouble)4,
                    StepSize         = WaveConditionsInputStepSize.Half,
                    ForeshoreProfile = foreshoreProfile,
                    Orientation      = (RoundedDouble)5.5,
                    UseForeshore     = false,
                    UseBreakWater    = true,
                    BreakWater       =
                    {
                        Height = (RoundedDouble)6.6,
                        Type   = BreakWaterType.Caisson
                    },
                    CalculationType               = StabilityStoneCoverWaveConditionsCalculationType.Blocks
                }
            };

            Assert.AreEqual(1, calculationGroup.Children.Count);
            AssertWaveConditionsCalculation(expectedCalculation, (StabilityStoneCoverWaveConditionsCalculation)calculationGroup.Children[0]);
        }