Exemplo n.º 1
0
        public void Constructor_SetProperties_ExpectedValues()
        {
            // Setup
            var    random            = new Random(31);
            double penetrationLength = random.NextDouble();
            double waterLevelPolder  = random.NextDouble();
            bool   useDefaultOffsets = random.NextBoolean();
            double phreaticLineOffsetBelowDikeTopAtRiver     = random.NextDouble();
            double phreaticLineOffsetBelowDikeTopAtPolder    = random.NextDouble();
            double phreaticLineOffsetBelowShoulderBaseInside = random.NextDouble();
            double phreaticLineOffsetBelowDikeToeAtPolder    = random.NextDouble();

            // Call
            var configuration = new MacroStabilityInwardsLocationInputExtremeConfiguration
            {
                PenetrationLength = penetrationLength,
                WaterLevelPolder  = waterLevelPolder,
                UseDefaultOffsets = useDefaultOffsets,
                PhreaticLineOffsetBelowDikeTopAtRiver     = phreaticLineOffsetBelowDikeTopAtRiver,
                PhreaticLineOffsetBelowDikeTopAtPolder    = phreaticLineOffsetBelowDikeTopAtPolder,
                PhreaticLineOffsetBelowShoulderBaseInside = phreaticLineOffsetBelowShoulderBaseInside,
                PhreaticLineOffsetBelowDikeToeAtPolder    = phreaticLineOffsetBelowDikeToeAtPolder
            };

            // Assert
            Assert.AreEqual(penetrationLength, configuration.PenetrationLength);
            Assert.AreEqual(waterLevelPolder, configuration.WaterLevelPolder);
            Assert.AreEqual(useDefaultOffsets, configuration.UseDefaultOffsets);
            Assert.AreEqual(phreaticLineOffsetBelowDikeTopAtRiver, configuration.PhreaticLineOffsetBelowDikeTopAtRiver);
            Assert.AreEqual(phreaticLineOffsetBelowDikeTopAtPolder, configuration.PhreaticLineOffsetBelowDikeTopAtPolder);
            Assert.AreEqual(phreaticLineOffsetBelowShoulderBaseInside, configuration.PhreaticLineOffsetBelowShoulderBaseInside);
            Assert.AreEqual(phreaticLineOffsetBelowDikeToeAtPolder, configuration.PhreaticLineOffsetBelowDikeToeAtPolder);
        }
Exemplo n.º 2
0
        public void GetMacroStabilityInwardsLocationInputExtremeConfiguration_DescendantElementNameNotFound_ReturnNull()
        {
            // Setup
            const string descendantElementName = "differentElementName";

            var element = new XElement("Root", new XElement(descendantElementName));

            // Call
            MacroStabilityInwardsLocationInputExtremeConfiguration configuration = element.GetMacroStabilityInwardsLocationInputExtremeConfiguration();

            // Assert
            Assert.IsNull(configuration);
        }
Exemplo n.º 3
0
        public void Constructor_Always_ExpectedValues()
        {
            // Call
            var configuration = new MacroStabilityInwardsLocationInputExtremeConfiguration();

            // Assert
            Assert.IsInstanceOf <MacroStabilityInwardsLocationInputConfiguration>(configuration);
            Assert.IsNull(configuration.PenetrationLength);
            Assert.IsNull(configuration.WaterLevelPolder);
            Assert.IsNull(configuration.UseDefaultOffsets);
            Assert.IsNull(configuration.PhreaticLineOffsetBelowDikeTopAtRiver);
            Assert.IsNull(configuration.PhreaticLineOffsetBelowDikeTopAtPolder);
            Assert.IsNull(configuration.PhreaticLineOffsetBelowShoulderBaseInside);
            Assert.IsNull(configuration.PhreaticLineOffsetBelowDikeToeAtPolder);
        }
