Esempio n. 1
0
        public void Read_ValidConfigurationWithEmptyCalculationOrWithEmptyStochasts_NoValuesSet(string fileName)
        {
            // Setup
            string filePath = Path.Combine(testDirectoryPath, $"{fileName}.xml");
            var    reader   = new ClosingStructuresCalculationConfigurationReader(filePath);

            // Call
            IEnumerable <IConfigurationItem> readConfigurationItems = reader.Read().ToArray();

            // Assert
            var configuration = (ClosingStructuresCalculationConfiguration)readConfigurationItems.Single();

            Assert.IsNull(configuration.StructureNormalOrientation);
            Assert.IsNull(configuration.StructureId);
            Assert.IsNull(configuration.HydraulicBoundaryLocationName);
            Assert.IsNull(configuration.ForeshoreProfileId);
            Assert.IsNull(configuration.FailureProbabilityStructureWithErosion);

            Assert.IsNull(configuration.LevelCrestStructureNotClosing);
            Assert.IsNull(configuration.AllowedLevelIncreaseStorage);
            Assert.IsNull(configuration.CriticalOvertoppingDischarge);
            Assert.IsNull(configuration.FlowWidthAtBottomProtection);
            Assert.IsNull(configuration.ModelFactorSuperCriticalFlow);
            Assert.IsNull(configuration.StorageStructureArea);
            Assert.IsNull(configuration.StormDuration);
            Assert.IsNull(configuration.WidthFlowApertures);
            Assert.IsNull(configuration.WaveReduction);
            Assert.IsNull(configuration.Scenario);
        }
Esempio n. 2
0
        public void Read_ValidFullConfigurationsContainingNaN_ExpectedValues()
        {
            // Setup
            string filePath = Path.Combine(testDirectoryPath, "validFullConfigurationContainingNaN.xml");
            var    reader   = new ClosingStructuresCalculationConfigurationReader(filePath);

            // Call
            IEnumerable <IConfigurationItem> readConfigurationItems = reader.Read().ToArray();

            // Assert
            var configuration = (ClosingStructuresCalculationConfiguration)readConfigurationItems.Single();

            Assert.IsNaN(configuration.StructureNormalOrientation);
            Assert.IsNull(configuration.StructureId);
            Assert.IsNull(configuration.HydraulicBoundaryLocationName);
            Assert.IsNull(configuration.ForeshoreProfileId);
            Assert.IsNaN(configuration.FactorStormDurationOpenStructure);
            Assert.IsNaN(configuration.ProbabilityOpenStructureBeforeFlooding);
            Assert.IsNaN(configuration.FailureProbabilityOpenStructure);
            Assert.IsNaN(configuration.FailureProbabilityReparation);
            Assert.IsNaN(configuration.FailureProbabilityStructureWithErosion);

            Assert.IsNaN(configuration.DrainCoefficient.Mean);
            Assert.IsNaN(configuration.DrainCoefficient.StandardDeviation);
            Assert.IsNaN(configuration.InsideWaterLevel.Mean);
            Assert.IsNaN(configuration.InsideWaterLevel.StandardDeviation);
            Assert.IsNaN(configuration.AreaFlowApertures.Mean);
            Assert.IsNaN(configuration.AreaFlowApertures.StandardDeviation);
            Assert.IsNaN(configuration.ThresholdHeightOpenWeir.Mean);
            Assert.IsNaN(configuration.ThresholdHeightOpenWeir.StandardDeviation);
            Assert.IsNaN(configuration.LevelCrestStructureNotClosing.Mean);
            Assert.IsNaN(configuration.LevelCrestStructureNotClosing.StandardDeviation);

            Assert.IsNaN(configuration.AllowedLevelIncreaseStorage.Mean);
            Assert.IsNaN(configuration.AllowedLevelIncreaseStorage.StandardDeviation);
            Assert.IsNaN(configuration.CriticalOvertoppingDischarge.Mean);
            Assert.IsNaN(configuration.CriticalOvertoppingDischarge.VariationCoefficient);
            Assert.IsNaN(configuration.FlowWidthAtBottomProtection.Mean);
            Assert.IsNaN(configuration.FlowWidthAtBottomProtection.StandardDeviation);
            Assert.IsNaN(configuration.ModelFactorSuperCriticalFlow.Mean);
            Assert.IsNaN(configuration.ModelFactorSuperCriticalFlow.StandardDeviation);
            Assert.IsNaN(configuration.StorageStructureArea.Mean);
            Assert.IsNaN(configuration.StorageStructureArea.VariationCoefficient);
            Assert.IsNaN(configuration.StormDuration.Mean);
            Assert.IsNaN(configuration.StormDuration.VariationCoefficient);
            Assert.IsNaN(configuration.WidthFlowApertures.Mean);
            Assert.IsNaN(configuration.WidthFlowApertures.StandardDeviation);

            Assert.IsNull(configuration.WaveReduction.BreakWaterType);
            Assert.IsNaN(configuration.WaveReduction.BreakWaterHeight);
            Assert.IsNull(configuration.WaveReduction.UseBreakWater);
            Assert.IsNull(configuration.WaveReduction.UseForeshoreProfile);
            Assert.IsNaN(configuration.Scenario.Contribution);
        }
Esempio n. 3
0
        public void Constructor_WithFilePath_ReturnsNewInstance()
        {
            // Setup
            string existingPath = Path.Combine(testDirectoryPath, "validConfigurationEmptyCalculation.xml");

            // Call
            var reader = new ClosingStructuresCalculationConfigurationReader(existingPath);

            // Assert
            Assert.IsInstanceOf <CalculationConfigurationReader <ClosingStructuresCalculationConfiguration> >(reader);
        }
Esempio n. 4
0
        public void Read_ValidPreviousVersionConfigurationWithFullCalculation_ReturnExpectedReadCalculation()
        {
            // Setup
            string filePath = Path.Combine(testDirectoryPath, "version0ValidConfigurationFullCalculation.xml");
            var    reader   = new ClosingStructuresCalculationConfigurationReader(filePath);

            // Call
            IEnumerable <IConfigurationItem> readConfigurationItems = reader.Read().ToArray();

            // Assert
            var configuration = (ClosingStructuresCalculationConfiguration)readConfigurationItems.Single();

            AssertConfiguration(configuration);
        }
Esempio n. 5
0
        public void Read_ValidFullConfigurations_ExpectedValues(string fileName)
        {
            // Setup
            string filePath = Path.Combine(testDirectoryPath, $"{fileName}.xml");
            var    reader   = new ClosingStructuresCalculationConfigurationReader(filePath);

            // Call
            IEnumerable <IConfigurationItem> readConfigurationItems = reader.Read().ToArray();

            // Assert
            var configuration = (ClosingStructuresCalculationConfiguration)readConfigurationItems.Single();

            AssertConfiguration(configuration);
        }