public void CreateDaily_WithInput_ReturnWaternetCreatorInput([Values(true, false)] bool drainageConstructionPresent,
                                                                     [Values(true, false)] bool useDefaultOffsets)
        {
            // Setup
            var random = new Random(21);
            DrainageConstruction drainageConstruction = drainageConstructionPresent
                                                            ? new DrainageConstruction(random.Next(), random.Next())
                                                            : new DrainageConstruction();
            PhreaticLineOffsets phreaticLineOffsets = useDefaultOffsets
                                                          ? new PhreaticLineOffsets()
                                                          : new PhreaticLineOffsets(random.Next(), random.Next(),
                                                                                    random.Next(), random.Next());

            var input = new UpliftVanCalculatorInput(
                new UpliftVanCalculatorInput.ConstructionProperties
            {
                SurfaceLine                             = new MacroStabilityInwardsSurfaceLine("test"),
                SoilProfile                             = new TestSoilProfile(),
                SlipPlane                               = new UpliftVanSlipPlane(),
                DikeSoilScenario                        = MacroStabilityInwardsDikeSoilScenario.SandDikeOnClay,
                AssessmentLevel                         = random.NextDouble(),
                WaterLevelRiverAverage                  = random.NextDouble(),
                WaterLevelPolderDaily                   = random.NextDouble(),
                DrainageConstruction                    = drainageConstruction,
                PhreaticLineOffsetsExtreme              = new PhreaticLineOffsets(),
                PhreaticLineOffsetsDaily                = phreaticLineOffsets,
                MinimumLevelPhreaticLineAtDikeTopRiver  = random.NextDouble(),
                MinimumLevelPhreaticLineAtDikeTopPolder = random.NextDouble(),
                AdjustPhreaticLine3And4ForUplift        = random.NextBoolean(),
                LeakageLengthOutwardsPhreaticLine3      = random.NextDouble(),
                LeakageLengthInwardsPhreaticLine3       = random.NextDouble(),
                LeakageLengthOutwardsPhreaticLine4      = random.NextDouble(),
                LeakageLengthInwardsPhreaticLine4       = random.NextDouble(),
                PiezometricHeadPhreaticLine2Outwards    = random.NextDouble(),
                PiezometricHeadPhreaticLine2Inwards     = random.NextDouble(),
                PenetrationLengthDaily                  = random.NextDouble()
            });

            // Call
            WaternetCreatorInput waternetCreatorInput = UpliftVanWaternetCreatorInputCreator.CreateDaily(input);

            // Assert
            Assert.AreEqual(input.WaterLevelRiverAverage, waternetCreatorInput.HeadInPlLine3);
            Assert.AreEqual(input.WaterLevelRiverAverage, waternetCreatorInput.HeadInPlLine4);
            Assert.AreEqual(input.WaterLevelRiverAverage, waternetCreatorInput.WaterLevelRiver);
            Assert.AreEqual(input.WaterLevelPolderDaily, waternetCreatorInput.WaterLevelPolder);
            Assert.AreEqual(input.PhreaticLineOffsetsDaily.UseDefaults, waternetCreatorInput.UseDefaultOffsets);
            Assert.AreEqual(input.PhreaticLineOffsetsDaily.BelowDikeTopAtRiver, waternetCreatorInput.PlLineOffsetBelowPointBRingtoetsWti2017);
            Assert.AreEqual(input.PhreaticLineOffsetsDaily.BelowDikeTopAtPolder, waternetCreatorInput.PlLineOffsetBelowDikeTopAtPolder);
            Assert.AreEqual(input.PhreaticLineOffsetsDaily.BelowShoulderBaseInside, waternetCreatorInput.PlLineOffsetBelowShoulderBaseInside);
            Assert.AreEqual(input.PhreaticLineOffsetsDaily.BelowDikeToeAtPolder, waternetCreatorInput.PlLineOffsetBelowDikeToeAtPolder);
            Assert.AreEqual(input.PenetrationLengthDaily, waternetCreatorInput.PenetrationLength);

            AssertGeneralWaternetCreatorInputValues(input, waternetCreatorInput);
            AssertIrrelevantValues(waternetCreatorInput);
        }
Пример #2
0
        public void ParameterlessConstructor_ExpectedValues()
        {
            // Call
            var drainageConstruction = new DrainageConstruction();

            // Assert
            Assert.IsFalse(drainageConstruction.IsPresent);
            Assert.IsNaN(drainageConstruction.XCoordinate);
            Assert.IsNaN(drainageConstruction.ZCoordinate);
        }