Exemplo n.º 4
0
        public void ToMacroStabilityInwardsLocationInputExtremeConfiguration_ValidMacroStabilityInwardsLocationInputExtreme_ReturnsNewMacroStabilityInwardsLocationInputExtremeConfigurationWithParametersSet()
        {
            // Setup
            var random = new Random(31);

            RoundedDouble penetrationLength = random.NextRoundedDouble();
            bool          useDefaultOffsets = random.NextBoolean();
            RoundedDouble waterLevelPolder  = random.NextRoundedDouble();
            RoundedDouble phreaticLineOffsetBelowDikeTopAtRiver     = random.NextRoundedDouble();
            RoundedDouble phreaticLineOffsetBelowDikeTopAtPolder    = random.NextRoundedDouble();
            RoundedDouble phreaticLineOffsetBelowShoulderBaseInside = random.NextRoundedDouble();
            RoundedDouble phreaticLineOffsetBelowDikeToeAtPolder    = random.NextRoundedDouble();

            var mockRepository = new MockRepository();
            var inputExtreme   = mockRepository.Stub <IMacroStabilityInwardsLocationInputExtreme>();

            inputExtreme.PenetrationLength = penetrationLength;
            inputExtreme.UseDefaultOffsets = useDefaultOffsets;
            inputExtreme.WaterLevelPolder  = waterLevelPolder;
            inputExtreme.PhreaticLineOffsetBelowDikeTopAtRiver     = phreaticLineOffsetBelowDikeTopAtRiver;
            inputExtreme.PhreaticLineOffsetBelowDikeTopAtPolder    = phreaticLineOffsetBelowDikeTopAtPolder;
            inputExtreme.PhreaticLineOffsetBelowShoulderBaseInside = phreaticLineOffsetBelowShoulderBaseInside;
            inputExtreme.PhreaticLineOffsetBelowDikeToeAtPolder    = phreaticLineOffsetBelowDikeToeAtPolder;
            mockRepository.ReplayAll();

            // Call
            MacroStabilityInwardsLocationInputExtremeConfiguration configuration = inputExtreme.ToMacroStabilityInwardsLocationInputExtremeConfiguration();

            // Assert
            Assert.AreEqual(penetrationLength,
                            configuration.PenetrationLength,
                            penetrationLength.GetAccuracy());
            Assert.AreEqual(useDefaultOffsets, configuration.UseDefaultOffsets);
            Assert.AreEqual(phreaticLineOffsetBelowDikeTopAtRiver,
                            configuration.PhreaticLineOffsetBelowDikeTopAtRiver,
                            phreaticLineOffsetBelowDikeTopAtRiver.GetAccuracy());
            Assert.AreEqual(phreaticLineOffsetBelowDikeTopAtPolder,
                            configuration.PhreaticLineOffsetBelowDikeTopAtPolder,
                            phreaticLineOffsetBelowDikeTopAtPolder.GetAccuracy());
            Assert.AreEqual(phreaticLineOffsetBelowShoulderBaseInside,
                            configuration.PhreaticLineOffsetBelowShoulderBaseInside,
                            phreaticLineOffsetBelowShoulderBaseInside.GetAccuracy());
            Assert.AreEqual(phreaticLineOffsetBelowDikeToeAtPolder,
                            configuration.PhreaticLineOffsetBelowDikeToeAtPolder,
                            phreaticLineOffsetBelowDikeToeAtPolder.GetAccuracy());
            mockRepository.VerifyAll();
        }
