public void Read_ValidConfigurationWithEmptyCalculation_ReturnExpectedReadMacroStabilityInwardsCalculation()
        {
            // Setup
            string filePath = Path.Combine(testDirectoryPath, "validConfigurationEmptyCalculation.xml");
            var    reader   = new MacroStabilityInwardsCalculationConfigurationReader(filePath);

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

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

            Assert.AreEqual("Calculation", configuration.Name);
            Assert.IsNull(configuration.AssessmentLevel);
            Assert.IsNull(configuration.HydraulicBoundaryLocationName);
            Assert.IsNull(configuration.SurfaceLineName);
            Assert.IsNull(configuration.StochasticSoilModelName);
            Assert.IsNull(configuration.StochasticSoilProfileName);
            Assert.IsNull(configuration.Scenario);
            Assert.IsNull(configuration.DikeSoilScenario);
            Assert.IsNull(configuration.WaterLevelRiverAverage);
            Assert.IsNull(configuration.DrainageConstructionPresent);
            Assert.IsNull(configuration.XCoordinateDrainageConstruction);
            Assert.IsNull(configuration.ZCoordinateDrainageConstruction);
            Assert.IsNull(configuration.MinimumLevelPhreaticLineAtDikeTopRiver);
            Assert.IsNull(configuration.MinimumLevelPhreaticLineAtDikeTopPolder);
            Assert.IsNull(configuration.AdjustPhreaticLine3And4ForUplift);
            Assert.IsNull(configuration.PiezometricHeadPhreaticLine2Inwards);
            Assert.IsNull(configuration.PiezometricHeadPhreaticLine2Outwards);
            Assert.IsNull(configuration.LeakageLengthInwardsPhreaticLine3);
            Assert.IsNull(configuration.LeakageLengthOutwardsPhreaticLine3);
            Assert.IsNull(configuration.LeakageLengthInwardsPhreaticLine4);
            Assert.IsNull(configuration.LeakageLengthOutwardsPhreaticLine4);
            Assert.IsNull(configuration.LocationInputDaily);
            Assert.IsNull(configuration.LocationInputExtreme);
            Assert.IsNull(configuration.SlipPlaneMinimumDepth);
            Assert.IsNull(configuration.SlipPlaneMinimumLength);
            Assert.IsNull(configuration.MaximumSliceWidth);
            Assert.IsNull(configuration.CreateZones);
            Assert.IsNull(configuration.ZoningBoundariesDeterminationType);
            Assert.IsNull(configuration.ZoneBoundaryLeft);
            Assert.IsNull(configuration.ZoneBoundaryRight);
            Assert.IsNull(configuration.GridDeterminationType);
            Assert.IsNull(configuration.MoveGrid);
            Assert.IsNull(configuration.TangentLineDeterminationType);
            Assert.IsNull(configuration.TangentLineZTop);
            Assert.IsNull(configuration.TangentLineZBottom);
            Assert.IsNull(configuration.TangentLineNumber);
            Assert.IsNull(configuration.LeftGrid);
            Assert.IsNull(configuration.RightGrid);
        }
        public void Read_ValidConfigurationWithCalculationContainingInfinities_ReturnExpectedReadMacroStabilityInwardsCalculation()
        {
            // Setup
            string filePath = Path.Combine(testDirectoryPath, "validConfigurationCalculationContainingInfinities.xml");
            var    reader   = new MacroStabilityInwardsCalculationConfigurationReader(filePath);

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

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

            Assert.IsNotNull(configuration.AssessmentLevel);

            Assert.IsTrue(double.IsNegativeInfinity(configuration.AssessmentLevel.Value));
            Assert.IsTrue(double.IsPositiveInfinity(configuration.WaterLevelRiverAverage.Value));
            Assert.IsTrue(double.IsPositiveInfinity(configuration.XCoordinateDrainageConstruction.Value));
            Assert.IsTrue(double.IsPositiveInfinity(configuration.ZCoordinateDrainageConstruction.Value));
            Assert.IsTrue(double.IsPositiveInfinity(configuration.MinimumLevelPhreaticLineAtDikeTopRiver.Value));
            Assert.IsTrue(double.IsPositiveInfinity(configuration.MinimumLevelPhreaticLineAtDikeTopPolder.Value));
            Assert.IsTrue(double.IsPositiveInfinity(configuration.PiezometricHeadPhreaticLine2Inwards.Value));
            Assert.IsTrue(double.IsPositiveInfinity(configuration.PiezometricHeadPhreaticLine2Outwards.Value));
            Assert.IsTrue(double.IsPositiveInfinity(configuration.LeakageLengthInwardsPhreaticLine3.Value));
            Assert.IsTrue(double.IsPositiveInfinity(configuration.LeakageLengthOutwardsPhreaticLine3.Value));
            Assert.IsTrue(double.IsPositiveInfinity(configuration.LeakageLengthInwardsPhreaticLine4.Value));
            Assert.IsTrue(double.IsPositiveInfinity(configuration.LeakageLengthOutwardsPhreaticLine4.Value));
            Assert.IsTrue(double.IsPositiveInfinity(configuration.LocationInputDaily.WaterLevelPolder.Value));
            Assert.IsTrue(double.IsPositiveInfinity(configuration.LocationInputDaily.PhreaticLineOffsetBelowDikeTopAtRiver.Value));
            Assert.IsTrue(double.IsPositiveInfinity(configuration.LocationInputDaily.PhreaticLineOffsetBelowDikeToeAtPolder.Value));
            Assert.IsTrue(double.IsPositiveInfinity(configuration.LocationInputDaily.PhreaticLineOffsetBelowDikeTopAtPolder.Value));
            Assert.IsTrue(double.IsPositiveInfinity(configuration.LocationInputDaily.PhreaticLineOffsetBelowShoulderBaseInside.Value));
            Assert.IsTrue(double.IsPositiveInfinity(configuration.LocationInputExtreme.PenetrationLength.Value));
            Assert.IsTrue(double.IsPositiveInfinity(configuration.LocationInputExtreme.WaterLevelPolder.Value));
            Assert.IsTrue(double.IsPositiveInfinity(configuration.LocationInputExtreme.PhreaticLineOffsetBelowDikeTopAtRiver.Value));
            Assert.IsTrue(double.IsPositiveInfinity(configuration.LocationInputExtreme.PhreaticLineOffsetBelowDikeToeAtPolder.Value));
            Assert.IsTrue(double.IsPositiveInfinity(configuration.LocationInputExtreme.PhreaticLineOffsetBelowDikeTopAtPolder.Value));
            Assert.IsTrue(double.IsPositiveInfinity(configuration.LocationInputExtreme.PhreaticLineOffsetBelowShoulderBaseInside.Value));
            Assert.IsTrue(double.IsPositiveInfinity(configuration.SlipPlaneMinimumDepth.Value));
            Assert.IsTrue(double.IsPositiveInfinity(configuration.SlipPlaneMinimumLength.Value));
            Assert.IsTrue(double.IsPositiveInfinity(configuration.MaximumSliceWidth.Value));
            Assert.IsTrue(double.IsPositiveInfinity(configuration.TangentLineZTop.Value));
            Assert.IsTrue(double.IsPositiveInfinity(configuration.TangentLineZBottom.Value));
            Assert.IsTrue(double.IsPositiveInfinity(configuration.LeftGrid.XLeft.Value));
            Assert.IsTrue(double.IsPositiveInfinity(configuration.LeftGrid.XRight.Value));
            Assert.IsTrue(double.IsPositiveInfinity(configuration.LeftGrid.ZTop.Value));
            Assert.IsTrue(double.IsPositiveInfinity(configuration.LeftGrid.ZBottom.Value));
            Assert.IsTrue(double.IsNegativeInfinity(configuration.RightGrid.XLeft.Value));
            Assert.IsTrue(double.IsNegativeInfinity(configuration.RightGrid.XRight.Value));
            Assert.IsTrue(double.IsNegativeInfinity(configuration.RightGrid.ZTop.Value));
            Assert.IsTrue(double.IsNegativeInfinity(configuration.RightGrid.ZBottom.Value));
        }
        public void Read_ValidConfigurationWithPartialCalculation_ReturnExpectedReadMacroStabilityInwardsCalculation()
        {
            // Setup
            string filePath = Path.Combine(testDirectoryPath, "validConfigurationPartialCalculation.xml");
            var    reader   = new MacroStabilityInwardsCalculationConfigurationReader(filePath);

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

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

            Assert.AreEqual("Calculation", configuration.Name);
            Assert.IsNull(configuration.AssessmentLevel);
            Assert.IsNull(configuration.HydraulicBoundaryLocationName);
            Assert.IsNull(configuration.SurfaceLineName);
            Assert.IsNull(configuration.StochasticSoilModelName);
            Assert.AreEqual("Ondergrondschematisatie", configuration.StochasticSoilProfileName);

            Assert.IsNull(configuration.Scenario);
            Assert.AreEqual(10.5, configuration.WaterLevelRiverAverage);
            Assert.AreEqual(10.6, configuration.XCoordinateDrainageConstruction);
            Assert.IsNull(configuration.ZCoordinateDrainageConstruction);
            Assert.AreEqual(10.9, configuration.MinimumLevelPhreaticLineAtDikeTopRiver);
            Assert.IsNull(configuration.MinimumLevelPhreaticLineAtDikeTopPolder);
            Assert.IsNull(configuration.AdjustPhreaticLine3And4ForUplift);
            Assert.AreEqual(20.1, configuration.PiezometricHeadPhreaticLine2Inwards);
            Assert.AreEqual(20.2, configuration.PiezometricHeadPhreaticLine2Outwards);
            Assert.AreEqual(10.1, configuration.LeakageLengthInwardsPhreaticLine3);
            Assert.AreEqual(10.2, configuration.LeakageLengthOutwardsPhreaticLine3);
            Assert.IsNull(configuration.LeakageLengthInwardsPhreaticLine4);
            Assert.IsNull(configuration.LeakageLengthOutwardsPhreaticLine4);
            Assert.IsNaN(configuration.LocationInputDaily.WaterLevelPolder);
            Assert.AreEqual(2.21, configuration.LocationInputDaily.PhreaticLineOffsetBelowDikeTopAtRiver);
            Assert.AreEqual(2.24, configuration.LocationInputDaily.PhreaticLineOffsetBelowDikeToeAtPolder);
            Assert.AreEqual(2.22, configuration.LocationInputDaily.PhreaticLineOffsetBelowDikeTopAtPolder);
            Assert.AreEqual(2.23, configuration.LocationInputDaily.PhreaticLineOffsetBelowShoulderBaseInside);
            Assert.IsNull(configuration.LocationInputExtreme);
            Assert.IsNull(configuration.MaximumSliceWidth);
            Assert.IsNull(configuration.SlipPlaneMinimumLength);
            Assert.AreEqual(0.4, configuration.SlipPlaneMinimumDepth);
            Assert.AreEqual(10, configuration.TangentLineZTop);
            Assert.AreEqual(1, configuration.TangentLineZBottom);
            Assert.AreEqual(5, configuration.TangentLineNumber);
            Assert.IsNaN(configuration.LeftGrid.XLeft);
            Assert.IsNaN(configuration.LeftGrid.XRight);
            Assert.IsNaN(configuration.LeftGrid.ZTop);
            Assert.IsNaN(configuration.LeftGrid.ZBottom);
            Assert.IsNull(configuration.RightGrid);
        }
        public void Read_ValidPreviousVersionConfigurationWithFullCalculation_ReturnExpectedReadMacroStabilityInwardsCalculation(string fileName, bool hydraulicBoundaryLocation)
        {
            // Setup
            string filePath = Path.Combine(testDirectoryPath, $"{fileName}.xml");
            var    reader   = new MacroStabilityInwardsCalculationConfigurationReader(filePath);

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

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

            AssertConfiguration(configuration, hydraulicBoundaryLocation);
        }
        public void Read_ValidPreviousVersionConfigurationWithScenarioContribution_ReturnExpectedReadMacroStabilityInwardsCalculation(
            string fileName, double expectedScenarioContribution)
        {
            // Setup
            string filePath = Path.Combine(testDirectoryPath, $"{fileName}.xml");
            var    reader   = new MacroStabilityInwardsCalculationConfigurationReader(filePath);

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

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

            Assert.AreEqual(expectedScenarioContribution, configuration.Scenario.Contribution);
        }