Пример #3
0
        public void ParameteredConstructor_ExpectedValues()
        {
            // Setup
            var    random      = new Random(21);
            double xCoordinate = random.NextDouble();
            double zCoordinate = random.NextDouble();

            // Call
            var drainageConstruction = new DrainageConstruction(xCoordinate, zCoordinate);

            // Assert
            Assert.IsTrue(drainageConstruction.IsPresent);
            Assert.AreEqual(xCoordinate, drainageConstruction.XCoordinate);
            Assert.AreEqual(zCoordinate, drainageConstruction.ZCoordinate);
        }
        public void Constructor_EmptyConstructionProperties_ExpectedValues()
        {
            // Setup
            var surfaceLine          = new MacroStabilityInwardsSurfaceLine(string.Empty);
            var soilProfile          = new TestSoilProfile();
            var drainageConstruction = new DrainageConstruction();
            var phreaticLineOffsets  = new PhreaticLineOffsets();
            var slipPlane            = new UpliftVanSlipPlane();
            var slipPlaneConstraints = new UpliftVanSlipPlaneConstraints(double.NaN, double.NaN);

            // Call
            var input = new UpliftVanCalculatorInput(
                new UpliftVanCalculatorInput.ConstructionProperties
            {
                SurfaceLine                = surfaceLine,
                SoilProfile                = soilProfile,
                DrainageConstruction       = drainageConstruction,
                PhreaticLineOffsetsExtreme = phreaticLineOffsets,
                PhreaticLineOffsetsDaily   = phreaticLineOffsets,
                SlipPlane            = slipPlane,
                SlipPlaneConstraints = slipPlaneConstraints
            });

            // Assert
            Assert.IsNaN(input.AssessmentLevel);
            Assert.IsNaN(input.WaterLevelRiverAverage);
            Assert.IsNaN(input.WaterLevelPolderExtreme);
            Assert.IsNaN(input.WaterLevelPolderDaily);
            Assert.IsNaN(input.MinimumLevelPhreaticLineAtDikeTopRiver);
            Assert.IsNaN(input.MinimumLevelPhreaticLineAtDikeTopPolder);
            Assert.IsNaN(input.LeakageLengthOutwardsPhreaticLine3);
            Assert.IsNaN(input.LeakageLengthInwardsPhreaticLine3);
            Assert.IsNaN(input.LeakageLengthOutwardsPhreaticLine4);
            Assert.IsNaN(input.LeakageLengthInwardsPhreaticLine4);
            Assert.IsNaN(input.PiezometricHeadPhreaticLine2Outwards);
            Assert.IsNaN(input.PiezometricHeadPhreaticLine2Inwards);
            Assert.IsNaN(input.PenetrationLengthDaily);
            Assert.IsNaN(input.PenetrationLengthExtreme);
            Assert.IsNaN(input.MaximumSliceWidth);
            Assert.IsNaN(input.WaterVolumetricWeight);

            Assert.IsFalse(input.AdjustPhreaticLine3And4ForUplift);
            Assert.IsFalse(input.MoveGrid);

            Assert.AreEqual(MacroStabilityInwardsDikeSoilScenario.ClayDikeOnClay, input.DikeSoilScenario);
        }
Пример #5
0
        public void Convert_ClayDikeAndDrainageConstructionPresentTrue_ReturnDrainageConstruction(MacroStabilityInwardsDikeSoilScenario soilScenario)
        {
            // Setup
            var random = new Random(21);
            var input  = new MacroStabilityInwardsInput(new MacroStabilityInwardsInput.ConstructionProperties())
            {
                DrainageConstructionPresent     = true,
                XCoordinateDrainageConstruction = random.NextRoundedDouble(),
                ZCoordinateDrainageConstruction = random.NextRoundedDouble(),
                DikeSoilScenario = soilScenario
            };

            // Call
            DrainageConstruction drainageConstruction = DrainageConstructionConverter.Convert(input);

            // Assert
            Assert.IsFalse(drainageConstruction.IsPresent);
            Assert.IsNaN(drainageConstruction.XCoordinate);
            Assert.IsNaN(drainageConstruction.ZCoordinate);
        }