Exemplo n.º 5
0
        public void GetMacroStabilityInwardsLocationInputExtremeConfiguration_WithoutProperties_ReturnMacroStabilityInwardsLocationInputExtremeConfiguration()
        {
            // Setup
            var element = new XElement("Root", new XElement("extreem"));

            // Call
            MacroStabilityInwardsLocationInputExtremeConfiguration configuration = element.GetMacroStabilityInwardsLocationInputExtremeConfiguration();

            // Assert
            Assert.IsNull(configuration.PenetrationLength);
            Assert.IsNull(configuration.WaterLevelPolder);
            Assert.IsNull(configuration.UseDefaultOffsets);
            Assert.IsNull(configuration.PhreaticLineOffsetBelowDikeTopAtRiver);
            Assert.IsNull(configuration.PhreaticLineOffsetBelowDikeTopAtPolder);
            Assert.IsNull(configuration.PhreaticLineOffsetBelowShoulderBaseInside);
            Assert.IsNull(configuration.PhreaticLineOffsetBelowDikeToeAtPolder);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Configure a new <see cref="MacroStabilityInwardsLocationInputExtremeConfiguration"/> with
        /// values taken from <paramref name="inputExtreme"/>.
        /// </summary>
        /// <param name="inputExtreme">The input to take the values from.</param>
        /// <returns>A new <see cref="MacroStabilityInwardsLocationInputExtremeConfiguration"/>.</returns>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="inputExtreme"/> is <c>null</c>.</exception>
        public static MacroStabilityInwardsLocationInputExtremeConfiguration ToMacroStabilityInwardsLocationInputExtremeConfiguration(
            this IMacroStabilityInwardsLocationInputExtreme inputExtreme)
        {
            if (inputExtreme == null)
            {
                throw new ArgumentNullException(nameof(inputExtreme));
            }

            var configuration = new MacroStabilityInwardsLocationInputExtremeConfiguration
            {
                PenetrationLength = inputExtreme.PenetrationLength
            };

            SetMacroStabilityInwardsLocationInputParameters(configuration, inputExtreme);

            return(configuration);
        }
Exemplo n.º 7
0
        public void GetMacroStabilityInwardsLocationInputExtremeConfiguration_WithPhreaticLineOffsetBelowDikeToeAtPolder_ReturnMacroStabilityInwardsLocationInputExtremeConfiguration()
        {
            // Setup
            var    random = new Random(31);
            double phreaticLineOffsetBelowDikeToeAtPolder = random.NextDouble();

            var element = new XElement("Root", new XElement("extreem", new XElement("teendijkbinnenwaarts", phreaticLineOffsetBelowDikeToeAtPolder)));

            // Call
            MacroStabilityInwardsLocationInputExtremeConfiguration configuration = element.GetMacroStabilityInwardsLocationInputExtremeConfiguration();

            // Assert
            Assert.IsNull(configuration.PenetrationLength);
            Assert.IsNull(configuration.WaterLevelPolder);
            Assert.IsNull(configuration.UseDefaultOffsets);
            Assert.IsNull(configuration.PhreaticLineOffsetBelowDikeTopAtRiver);
            Assert.IsNull(configuration.PhreaticLineOffsetBelowDikeTopAtPolder);
            Assert.IsNull(configuration.PhreaticLineOffsetBelowShoulderBaseInside);
            Assert.AreEqual(phreaticLineOffsetBelowDikeToeAtPolder, configuration.PhreaticLineOffsetBelowDikeToeAtPolder);
        }
Exemplo n.º 8
0
        public void GetMacroStabilityInwardsLocationInputExtremeConfiguration_WithUseDefaultOffsets_ReturnMacroStabilityInwardsLocationInputExtremeConfiguration()
        {
            // Setup
            var  random            = new Random(31);
            bool useDefaultOffsets = random.NextBoolean();

            var element = new XElement("Root", new XElement("extreem", new XElement("gebruikdefaults", useDefaultOffsets)));

            // Call
            MacroStabilityInwardsLocationInputExtremeConfiguration configuration = element.GetMacroStabilityInwardsLocationInputExtremeConfiguration();

            // Assert
            Assert.IsNull(configuration.PenetrationLength);
            Assert.IsNull(configuration.WaterLevelPolder);
            Assert.AreEqual(useDefaultOffsets, configuration.UseDefaultOffsets);
            Assert.IsNull(configuration.PhreaticLineOffsetBelowDikeTopAtRiver);
            Assert.IsNull(configuration.PhreaticLineOffsetBelowDikeTopAtPolder);
            Assert.IsNull(configuration.PhreaticLineOffsetBelowShoulderBaseInside);
            Assert.IsNull(configuration.PhreaticLineOffsetBelowDikeToeAtPolder);
        }
Exemplo n.º 9
0
        public void GetMacroStabilityInwardsLocationInputExtremeConfiguration_ValidDescendantElement_ReturnMacroStabilityInwardsLocationInputExtremeConfiguration()
        {
            // Setup
            var    random            = new Random(31);
            double penetrationLength = random.NextDouble();
            double waterLevelPolder  = random.NextDouble();
            bool   useDefaultOffsets = random.NextBoolean();
            double phreaticLineOffsetBelowDikeTopAtRiver     = random.NextDouble();
            double phreaticLineOffsetBelowDikeTopAtPolder    = random.NextDouble();
            double phreaticLineOffsetBelowShoulderBaseInside = random.NextDouble();
            double phreaticLineOffsetBelowDikeToeAtPolder    = random.NextDouble();

            var penetrationLengthElement = new XElement("indringingslengte", penetrationLength);
            var waterLevelPolderElement  = new XElement("polderpeil", waterLevelPolder);
            var useDefaultOffsetsElement = new XElement("gebruikdefaults", useDefaultOffsets);
            var phreaticLineOffsetBelowDikeTopAtRiverElement     = new XElement("buitenkruin", phreaticLineOffsetBelowDikeTopAtRiver);
            var phreaticLineOffsetBelowDikeTopAtPolderElement    = new XElement("binnenkruin", phreaticLineOffsetBelowDikeTopAtPolder);
            var phreaticLineOffsetBelowShoulderBaseInsideElement = new XElement("insteekbinnenberm", phreaticLineOffsetBelowShoulderBaseInside);
            var phreaticLineOffsetBelowDikeToeAtPolderElement    = new XElement("teendijkbinnenwaarts", phreaticLineOffsetBelowDikeToeAtPolder);

            var element = new XElement("Root", new XElement("extreem",
                                                            penetrationLengthElement,
                                                            waterLevelPolderElement,
                                                            useDefaultOffsetsElement,
                                                            phreaticLineOffsetBelowDikeTopAtRiverElement,
                                                            phreaticLineOffsetBelowDikeTopAtPolderElement,
                                                            phreaticLineOffsetBelowShoulderBaseInsideElement,
                                                            phreaticLineOffsetBelowDikeToeAtPolderElement));

            // Call
            MacroStabilityInwardsLocationInputExtremeConfiguration configuration = element.GetMacroStabilityInwardsLocationInputExtremeConfiguration();

            // Assert
            Assert.AreEqual(penetrationLength, configuration.PenetrationLength);
            Assert.AreEqual(waterLevelPolder, configuration.WaterLevelPolder);
            Assert.AreEqual(useDefaultOffsets, configuration.UseDefaultOffsets);
            Assert.AreEqual(phreaticLineOffsetBelowDikeTopAtRiver, configuration.PhreaticLineOffsetBelowDikeTopAtRiver);
            Assert.AreEqual(phreaticLineOffsetBelowDikeTopAtPolder, configuration.PhreaticLineOffsetBelowDikeTopAtPolder);
            Assert.AreEqual(phreaticLineOffsetBelowShoulderBaseInside, configuration.PhreaticLineOffsetBelowShoulderBaseInside);
            Assert.AreEqual(phreaticLineOffsetBelowDikeToeAtPolder, configuration.PhreaticLineOffsetBelowDikeToeAtPolder);
        }
        private static void AssertConfiguration(MacroStabilityInwardsCalculationConfiguration configuration, bool hydraulicBoundaryLocation)
        {
            Assert.AreEqual("Calculation", configuration.Name);

            if (hydraulicBoundaryLocation)
            {
                Assert.IsNull(configuration.AssessmentLevel);
                Assert.AreEqual("Locatie", configuration.HydraulicBoundaryLocationName);
            }
            else
            {
                Assert.AreEqual(1.1, configuration.AssessmentLevel);
                Assert.IsNull(configuration.HydraulicBoundaryLocationName);
            }

            Assert.AreEqual("Profielschematisatie", configuration.SurfaceLineName);
            Assert.AreEqual("Ondergrondmodel", configuration.StochasticSoilModelName);
            Assert.AreEqual("Ondergrondschematisatie", configuration.StochasticSoilProfileName);

            Assert.AreEqual(ConfigurationDikeSoilScenario.SandDikeOnClay, configuration.DikeSoilScenario);
            Assert.AreEqual(10.5, configuration.WaterLevelRiverAverage);

            Assert.IsTrue(configuration.DrainageConstructionPresent);
            Assert.AreEqual(10.6, configuration.XCoordinateDrainageConstruction);
            Assert.AreEqual(10.7, configuration.ZCoordinateDrainageConstruction);

            Assert.AreEqual(10.9, configuration.MinimumLevelPhreaticLineAtDikeTopRiver);
            Assert.AreEqual(10.8, configuration.MinimumLevelPhreaticLineAtDikeTopPolder);

            Assert.IsTrue(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.AreEqual(10.3, configuration.LeakageLengthInwardsPhreaticLine4);
            Assert.AreEqual(10.4, configuration.LeakageLengthOutwardsPhreaticLine4);

            MacroStabilityInwardsLocationInputConfiguration dailyConfiguration = configuration.LocationInputDaily;

            Assert.IsNotNull(dailyConfiguration);
            Assert.AreEqual(2.2, dailyConfiguration.WaterLevelPolder);
            Assert.IsTrue(dailyConfiguration.UseDefaultOffsets);
            Assert.AreEqual(2.21, dailyConfiguration.PhreaticLineOffsetBelowDikeTopAtRiver);
            Assert.AreEqual(2.24, dailyConfiguration.PhreaticLineOffsetBelowDikeToeAtPolder);
            Assert.AreEqual(2.22, dailyConfiguration.PhreaticLineOffsetBelowDikeTopAtPolder);
            Assert.AreEqual(2.23, dailyConfiguration.PhreaticLineOffsetBelowShoulderBaseInside);

            MacroStabilityInwardsLocationInputExtremeConfiguration extremeConfiguration = configuration.LocationInputExtreme;

            Assert.IsNotNull(extremeConfiguration);
            Assert.AreEqual(15.2, extremeConfiguration.WaterLevelPolder);
            Assert.AreEqual(16.2, extremeConfiguration.PenetrationLength);
            Assert.IsFalse(extremeConfiguration.UseDefaultOffsets);
            Assert.AreEqual(15.21, extremeConfiguration.PhreaticLineOffsetBelowDikeTopAtRiver);
            Assert.AreEqual(15.24, extremeConfiguration.PhreaticLineOffsetBelowDikeToeAtPolder);
            Assert.AreEqual(15.22, extremeConfiguration.PhreaticLineOffsetBelowDikeTopAtPolder);
            Assert.AreEqual(15.23, extremeConfiguration.PhreaticLineOffsetBelowShoulderBaseInside);

            Assert.AreEqual(0.4, configuration.SlipPlaneMinimumDepth);
            Assert.AreEqual(0.5, configuration.SlipPlaneMinimumLength);
            Assert.AreEqual(0.6, configuration.MaximumSliceWidth);

            Assert.IsTrue(configuration.CreateZones);
            Assert.AreEqual(ConfigurationZoningBoundariesDeterminationType.Manual, configuration.ZoningBoundariesDeterminationType);
            Assert.AreEqual(10.0, configuration.ZoneBoundaryLeft);
            Assert.AreEqual(43.5, configuration.ZoneBoundaryRight);

            Assert.IsTrue(configuration.MoveGrid);
            Assert.AreEqual(ConfigurationGridDeterminationType.Automatic, configuration.GridDeterminationType);

            Assert.AreEqual(ConfigurationTangentLineDeterminationType.LayerSeparated, configuration.TangentLineDeterminationType);
            Assert.AreEqual(10, configuration.TangentLineZTop);
            Assert.AreEqual(1, configuration.TangentLineZBottom);
            Assert.AreEqual(5, configuration.TangentLineNumber);

            MacroStabilityInwardsGridConfiguration leftGridConfiguration = configuration.LeftGrid;

            Assert.IsNotNull(leftGridConfiguration);
            Assert.IsNaN(leftGridConfiguration.XLeft);
            Assert.IsNaN(leftGridConfiguration.XRight);
            Assert.IsNaN(leftGridConfiguration.ZTop);
            Assert.IsNaN(leftGridConfiguration.ZBottom);
            Assert.AreEqual(6, leftGridConfiguration.NumberOfVerticalPoints);
            Assert.AreEqual(5, leftGridConfiguration.NumberOfHorizontalPoints);

            MacroStabilityInwardsGridConfiguration rightGridConfiguration = configuration.RightGrid;

            Assert.IsNotNull(rightGridConfiguration);
            Assert.AreEqual(1, rightGridConfiguration.XLeft);
            Assert.AreEqual(2, rightGridConfiguration.XRight);
            Assert.AreEqual(4, rightGridConfiguration.ZTop);
            Assert.AreEqual(3, rightGridConfiguration.ZBottom);
            Assert.AreEqual(5, rightGridConfiguration.NumberOfVerticalPoints);
            Assert.AreEqual(6, rightGridConfiguration.NumberOfHorizontalPoints);

            ScenarioConfiguration scenarioConfiguration = configuration.Scenario;

            Assert.IsNotNull(scenarioConfiguration);
            Assert.AreEqual(8.8, scenarioConfiguration.Contribution);
            Assert.IsFalse(scenarioConfiguration.IsRelevant);
        }