Example #1
0
        public void Validate_SurfaceLineInvalidDitchPointsOrder_ValidationMessageForInvalidDitchPointsOrder(
            int ditchDikeSidePosition,
            int bottomDitchDikeSidePosition,
            int bottomDitchPolderSidePosition,
            int ditchPolderSidePosition)
        {
            // Setup
            PipingCalculatorInput.ConstructionProperties properties = CreateSimpleConstructionProperties();
            properties.SurfaceLine = new PipingSurfaceLine(string.Empty);

            var input = new PipingCalculatorInput(properties);

            input.SurfaceLine.SetGeometry(new[]
            {
                new Point3D(0, 0, 2),
                new Point3D(1, 0, -3),
                new Point3D(2, 0, -4),
                new Point3D(3, 0, 3)
            });
            input.SurfaceLine.SetDitchDikeSideAt(input.SurfaceLine.Points.ElementAt(ditchDikeSidePosition));
            input.SurfaceLine.SetBottomDitchDikeSideAt(input.SurfaceLine.Points.ElementAt(bottomDitchDikeSidePosition));
            input.SurfaceLine.SetBottomDitchPolderSideAt(input.SurfaceLine.Points.ElementAt(bottomDitchPolderSidePosition));
            input.SurfaceLine.SetDitchPolderSideAt(input.SurfaceLine.Points.ElementAt(ditchPolderSidePosition));

            var calculation = new PipingCalculator(input, PipingSubCalculatorFactory.Instance);

            // Call
            List <string> validationMessages = calculation.Validate();

            // Assert
            Assert.AreEqual(1, validationMessages.Count);
            Assert.AreEqual("De sloot in de hoogtegeometrie  is niet correct. Niet alle 4 punten zijn gedefinieerd of de volgorde is incorrect.", validationMessages.First());
        }
Example #2
0
        public void Validate_SoilProfileBottomAtTopLevel_ValidationMessageForHavingTooHighBottom(double bottom)
        {
            // Setup
            const int top = 0;

            PipingCalculatorInput.ConstructionProperties properties = CreateSimpleConstructionProperties();
            properties.SoilProfile = new PipingSoilProfile(string.Empty, bottom, new[]
            {
                new PipingSoilLayer(top)
                {
                    IsAquifer = true
                }
            }, SoilProfileType.SoilProfile1D);

            var input = new PipingCalculatorInput(properties);

            var calculation = new PipingCalculator(input, PipingSubCalculatorFactory.Instance);

            // Call
            List <string> validationMessages = calculation.Validate();

            // Assert
            string message = $"De onderkant({bottom}) van het ondergrondprofiel is niet laag genoeg. Het moet tenminste {0.001} m onder de bovenkant van de diepste laag ({top}) liggen.";

            Assert.AreEqual(1, validationMessages.Count);
            Assert.AreEqual(message, validationMessages[0]);
        }
Example #3
0
        public void Validate_CompleteValidInput_ReturnsNoValidationMessages()
        {
            // Setup
            var input       = new PipingCalculatorInput(CreateSimpleConstructionProperties());
            var calculation = new PipingCalculator(input, PipingSubCalculatorFactory.Instance);

            // Call
            List <string> validationMessages = calculation.Validate();

            // Assert
            Assert.AreEqual(0, validationMessages.Count);
        }
Example #4
0
        public void Validate_NoSoilProfileSet_ValidationMessageForHavingNoSoilProfileSelected()
        {
            // Setup
            PipingCalculatorInput.ConstructionProperties properties = CreateSimpleConstructionProperties();
            properties.SoilProfile = null;

            var input = new PipingCalculatorInput(properties);

            var calculation = new PipingCalculator(input, PipingSubCalculatorFactory.Instance);

            // Call
            List <string> validationMessages = calculation.Validate();

            // Assert
            Assert.AreEqual(1, validationMessages.Count);
            Assert.AreEqual("Het ondergrondprofiel is niet gedefinieerd.", validationMessages[0]);
        }
Example #5
0
        public void Validate_VolumetricWeightWaterZero_ValidationMessageForVolumetricWeightWater()
        {
            // Setup
            PipingCalculatorInput.ConstructionProperties properties = CreateSimpleConstructionProperties();
            properties.WaterVolumetricWeight = 0;

            var input = new PipingCalculatorInput(properties);

            var calculation = new PipingCalculator(input, PipingSubCalculatorFactory.Instance);

            // Call
            List <string> validationMessages = calculation.Validate();

            // Assert
            Assert.AreEqual(1, validationMessages.Count);
            Assert.AreEqual("Volumiek gewicht water heeft ongeldige waarde (mag niet nul zijn).", validationMessages[0]);
        }
