コード例 #1
0
        public void Convert_UseDefaultOffsetsFalse_ReturnPhreaticLineOffsets()
        {
            // Setup
            var random         = new Random(11);
            var mockRepository = new MockRepository();
            var input          = mockRepository.Stub <IMacroStabilityInwardsLocationInput>();

            mockRepository.ReplayAll();

            input.UseDefaultOffsets = false;
            input.PhreaticLineOffsetBelowDikeTopAtRiver     = random.NextRoundedDouble();
            input.PhreaticLineOffsetBelowDikeTopAtPolder    = random.NextRoundedDouble();
            input.PhreaticLineOffsetBelowDikeToeAtPolder    = random.NextRoundedDouble();
            input.PhreaticLineOffsetBelowShoulderBaseInside = random.NextRoundedDouble();

            // Call
            PhreaticLineOffsets offsets = PhreaticLineOffsetsConverter.Convert(input);

            // Assert
            Assert.IsFalse(offsets.UseDefaults);
            Assert.AreEqual(input.PhreaticLineOffsetBelowDikeTopAtRiver, offsets.BelowDikeTopAtRiver);
            Assert.AreEqual(input.PhreaticLineOffsetBelowDikeTopAtPolder, offsets.BelowDikeTopAtPolder);
            Assert.AreEqual(input.PhreaticLineOffsetBelowDikeToeAtPolder, offsets.BelowDikeToeAtPolder);
            Assert.AreEqual(input.PhreaticLineOffsetBelowShoulderBaseInside, offsets.BelowShoulderBaseInside);

            mockRepository.VerifyAll();
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        public void ParameterlessConstructor_ExpectedValues()
        {
            // Call
            var offsets = new PhreaticLineOffsets();

            // Assert
            Assert.IsTrue(offsets.UseDefaults);
            Assert.IsNaN(offsets.BelowDikeTopAtRiver);
            Assert.IsNaN(offsets.BelowDikeTopAtPolder);
            Assert.IsNaN(offsets.BelowDikeToeAtPolder);
            Assert.IsNaN(offsets.BelowShoulderBaseInside);
        }
コード例 #4
0
        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 ParameteredConstructor_ExpectedValues()
        {
            // Setup
            var    random = new Random(11);
            double belowDikeTopAtRiver     = random.NextDouble();
            double belowDikeTopAtPolder    = random.NextDouble();
            double belowDikeToeAtPolder    = random.NextDouble();
            double belowShoulderBaseInside = random.NextDouble();

            // Call
            var offsets = new PhreaticLineOffsets(belowDikeTopAtRiver, belowDikeTopAtPolder, belowDikeToeAtPolder, belowShoulderBaseInside);

            // Assert
            Assert.IsFalse(offsets.UseDefaults);
            Assert.AreEqual(belowDikeTopAtRiver, offsets.BelowDikeTopAtRiver);
            Assert.AreEqual(belowDikeTopAtPolder, offsets.BelowDikeTopAtPolder);
            Assert.AreEqual(belowDikeToeAtPolder, offsets.BelowDikeToeAtPolder);
            Assert.AreEqual(belowShoulderBaseInside, offsets.BelowShoulderBaseInside);
        }
コード例 #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="IMacroStabilityInwardsLocationInput"/>.</param>
 /// <param name="actual">The actual <see cref="PhreaticLineOffsets"/>.</param>
 /// <exception cref="AssertionException">Thrown when <paramref name="original"/>
 /// does not correspond to <paramref name="original"/>.</exception>
 public static void AssertPhreaticLineOffsets(IMacroStabilityInwardsLocationInput original, PhreaticLineOffsets actual)
 {
     Assert.AreEqual(original.UseDefaultOffsets, actual.UseDefaults);
     Assert.AreEqual(original.PhreaticLineOffsetBelowDikeTopAtRiver, actual.BelowDikeTopAtRiver);
     Assert.AreEqual(original.PhreaticLineOffsetBelowDikeTopAtPolder, actual.BelowDikeTopAtPolder);
     Assert.AreEqual(original.PhreaticLineOffsetBelowDikeToeAtPolder, actual.BelowDikeToeAtPolder);
     Assert.AreEqual(original.PhreaticLineOffsetBelowShoulderBaseInside, actual.BelowShoulderBaseInside);
 }
コード例 #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);
        }