示例#1
0
        public void Read_ValidConfigurationWithPartialCalculation_ReturnExpectedReadWaveConditionsCalculation()
        {
            // Setup
            string filePath = Path.Combine(testDirectoryPath, "validConfigurationPartialCalculation.xml");
            var    reader   = new TestWaveConditionsCalculationConfigurationReader(filePath, validMainSchemaDefinitions);

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

            // Assert
            var configuration = (WaveConditionsCalculationConfiguration)readItems.Single();

            Assert.IsNotNull(configuration);
            Assert.IsNull(configuration.HydraulicBoundaryLocationName);
            Assert.IsNull(configuration.TargetProbability);
            Assert.AreEqual(1.1, configuration.UpperBoundaryRevetment);
            Assert.AreEqual(2.2, configuration.LowerBoundaryRevetment);
            Assert.IsNull(configuration.UpperBoundaryWaterLevels);
            Assert.IsNull(configuration.LowerBoundaryWaterLevels);
            Assert.AreEqual(ConfigurationWaveConditionsInputStepSize.Half, configuration.StepSize);
            Assert.IsNull(configuration.ForeshoreProfileId);
            Assert.IsNull(configuration.Orientation);
            Assert.IsTrue(configuration.WaveReduction.UseBreakWater);
            Assert.AreEqual(ConfigurationBreakWaterType.Caisson, configuration.WaveReduction.BreakWaterType);
            Assert.AreEqual(3.3, configuration.WaveReduction.BreakWaterHeight);
            Assert.IsNull(configuration.WaveReduction.UseForeshoreProfile);
        }
示例#2
0
        public void Read_ValidConfigurationWithCalculationContainingInfinities_ReturnExpectedReadWaveConditionsCalculation()
        {
            // Setup
            string filePath = Path.Combine(testDirectoryPath, "validConfigurationCalculationContaininInfinities.xml");
            var    reader   = new TestWaveConditionsCalculationConfigurationReader(filePath, validMainSchemaDefinitions);

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

            // Assert
            var configuration = (WaveConditionsCalculationConfiguration)readItems.Single();

            Assert.IsNotNull(configuration);

            Assert.IsNotNull(configuration.TargetProbability);
            Assert.IsNotNull(configuration.UpperBoundaryRevetment);
            Assert.IsNotNull(configuration.LowerBoundaryRevetment);
            Assert.IsNotNull(configuration.UpperBoundaryWaterLevels);
            Assert.IsNotNull(configuration.LowerBoundaryWaterLevels);
            Assert.IsNotNull(configuration.Orientation);
            Assert.IsNotNull(configuration.WaveReduction.BreakWaterHeight);

            Assert.IsTrue(double.IsPositiveInfinity(configuration.TargetProbability.Value));
            Assert.IsTrue(double.IsPositiveInfinity(configuration.UpperBoundaryRevetment.Value));
            Assert.IsTrue(double.IsNegativeInfinity(configuration.LowerBoundaryRevetment.Value));
            Assert.IsTrue(double.IsPositiveInfinity(configuration.UpperBoundaryWaterLevels.Value));
            Assert.IsTrue(double.IsNegativeInfinity(configuration.LowerBoundaryWaterLevels.Value));
            Assert.IsTrue(double.IsPositiveInfinity(configuration.Orientation.Value));
            Assert.IsTrue(double.IsPositiveInfinity(configuration.WaveReduction.BreakWaterHeight.Value));
        }
示例#3
0
        public void Read_ValidPreviousVersionConfigurationWithFullCalculation_ReturnExpectedReadCalculation(int versionNumber)
        {
            // Setup
            string filePath = Path.Combine(testDirectoryPath, $"version{versionNumber}ValidConfigurationFullCalculation.xml");
            var    reader   = new TestWaveConditionsCalculationConfigurationReader(filePath, validMainSchemaDefinitions);

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

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

            AssertConfiguration(configuration);
            Assert.IsNull(configuration.TargetProbability);
        }
示例#4
0
        public void Read_ValidConfigurationWithFullCalculation_ReturnExpectedReadWaveConditionsCalculation(string fileName)
        {
            // Setup
            string filePath = Path.Combine(testDirectoryPath, fileName);
            var    reader   = new TestWaveConditionsCalculationConfigurationReader(filePath, validMainSchemaDefinitions);

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

            // Assert
            var configuration = (WaveConditionsCalculationConfiguration)readItems.Single();

            AssertConfiguration(configuration);
            Assert.AreEqual(0.1, configuration.TargetProbability);
        }
示例#5
0
        public void Read_ValidConfigurationWithCalculationContainingEmptyWaveReduction_ReturnExpectedReadWaveConditionsCalculation()
        {
            // Setup
            string filePath = Path.Combine(testDirectoryPath, "validConfigurationCalculationContainingEmptyWaveReduction.xml");
            var    reader   = new TestWaveConditionsCalculationConfigurationReader(filePath, validMainSchemaDefinitions);

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

            // Assert
            var configuration = (WaveConditionsCalculationConfiguration)readItems.Single();

            Assert.IsNotNull(configuration);
            Assert.IsNull(configuration.WaveReduction.UseBreakWater);
            Assert.IsNull(configuration.WaveReduction.BreakWaterType);
            Assert.IsNull(configuration.WaveReduction.BreakWaterHeight);
            Assert.IsNull(configuration.WaveReduction.UseForeshoreProfile);
        }
示例#6
0
        public void Read_ValidConfigurationWithEmptyCalculation_ReturnExpectedReadWaveConditionsInput()
        {
            // Setup
            string filePath = Path.Combine(testDirectoryPath, "validConfigurationEmptyCalculation.xml");
            var    reader   = new TestWaveConditionsCalculationConfigurationReader(filePath, validMainSchemaDefinitions);

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

            // Assert
            var configuration = (WaveConditionsCalculationConfiguration)readItems.Single();

            Assert.IsNotNull(configuration);
            Assert.IsNull(configuration.HydraulicBoundaryLocationName);
            Assert.IsNull(configuration.TargetProbability);
            Assert.IsNull(configuration.UpperBoundaryRevetment);
            Assert.IsNull(configuration.LowerBoundaryRevetment);
            Assert.IsNull(configuration.UpperBoundaryWaterLevels);
            Assert.IsNull(configuration.LowerBoundaryWaterLevels);
            Assert.IsNull(configuration.StepSize);
            Assert.IsNull(configuration.ForeshoreProfileId);
            Assert.IsNull(configuration.Orientation);
            Assert.IsNull(configuration.WaveReduction);
        }