Example #6
0
        public void Validate_ThicknessAquiferLayerZero_ValidationMessageForDAquifer()
        {
            // Setup
            PipingCalculatorInput.ConstructionProperties properties = CreateSimpleConstructionProperties();
            properties.ThicknessAquiferLayer = 0;

            var input = new PipingCalculatorInput(properties);

            var calculation = new PipingCalculator(input, PipingSubCalculatorFactory.Instance);

            // Call
            List <string> validationMessages = calculation.Validate();

            // Assert
            Assert.AreEqual(1, validationMessages.Count);
            Assert.AreEqual("Parameter 'DAquifer' (dikte watervoerend pakket) heeft ongeldige waarde (0 of negatief).", validationMessages[0]);
        }
Example #7
0
        public void Validate_NegativeBeddingAngle_ValidationMessageForBeddingAngle(double beddingAngle)
        {
            // Setup
            PipingCalculatorInput.ConstructionProperties properties = CreateSimpleConstructionProperties();
            properties.BeddingAngle = beddingAngle;

            var input = new PipingCalculatorInput(properties);

            var calculation = new PipingCalculator(input, PipingSubCalculatorFactory.Instance);

            // Call
            List <string> validationMessages = calculation.Validate();

            // Assert
            Assert.AreEqual(1, validationMessages.Count);
            Assert.AreEqual("Rolweerstandshoek heeft een ongeldige waarde (0 of negatief).", validationMessages[0]);
        }
Example #8
0
        public void Validate_ZeroOrNegativeSeepageLength_ValidationMessageForPipingLength(double seepageLength)
        {
            // Setup
            PipingCalculatorInput.ConstructionProperties properties = CreateSimpleConstructionProperties();
            properties.SeepageLength = seepageLength;

            var input = new PipingCalculatorInput(properties);

            var calculation = new PipingCalculator(input, PipingSubCalculatorFactory.Instance);

            // Call
            List <string> validationMessages = calculation.Validate();

            // Assert
            Assert.AreEqual(1, validationMessages.Count);
            Assert.AreEqual("Kwelweglengte heeft ongeldige waarde (0 of negatief).", validationMessages[0]);
        }
Example #9
0
        public void Validate_CompleteValidInput_CalculatorsValidated()
        {
            // Setup
            var input = new PipingCalculatorInput(CreateSimpleConstructionProperties());
            var testPipingSubCalculatorFactory = new TestPipingSubCalculatorFactory();
            var calculation = new PipingCalculator(input, testPipingSubCalculatorFactory);

            // Call
            calculation.Validate();

            // Assert
            Assert.IsTrue(testPipingSubCalculatorFactory.LastCreatedEffectiveThicknessCalculator.Validated);
            Assert.IsTrue(testPipingSubCalculatorFactory.LastCreatedHeaveCalculator.Validated);
            Assert.IsTrue(testPipingSubCalculatorFactory.LastCreatedSellmeijerCalculator.Validated);
            Assert.IsTrue(testPipingSubCalculatorFactory.LastCreatedUpliftCalculator.Validated);
            Assert.IsTrue(testPipingSubCalculatorFactory.LastCreatedPipingProfilePropertyCalculator.Validated);
        }
Example #10
0
        public void Validate_DampingFactorExitZero_TwoValidationMessageForRExit()
        {
            // Setup
            PipingCalculatorInput.ConstructionProperties properties = CreateSimpleConstructionProperties();
            properties.AssessmentLevel   = (RoundedDouble)0.1;
            properties.DampingFactorExit = 0;

            var input = new PipingCalculatorInput(properties);

            var calculation = new PipingCalculator(input, PipingSubCalculatorFactory.Instance);

            // Call
            List <string> validationMessages = calculation.Validate();

            // Assert
            Assert.AreEqual(1, validationMessages.Count);
            Assert.AreEqual("Parameter 'RExit' (Dempingsfactor bij uittredepunt) mag niet nul zijn.", validationMessages[0]);
        }
Example #11
0
        public void Validate_DifferenceAssessmentLevelAndPhreaticLevelExitEqualToSellmeijerReductionFactorTimesThicknessCoverageLayer_ValidationMessageForHRiverHExitRcDTotal(
            double assessmentLevel, double phreaticLevelExit, double sellmeijerReductionFactor, double thicknessCoverageLayer)
        {
            // Setup
            PipingCalculatorInput.ConstructionProperties properties = CreateSimpleConstructionProperties();
            properties.AssessmentLevel           = (RoundedDouble)assessmentLevel;
            properties.PhreaticLevelExit         = phreaticLevelExit;
            properties.SellmeijerReductionFactor = sellmeijerReductionFactor;
            properties.ThicknessCoverageLayer    = thicknessCoverageLayer;

            var input = new PipingCalculatorInput(properties);

            var calculation = new PipingCalculator(input, PipingSubCalculatorFactory.Instance);

            // Call
            List <string> validationMessages = calculation.Validate();

            // Assert
            Assert.AreEqual(1, validationMessages.Count);
            Assert.AreEqual("De term HRiver - HExit - (Rc*DTotal) mag niet nul zijn.", validationMessages[0]);
        }