/// <summary>
        /// Creates a new instance of <see cref="MacroStabilityInwardsSlice"/>.
        /// </summary>
        /// <param name="topLeftPoint">The top left point of the slice.</param>
        /// <param name="topRightPoint">The top right point of the slice.</param>
        /// <param name="bottomLeftPoint">The bottom left point of the slice.</param>
        /// <param name="bottomRightPoint">The bottom right point of the slice.</param>
        /// <param name="properties">The object containing the values for the properties
        /// of the new <see cref="MacroStabilityInwardsSlice"/>.</param>
        /// <exception cref="ArgumentNullException">Thrown when any parameter is <c>null</c>.</exception>
        public MacroStabilityInwardsSlice(Point2D topLeftPoint, Point2D topRightPoint,
                                          Point2D bottomLeftPoint, Point2D bottomRightPoint,
                                          ConstructionProperties properties)
        {
            if (topLeftPoint == null)
            {
                throw new ArgumentNullException(nameof(topLeftPoint));
            }

            if (topRightPoint == null)
            {
                throw new ArgumentNullException(nameof(topRightPoint));
            }

            if (bottomLeftPoint == null)
            {
                throw new ArgumentNullException(nameof(bottomLeftPoint));
            }

            if (bottomRightPoint == null)
            {
                throw new ArgumentNullException(nameof(bottomRightPoint));
            }

            if (properties == null)
            {
                throw new ArgumentNullException(nameof(properties));
            }

            TopLeftPoint     = topLeftPoint;
            TopRightPoint    = topRightPoint;
            BottomLeftPoint  = bottomLeftPoint;
            BottomRightPoint = bottomRightPoint;

            XCenter       = new RoundedDouble(2, (topLeftPoint.X + topRightPoint.X) / 2.0);
            ZCenterBottom = new RoundedDouble(2, new Segment2D(bottomLeftPoint, bottomRightPoint).Interpolate(XCenter));
            Width         = new RoundedDouble(2, topRightPoint.X - topLeftPoint.X);
            ArcLength     = new RoundedDouble(2, bottomLeftPoint.GetEuclideanDistanceTo(bottomRightPoint));
            BottomAngle   = new RoundedDouble(2, Math2D.GetAngleBetween(bottomLeftPoint, bottomRightPoint));
            TopAngle      = new RoundedDouble(2, Math2D.GetAngleBetween(topLeftPoint, topRightPoint));

            Cohesion               = new RoundedDouble(3, properties.Cohesion);
            FrictionAngle          = new RoundedDouble(3, properties.FrictionAngle);
            CriticalPressure       = new RoundedDouble(3, properties.CriticalPressure);
            OverConsolidationRatio = new RoundedDouble(3, properties.OverConsolidationRatio);
            Pop = new RoundedDouble(3, properties.Pop);
            DegreeOfConsolidationPorePressureSoil = new RoundedDouble(3, properties.DegreeOfConsolidationPorePressureSoil);
            DegreeOfConsolidationPorePressureLoad = new RoundedDouble(3, properties.DegreeOfConsolidationPorePressureLoad);
            Dilatancy               = new RoundedDouble(3, properties.Dilatancy);
            ExternalLoad            = new RoundedDouble(3, properties.ExternalLoad);
            HydrostaticPorePressure = new RoundedDouble(3, properties.HydrostaticPorePressure);
            LeftForce               = new RoundedDouble(3, properties.LeftForce);
            LeftForceAngle          = new RoundedDouble(3, properties.LeftForceAngle);
            LeftForceY              = new RoundedDouble(3, properties.LeftForceY);
            RightForce              = new RoundedDouble(3, properties.RightForce);
            RightForceAngle         = new RoundedDouble(3, properties.RightForceAngle);
            RightForceY             = new RoundedDouble(3, properties.RightForceY);
            LoadStress              = new RoundedDouble(3, properties.LoadStress);
            NormalStress            = new RoundedDouble(3, properties.NormalStress);
            PorePressure            = new RoundedDouble(3, properties.PorePressure);
            HorizontalPorePressure  = new RoundedDouble(3, properties.HorizontalPorePressure);
            VerticalPorePressure    = new RoundedDouble(3, properties.VerticalPorePressure);
            PiezometricPorePressure = new RoundedDouble(3, properties.PiezometricPorePressure);
            EffectiveStress         = new RoundedDouble(3, properties.EffectiveStress);
            ExcessPorePressure      = new RoundedDouble(3, properties.ExcessPorePressure);
            ShearStress             = new RoundedDouble(3, properties.ShearStress);
            SoilStress              = new RoundedDouble(3, properties.SoilStress);
            TotalPorePressure       = new RoundedDouble(3, properties.TotalPorePressure);
            TotalStress             = new RoundedDouble(3, properties.TotalStress);
            Weight = new RoundedDouble(3, properties.Weight);
        }
        public void SetData_WithData_ExpectedValuesInTable()
        {
            // Setup
            using (var table = new MacroStabilityInwardsSlicesTable())
            {
                MacroStabilityInwardsSlice[] slices =
                {
                    MacroStabilityInwardsSliceTestFactory.CreateSlice(),
                    MacroStabilityInwardsSliceTestFactory.CreateSlice(),
                    MacroStabilityInwardsSliceTestFactory.CreateSlice()
                };

                // Call
                table.SetData(slices);

                // Assert
                Assert.AreEqual(slices.Length, table.Rows.Count);
                for (var i = 0; i < table.Rows.Count; i++)
                {
                    MacroStabilityInwardsSlice slice    = slices[i];
                    DataGridViewCellCollection rowCells = table.Rows[i].Cells;

                    Assert.AreEqual("Lamel " + (i + 1),
                                    rowCells[nameColumnIndex].Value);

                    var xCenter = (RoundedDouble)rowCells[xCenterColumnIndex].Value;
                    Assert.AreEqual((slice.TopLeftPoint.X + slice.TopRightPoint.X) / 2.0,
                                    xCenter,
                                    xCenter.GetAccuracy());

                    var zCenter = (RoundedDouble)rowCells[zCenterBottomColumnIndex].Value;
                    Assert.AreEqual(new Segment2D(slice.BottomLeftPoint, slice.BottomRightPoint).Interpolate(xCenter),
                                    zCenter,
                                    zCenter.GetAccuracy());

                    var width = (RoundedDouble)rowCells[widthColumnIndex].Value;
                    Assert.AreEqual(slice.TopRightPoint.X - slice.TopLeftPoint.X,
                                    width,
                                    width.GetAccuracy());

                    var arcLength = (RoundedDouble)rowCells[arcLengthColumnIndex].Value;
                    Assert.AreEqual(slice.BottomLeftPoint.GetEuclideanDistanceTo(slice.BottomRightPoint),
                                    arcLength,
                                    arcLength.GetAccuracy());

                    var bottomAngle = (RoundedDouble)rowCells[bottomAngleColumnIndex].Value;
                    Assert.AreEqual(Math2D.GetAngleBetween(slice.BottomLeftPoint, slice.BottomRightPoint),
                                    bottomAngle,
                                    bottomAngle.GetAccuracy());

                    var topAngle = (RoundedDouble)rowCells[topAngleColumnIndex].Value;
                    Assert.AreEqual(Math2D.GetAngleBetween(slice.TopLeftPoint, slice.TopRightPoint),
                                    topAngle,
                                    topAngle.GetAccuracy());

                    var frictionAngle = (RoundedDouble)rowCells[frictionAngleColumnIndex].Value;
                    Assert.AreEqual(slice.FrictionAngle,
                                    frictionAngle,
                                    frictionAngle.GetAccuracy());

                    var cohesion = (RoundedDouble)rowCells[cohesionColumnIndex].Value;
                    Assert.AreEqual(slice.Cohesion,
                                    cohesion,
                                    cohesion.GetAccuracy());

                    var effectiveStress = (RoundedDouble)rowCells[effectiveStressColumnIndex].Value;
                    Assert.AreEqual(slice.EffectiveStress,
                                    effectiveStress,
                                    effectiveStress.GetAccuracy());

                    var totalPorePressure = (RoundedDouble)rowCells[totalPorePressureColumnIndex].Value;
                    Assert.AreEqual(slice.TotalPorePressure,
                                    totalPorePressure,
                                    totalPorePressure.GetAccuracy());

                    var weight = (RoundedDouble)rowCells[weightColumnIndex].Value;
                    Assert.AreEqual(slice.Weight,
                                    weight,
                                    weight.GetAccuracy());

                    var piezometricPorePressure = (RoundedDouble)rowCells[piezometricPorePressureColumnIndex].Value;
                    Assert.AreEqual(slice.PiezometricPorePressure,
                                    piezometricPorePressure,
                                    piezometricPorePressure.GetAccuracy());

                    var porePressure = (RoundedDouble)rowCells[porePressureColumnIndex].Value;
                    Assert.AreEqual(slice.PorePressure,
                                    porePressure,
                                    porePressure.GetAccuracy());

                    var verticalPorePressure = (RoundedDouble)rowCells[verticalPorePressureColumnIndex].Value;
                    Assert.AreEqual(slice.VerticalPorePressure,
                                    verticalPorePressure,
                                    verticalPorePressure.GetAccuracy());

                    var horizontalPorePressure = (RoundedDouble)rowCells[horizontalPorePressureColumnIndex].Value;
                    Assert.AreEqual(slice.HorizontalPorePressure,
                                    horizontalPorePressure,
                                    horizontalPorePressure.GetAccuracy());

                    var ocr = (RoundedDouble)rowCells[overConsolidationRatioColumnIndex].Value;
                    Assert.AreEqual(slice.OverConsolidationRatio,
                                    ocr,
                                    ocr.GetAccuracy());

                    var pop = (RoundedDouble)rowCells[popColumnIndex].Value;
                    Assert.AreEqual(slice.Pop,
                                    pop,
                                    pop.GetAccuracy());

                    var normalStress = (RoundedDouble)rowCells[normalStressColumnIndex].Value;
                    Assert.AreEqual(slice.NormalStress,
                                    normalStress,
                                    normalStress.GetAccuracy());

                    var shearStress = (RoundedDouble)rowCells[shearStressColumnIndex].Value;
                    Assert.AreEqual(slice.ShearStress,
                                    shearStress,
                                    shearStress.GetAccuracy());

                    var loadStress = (RoundedDouble)rowCells[loadStressColumnIndex].Value;
                    Assert.AreEqual(slice.LoadStress,
                                    loadStress,
                                    loadStress.GetAccuracy());
                }
            }
        }