Example #1
0
        public void Constructor_ConstructionPropertiesWithValuesSet_ExpectedValues()
        {
            // Setup
            var random = new Random(21);

            double leftGridXLeft   = random.NextDouble(0.0, 1.0);
            double leftGridXRight  = random.NextDouble(1.0, 2.0);
            double leftGridZTop    = random.NextDouble(1.0, 2.0);
            double leftGridZBottom = random.NextDouble(0.0, 1.0);

            double rightGridXLeft   = random.NextDouble(0.0, 1.0);
            double rightGridXRight  = random.NextDouble(1.0, 2.0);
            double rightGridZTop    = random.NextDouble(1.0, 2.0);
            double rightGridZBottom = random.NextDouble(0.0, 1.0);

            double tangentLineZTop    = random.NextDouble(1.0, 2.0);
            double tangentLineZBottom = random.NextDouble(0.0, 1.0);

            var properties = new MacroStabilityInwardsInput.ConstructionProperties
            {
                LeftGridXLeft   = leftGridXLeft,
                LeftGridXRight  = leftGridXRight,
                LeftGridZTop    = leftGridZTop,
                LeftGridZBottom = leftGridZBottom,

                RightGridXLeft   = rightGridXLeft,
                RightGridXRight  = rightGridXRight,
                RightGridZTop    = rightGridZTop,
                RightGridZBottom = rightGridZBottom,

                TangentLineZTop    = tangentLineZTop,
                TangentLineZBottom = tangentLineZBottom
            };

            // Call
            var inputParameters = new MacroStabilityInwardsInput(properties);

            // Assert
            Assert.AreEqual(leftGridXLeft, inputParameters.LeftGrid.XLeft, inputParameters.LeftGrid.XLeft.GetAccuracy());
            Assert.AreEqual(leftGridXRight, inputParameters.LeftGrid.XRight, inputParameters.LeftGrid.XRight.GetAccuracy());
            Assert.AreEqual(leftGridZTop, inputParameters.LeftGrid.ZTop, inputParameters.LeftGrid.ZTop.GetAccuracy());
            Assert.AreEqual(leftGridZBottom, inputParameters.LeftGrid.ZBottom, inputParameters.LeftGrid.ZBottom.GetAccuracy());

            Assert.AreEqual(rightGridXLeft, inputParameters.RightGrid.XLeft, inputParameters.RightGrid.XLeft.GetAccuracy());
            Assert.AreEqual(rightGridXRight, inputParameters.RightGrid.XRight, inputParameters.RightGrid.XRight.GetAccuracy());
            Assert.AreEqual(rightGridZTop, inputParameters.RightGrid.ZTop, inputParameters.RightGrid.ZTop.GetAccuracy());
            Assert.AreEqual(rightGridZBottom, inputParameters.RightGrid.ZBottom, inputParameters.RightGrid.ZBottom.GetAccuracy());

            Assert.AreEqual(tangentLineZTop, inputParameters.TangentLineZTop, inputParameters.TangentLineZTop.GetAccuracy());
            Assert.AreEqual(tangentLineZBottom, inputParameters.TangentLineZBottom, inputParameters.TangentLineZBottom.GetAccuracy());
        }
Example #2
0
        public void Constructor_InvalidConstructionProperties_ThrowsArgumentException(MacroStabilityInwardsInput.ConstructionProperties properties,
                                                                                      string expectedMessage)
        {
            // Call
            TestDelegate test = () => new MacroStabilityInwardsInput(properties);

            // Assert
            TestHelper.AssertThrowsArgumentExceptionAndTestMessage <ArgumentException>(test, expectedMessage);
        }