Пример #6
0
        public void Constructor_WithConstructionProperties_PropertiesAreSet()
        {
            // Setup
            var random = new Random(11);

            double assessmentLevel      = random.NextDouble();
            var    surfaceLine          = new MacroStabilityInwardsSurfaceLine(string.Empty);
            var    soilProfile          = new TestSoilProfile();
            var    drainageConstruction = new DrainageConstruction();
            var    phreaticLineOffsets  = new PhreaticLineOffsets();

            double waterLevelRiverAverage = random.NextDouble();
            double waterLevelPolder       = random.NextDouble();
            double minimumLevelPhreaticLineAtDikeTopRiver  = random.NextDouble();
            double minimumLevelPhreaticLineAtDikeTopPolder = random.NextDouble();
            double leakageLengthOutwardsPhreaticLine3      = random.NextDouble();
            double leakageLengthInwardsPhreaticLine3       = random.NextDouble();
            double leakageLengthOutwardsPhreaticLine4      = random.NextDouble();
            double leakageLengthInwardsPhreaticLine4       = random.NextDouble();
            double piezometricHeadPhreaticLine2Outwards    = random.NextDouble();
            double piezometricHeadPhreaticLine2Inwards     = random.NextDouble();
            double penetrationLength = random.NextDouble();
            bool   adjustPhreaticLine3And4ForUplift = random.NextBoolean();
            var    dikeSoilScenario      = random.NextEnumValue <MacroStabilityInwardsDikeSoilScenario>();
            double waterVolumetricWeight = random.NextDouble();

            // Call
            var input = new WaternetCalculatorInput(
                new WaternetCalculatorInput.ConstructionProperties
            {
                AssessmentLevel        = assessmentLevel,
                SurfaceLine            = surfaceLine,
                SoilProfile            = soilProfile,
                DrainageConstruction   = drainageConstruction,
                PhreaticLineOffsets    = phreaticLineOffsets,
                WaterLevelRiverAverage = waterLevelRiverAverage,
                WaterLevelPolder       = waterLevelPolder,
                MinimumLevelPhreaticLineAtDikeTopRiver  = minimumLevelPhreaticLineAtDikeTopRiver,
                MinimumLevelPhreaticLineAtDikeTopPolder = minimumLevelPhreaticLineAtDikeTopPolder,
                LeakageLengthOutwardsPhreaticLine3      = leakageLengthOutwardsPhreaticLine3,
                LeakageLengthInwardsPhreaticLine3       = leakageLengthInwardsPhreaticLine3,
                LeakageLengthOutwardsPhreaticLine4      = leakageLengthOutwardsPhreaticLine4,
                LeakageLengthInwardsPhreaticLine4       = leakageLengthInwardsPhreaticLine4,
                PiezometricHeadPhreaticLine2Outwards    = piezometricHeadPhreaticLine2Outwards,
                PiezometricHeadPhreaticLine2Inwards     = piezometricHeadPhreaticLine2Inwards,
                PenetrationLength = penetrationLength,
                AdjustPhreaticLine3And4ForUplift = adjustPhreaticLine3And4ForUplift,
                DikeSoilScenario      = dikeSoilScenario,
                WaterVolumetricWeight = waterVolumetricWeight
            });

            // Assert
            Assert.AreEqual(assessmentLevel, input.AssessmentLevel);
            Assert.AreSame(surfaceLine, input.SurfaceLine);
            Assert.AreSame(soilProfile, input.SoilProfile);
            Assert.AreSame(drainageConstruction, input.DrainageConstruction);
            Assert.AreSame(phreaticLineOffsets, input.PhreaticLineOffsets);

            Assert.AreEqual(waterLevelRiverAverage, input.WaterLevelRiverAverage);
            Assert.AreEqual(waterLevelPolder, input.WaterLevelPolder);
            Assert.AreEqual(minimumLevelPhreaticLineAtDikeTopRiver, input.MinimumLevelPhreaticLineAtDikeTopRiver);
            Assert.AreEqual(minimumLevelPhreaticLineAtDikeTopPolder, input.MinimumLevelPhreaticLineAtDikeTopPolder);
            Assert.AreEqual(leakageLengthOutwardsPhreaticLine3, input.LeakageLengthOutwardsPhreaticLine3);
            Assert.AreEqual(leakageLengthInwardsPhreaticLine3, input.LeakageLengthInwardsPhreaticLine3);
            Assert.AreEqual(leakageLengthOutwardsPhreaticLine4, input.LeakageLengthOutwardsPhreaticLine4);
            Assert.AreEqual(leakageLengthInwardsPhreaticLine4, input.LeakageLengthInwardsPhreaticLine4);
            Assert.AreEqual(piezometricHeadPhreaticLine2Outwards, input.PiezometricHeadPhreaticLine2Outwards);
            Assert.AreEqual(piezometricHeadPhreaticLine2Inwards, input.PiezometricHeadPhreaticLine2Inwards);
            Assert.AreEqual(penetrationLength, input.PenetrationLength);
            Assert.AreEqual(adjustPhreaticLine3And4ForUplift, input.AdjustPhreaticLine3And4ForUplift);

            Assert.AreEqual(dikeSoilScenario, input.DikeSoilScenario);
            Assert.AreEqual(waterVolumetricWeight, input.WaterVolumetricWeight);
        }
