Ejemplo n.º 1
0
        public void ConstructorWithGridsAndTangent_ExpectedValues()
        {
            // Setup
            var    random            = new Random(11);
            double tangentZTop       = random.NextDouble();
            double tangentZBottom    = random.NextDouble();
            int    tangentLineNumber = random.Next();

            UpliftVanGrid leftGrid  = UpliftVanGridTestFactory.Create();
            UpliftVanGrid rightGrid = UpliftVanGridTestFactory.Create();

            // Call
            var slipPlane = new UpliftVanSlipPlane(leftGrid, rightGrid, tangentZTop, tangentZBottom, tangentLineNumber);

            // Assert
            Assert.IsFalse(slipPlane.GridAutomaticDetermined);
            Assert.AreSame(leftGrid, slipPlane.LeftGrid);
            Assert.AreSame(rightGrid, slipPlane.RightGrid);
            Assert.IsFalse(slipPlane.TangentLinesAutomaticAtBoundaries);
            Assert.AreEqual(tangentZTop, slipPlane.TangentZTop);
            Assert.AreEqual(tangentZBottom, slipPlane.TangentZBottom);
            Assert.AreEqual(tangentLineNumber, slipPlane.TangentLineNumber);
            Assert.AreEqual(4, slipPlane.TangentLineNumberOfRefinements);
            Assert.AreEqual(0, slipPlane.GridNumberOfRefinements);
        }
Ejemplo n.º 2
0
        public void ConstructorWithGrids_RightGridNull_ThrowsArgumentNullException()
        {
            // Setup
            UpliftVanGrid grid = UpliftVanGridTestFactory.Create();

            // Call
            void Call() => new UpliftVanSlipPlane(grid, null);

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

            Assert.AreEqual("rightGrid", exception.ParamName);
        }
        public void Constructor_RightGridNull_ThrowsArgumentNullException()
        {
            // Setup
            UpliftVanGrid grid = UpliftVanGridTestFactory.Create();

            // Call
            TestDelegate call = () => new UpliftVanCalculationGridResult(grid, null, Enumerable.Empty <double>());

            // Assert
            var exception = Assert.Throws <ArgumentNullException>(call);

            Assert.AreEqual("rightGrid", exception.ParamName);
        }
        public void Constructor_TangentLinesNull_ThrowsArgumentNullException()
        {
            // Setup
            UpliftVanGrid leftGrid  = UpliftVanGridTestFactory.Create();
            UpliftVanGrid rightGrid = UpliftVanGridTestFactory.Create();

            // Call
            TestDelegate call = () => new UpliftVanCalculationGridResult(leftGrid, rightGrid, null);

            // Assert
            var exception = Assert.Throws <ArgumentNullException>(call);

            Assert.AreEqual("tangentLines", exception.ParamName);
        }
Ejemplo n.º 5
0
        public void ConstructorWithGrids_ExpectedValues()
        {
            // Setup
            UpliftVanGrid leftGrid  = UpliftVanGridTestFactory.Create();
            UpliftVanGrid rightGrid = UpliftVanGridTestFactory.Create();

            // Call
            var slipPlane = new UpliftVanSlipPlane(leftGrid, rightGrid);

            // Assert
            Assert.IsFalse(slipPlane.GridAutomaticDetermined);
            Assert.AreSame(leftGrid, slipPlane.LeftGrid);
            Assert.AreSame(rightGrid, slipPlane.RightGrid);
            Assert.IsTrue(slipPlane.TangentLinesAutomaticAtBoundaries);
            Assert.IsNaN(slipPlane.TangentZTop);
            Assert.IsNaN(slipPlane.TangentZBottom);
            Assert.AreEqual(0, slipPlane.TangentLineNumber);
            Assert.AreEqual(4, slipPlane.TangentLineNumberOfRefinements);
            Assert.AreEqual(0, slipPlane.GridNumberOfRefinements);
        }
        public void Constructor_ValidParameters_ExpectedValues()
        {
            // Setup
            UpliftVanGrid leftGrid  = UpliftVanGridTestFactory.Create();
            UpliftVanGrid rightGrid = UpliftVanGridTestFactory.Create();

            double[] tangentLines =
            {
                0,
                1,
                1.5,
                2
            };

            // Call
            var result = new UpliftVanCalculationGridResult(leftGrid, rightGrid, tangentLines);

            // Assert
            Assert.AreSame(leftGrid, result.LeftGrid);
            Assert.AreSame(rightGrid, result.RightGrid);
            Assert.AreSame(tangentLines, result.TangentLines);
        }
Ejemplo n.º 7
0
        public void Convert_WithResult_ReturnConvertedSlipPlaneUpliftVan()
        {
            // Setup
            UpliftVanGrid leftGrid  = UpliftVanGridTestFactory.Create();
            UpliftVanGrid rightGrid = UpliftVanGridTestFactory.Create();

            double[] tangentLines =
            {
                3,
                2,
                1.5
            };

            var result = new UpliftVanCalculationGridResult(leftGrid, rightGrid, tangentLines);

            // Call
            MacroStabilityInwardsSlipPlaneUpliftVan output = MacroStabilityInwardsSlipPlaneUpliftVanConverter.Convert(result);

            // Assert
            CollectionAssert.AreEqual(tangentLines, output.TangentLines.Select(tl => tl.Value), new DoubleWithToleranceComparer(1e-2));
            AssertGrid(leftGrid, output.LeftGrid);
            AssertGrid(rightGrid, output.RightGrid);
        }
 private static UpliftVanCalculationGridResult CreateGridResult()
 {
     return(new UpliftVanCalculationGridResult(UpliftVanGridTestFactory.Create(),
                                               UpliftVanGridTestFactory.Create(),
                                               new double[0]));
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Creates a new instance of <see cref="UpliftVanCalculatorInput"/>.
 /// </summary>
 /// <param name="tangentZTop">The tangent line top boundary.</param>
 /// <param name="tangentZBottom">The tangent line bottom boundary.</param>
 /// <param name="tangentLineNumber">The number of tangent lines.</param>
 /// <returns>The created <see cref="UpliftVanCalculatorInput"/>.</returns>
 public static UpliftVanCalculatorInput Create(double tangentZTop, double tangentZBottom, int tangentLineNumber)
 {
     return(Create(new UpliftVanSlipPlane(UpliftVanGridTestFactory.Create(), UpliftVanGridTestFactory.Create(),
                                          tangentZTop, tangentZBottom, tangentLineNumber)));
 }