Esempio n. 1
0
        public void Constructor_ExpectedValues()
        {
            // Call
            var importer = new GrassCoverErosionOutwardsWaveConditionsCalculationConfigurationImporter(
                "",
                new CalculationGroup(),
                Enumerable.Empty <HydraulicBoundaryLocation>(),
                Enumerable.Empty <ForeshoreProfile>(),
                new FailureMechanismContribution(0.1, 0.1),
                Enumerable.Empty <HydraulicBoundaryLocationCalculationsForTargetProbability>());

            // Assert
            Assert.IsInstanceOf <WaveConditionsCalculationConfigurationImporter <
                                     GrassCoverErosionOutwardsWaveConditionsCalculation,
                                     GrassCoverErosionOutwardsWaveConditionsCalculationConfigurationReader,
                                     GrassCoverErosionOutwardsWaveConditionsCalculationConfiguration> >(importer);
        }
Esempio n. 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 importer = new GrassCoverErosionOutwardsWaveConditionsCalculationConfigurationImporter(
                filePath,
                calculationGroup,
                new[]
            {
                hydraulicBoundaryLocation
            },
                new[]
            {
                foreshoreProfile
            },
                new FailureMechanismContribution(0.1, 0.05),
                Enumerable.Empty <HydraulicBoundaryLocationCalculationsForTargetProbability>());

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

            // Assert
            Assert.IsTrue(successful);

            var expectedCalculation = new GrassCoverErosionOutwardsWaveConditionsCalculation
            {
                Name            = "Berekening 1",
                InputParameters =
                {
                    HydraulicBoundaryLocation = hydraulicBoundaryLocation,
                    WaterLevelType            = WaveConditionsInputWaterLevelType.SignalFloodingProbability,
                    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           = GrassCoverErosionOutwardsWaveConditionsCalculationType.WaveRunUp
                }
            };

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