예제 #1
0
        public void CalculateThicknessCoverageLayer_WithValidInput_ReturnsSomeThickness()
        {
            // Setup
            var input = new PipingCalculatorInput(CreateSimpleConstructionProperties());

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

            // Call
            double result = calculation.CalculateEffectiveThicknessCoverageLayer();

            // Assert
            Assert.AreEqual(1.0, result);
        }
예제 #2
0
        public void CalculateThicknessCoverageLayer_WithExitPointLBeyondSurfaceLineInput_ReturnsNaN()
        {
            // Setup
            PipingCalculatorInput.ConstructionProperties properties = CreateSimpleConstructionProperties();
            properties.ExitPointXCoordinate = (RoundedDouble)2.1;

            var input = new PipingCalculatorInput(properties);

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

            // Call
            double result = calculation.CalculateEffectiveThicknessCoverageLayer();

            // Assert
            Assert.IsNaN(result);
        }
예제 #3
0
        public void CalculateThicknessCoverageLayer_WithValidInput_UsedEffectiveThicknessCalculator()
        {
            // Setup
            var input = new PipingCalculatorInput(CreateSimpleConstructionProperties());

            var testPipingSubCalculatorFactory = new TestPipingSubCalculatorFactory();
            var calculation = new PipingCalculator(input, testPipingSubCalculatorFactory);

            // Call
            calculation.CalculateEffectiveThicknessCoverageLayer();

            // Assert
            Assert.IsFalse(testPipingSubCalculatorFactory.LastCreatedHeaveCalculator.Calculated);
            Assert.IsFalse(testPipingSubCalculatorFactory.LastCreatedSellmeijerCalculator.Calculated);
            Assert.IsFalse(testPipingSubCalculatorFactory.LastCreatedUpliftCalculator.Calculated);
            Assert.IsFalse(testPipingSubCalculatorFactory.LastCreatedPipingProfilePropertyCalculator.Calculated);
            Assert.IsFalse(testPipingSubCalculatorFactory.LastCreatedPiezometricHeadAtExitCalculator.Calculated);
            Assert.IsTrue(testPipingSubCalculatorFactory.LastCreatedEffectiveThicknessCalculator.Calculated);
        }
예제 #4
0
        public void CalculateThicknessCoverageLayer_WithValidInputWithAquiferAboveSurfaceLine_ReturnsNegativeThickness()
        {
            // Setup
            var input = new PipingCalculatorInput(CreateSimpleConstructionProperties());

            input.SurfaceLine.SetGeometry(new[]
            {
                new Point3D(0, 0, 0.5),
                new Point3D(1, 0, 1.5),
                new Point3D(2, 0, -1)
            });

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

            // Call
            double result = calculation.CalculateEffectiveThicknessCoverageLayer();

            // Assert
            Assert.AreEqual(result, -3.0);
        }
예제 #5
0
        public void CalculateThicknessCoverageLayer_SoilProfileWithoutAquiferSet_ThrowsPipingCalculatorException()
        {
            // Setup
            PipingCalculatorInput.ConstructionProperties properties = CreateSimpleConstructionProperties();
            properties.SoilProfile = new PipingSoilProfile(string.Empty, -1.0, new[]
            {
                new PipingSoilLayer(0)
            }, SoilProfileType.SoilProfile1D);

            var input = new PipingCalculatorInput(properties);

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

            // Call
            void Call() => calculation.CalculateEffectiveThicknessCoverageLayer();

            // Assert
            var exception = Assert.Throws <PipingCalculatorException>(Call);

            Assert.IsInstanceOf <NullReferenceException>(exception.InnerException);
        }