Пример #7
0
 /// <summary>
 /// Asserts whether <paramref name="original"/> corresponds to <paramref name="original"/>.
 /// </summary>
 /// <param name="original">The original <see cref="IMacroStabilityInwardsWaternetInput"/>.</param>
 /// <param name="actual">The actual <see cref="DrainageConstruction"/>.</param>
 /// <exception cref="AssertionException">Thrown when <paramref name="original"/>
 /// does not correspond to <paramref name="original"/>.</exception>
 public static void AssertDrainageConstruction(IMacroStabilityInwardsWaternetInput original, DrainageConstruction actual)
 {
     Assert.AreEqual(original.DrainageConstructionPresent, actual.IsPresent);
     Assert.AreEqual(original.XCoordinateDrainageConstruction, actual.XCoordinate);
     Assert.AreEqual(original.ZCoordinateDrainageConstruction, actual.ZCoordinate);
 }
Пример #8
0
        public void Create_WithInput_ReturnWaternetCreatorInput([Values(true, false)] bool drainageConstructionPresent,
                                                                [Values(true, false)] bool useDefaultOffsets)
        {
            // Setup
            var    random                  = new Random(21);
            double assessmentLevel         = random.Next();
            double waterLevelRiverAverage  = random.Next();
            double waterLevelPolderExtreme = random.Next();
            double minimumLevelPhreaticLineAtDikeTopRiver  = random.Next();
            double minimumLevelPhreaticLineAtDikeTopPolder = random.Next();
            bool   adjustPhreaticLine3And4ForUplift        = random.NextBoolean();
            double leakageLengthOutwardsPhreaticLine3      = random.Next();
            double leakageLengthInwardsPhreaticLine3       = random.Next();
            double leakageLengthOutwardsPhreaticLine4      = random.Next();
            double leakageLengthInwardsPhreaticLine4       = random.Next();
            double piezometricHeadPhreaticLine2Outwards    = random.Next();
            double piezometricHeadPhreaticLine2Inwards     = random.Next();
            double penetrationLength     = random.Next();
            double waterVolumetricWeight = random.Next();

            DrainageConstruction drainageConstruction = drainageConstructionPresent
                                                            ? new DrainageConstruction(random.Next(), random.Next())
                                                            : new DrainageConstruction();
            PhreaticLineOffsets phreaticLineOffsets = useDefaultOffsets
                                                          ? new PhreaticLineOffsets()
                                                          : new PhreaticLineOffsets(random.Next(), random.Next(),
                                                                                    random.Next(), random.Next());

            var input = new WaternetCalculatorInput(
                new WaternetCalculatorInput.ConstructionProperties
            {
                SurfaceLine            = new MacroStabilityInwardsSurfaceLine("test"),
                SoilProfile            = new TestSoilProfile(),
                DikeSoilScenario       = MacroStabilityInwardsDikeSoilScenario.SandDikeOnClay,
                AssessmentLevel        = assessmentLevel,
                WaterLevelRiverAverage = waterLevelRiverAverage,
                WaterLevelPolder       = waterLevelPolderExtreme,
                DrainageConstruction   = drainageConstruction,
                PhreaticLineOffsets    = phreaticLineOffsets,
                MinimumLevelPhreaticLineAtDikeTopRiver  = minimumLevelPhreaticLineAtDikeTopRiver,
                MinimumLevelPhreaticLineAtDikeTopPolder = minimumLevelPhreaticLineAtDikeTopPolder,
                AdjustPhreaticLine3And4ForUplift        = adjustPhreaticLine3And4ForUplift,
                LeakageLengthOutwardsPhreaticLine3      = leakageLengthOutwardsPhreaticLine3,
                LeakageLengthInwardsPhreaticLine3       = leakageLengthInwardsPhreaticLine3,
                LeakageLengthOutwardsPhreaticLine4      = leakageLengthOutwardsPhreaticLine4,
                LeakageLengthInwardsPhreaticLine4       = leakageLengthInwardsPhreaticLine4,
                PiezometricHeadPhreaticLine2Outwards    = piezometricHeadPhreaticLine2Outwards,
                PiezometricHeadPhreaticLine2Inwards     = piezometricHeadPhreaticLine2Inwards,
                PenetrationLength     = penetrationLength,
                WaterVolumetricWeight = waterVolumetricWeight
            });

            // Call
            WaternetCreatorInput waternetCreatorInput = WaternetCreatorInputCreator.Create(input);

            // Assert
            Assert.AreEqual(DikeSoilScenario.SandDikeOnClay, waternetCreatorInput.DikeSoilScenario);
            Assert.AreEqual(assessmentLevel, waternetCreatorInput.WaterLevelRiver);
            Assert.AreEqual(assessmentLevel, waternetCreatorInput.HeadInPlLine3);
            Assert.AreEqual(assessmentLevel, waternetCreatorInput.HeadInPlLine4);
            Assert.AreEqual(waterLevelRiverAverage, waternetCreatorInput.WaterLevelRiverAverage);
            Assert.AreEqual(waterLevelPolderExtreme, waternetCreatorInput.WaterLevelPolder);
            Assert.AreEqual(drainageConstruction.IsPresent, waternetCreatorInput.DrainageConstructionPresent);
            if (drainageConstructionPresent)
            {
                Assert.AreEqual(drainageConstruction.XCoordinate, waternetCreatorInput.DrainageConstruction.X);
                Assert.AreEqual(drainageConstruction.ZCoordinate, waternetCreatorInput.DrainageConstruction.Z);
            }

            Assert.AreEqual(minimumLevelPhreaticLineAtDikeTopRiver, waternetCreatorInput.MinimumLevelPhreaticLineAtDikeTopRiver);
            Assert.AreEqual(minimumLevelPhreaticLineAtDikeTopPolder, waternetCreatorInput.MinimumLevelPhreaticLineAtDikeTopPolder);
            Assert.AreEqual(phreaticLineOffsets.UseDefaults, waternetCreatorInput.UseDefaultOffsets);
            Assert.AreEqual(phreaticLineOffsets.BelowDikeTopAtRiver, waternetCreatorInput.PlLineOffsetBelowPointBRingtoetsWti2017);
            Assert.AreEqual(phreaticLineOffsets.BelowDikeTopAtPolder, waternetCreatorInput.PlLineOffsetBelowDikeTopAtPolder);
            Assert.AreEqual(phreaticLineOffsets.BelowShoulderBaseInside, waternetCreatorInput.PlLineOffsetBelowShoulderBaseInside);
            Assert.AreEqual(phreaticLineOffsets.BelowDikeToeAtPolder, waternetCreatorInput.PlLineOffsetBelowDikeToeAtPolder);
            Assert.AreEqual(adjustPhreaticLine3And4ForUplift, waternetCreatorInput.AdjustPl3And4ForUplift);
            Assert.AreEqual(leakageLengthOutwardsPhreaticLine3, waternetCreatorInput.LeakageLengthOutwardsPl3);
            Assert.AreEqual(leakageLengthInwardsPhreaticLine3, waternetCreatorInput.LeakageLengthInwardsPl3);
            Assert.AreEqual(leakageLengthOutwardsPhreaticLine4, waternetCreatorInput.LeakageLengthOutwardsPl4);
            Assert.AreEqual(leakageLengthInwardsPhreaticLine4, waternetCreatorInput.LeakageLengthInwardsPl4);
            Assert.AreEqual(piezometricHeadPhreaticLine2Outwards, waternetCreatorInput.HeadInPlLine2Outwards);
            Assert.AreEqual(piezometricHeadPhreaticLine2Inwards, waternetCreatorInput.HeadInPlLine2Inwards);
            Assert.AreEqual(penetrationLength, waternetCreatorInput.PenetrationLength);
            Assert.AreEqual(waterVolumetricWeight, waternetCreatorInput.UnitWeightWater);

            AssertIrrelevantValues(waternetCreatorInput);
        }