public void Create_WithValidValues_ReturnsEntityWithExpectedPropertiesSet()
        {
            // Setup
            var random = new Random(21);

            MacroStabilityInwardsSlidingCircle leftCircle = CreateSlidingCircle(13);
            MacroStabilityInwardsSlidingCircle rightCircle = CreateSlidingCircle(34);
            IEnumerable<MacroStabilityInwardsSlice> slices = new[]
            {
                MacroStabilityInwardsSliceTestFactory.CreateSlice()
            };
            var slidingCurve = new MacroStabilityInwardsSlidingCurve(leftCircle,
                                                                     rightCircle,
                                                                     slices,
                                                                     random.NextDouble(),
                                                                     random.NextDouble());

            MacroStabilityInwardsGrid leftGrid = MacroStabilityInwardsGridTestFactory.Create();
            MacroStabilityInwardsGrid rightGrid = MacroStabilityInwardsGridTestFactory.Create();
            RoundedDouble[] tangentLines =
            {
                random.NextRoundedDouble()
            };
            var slipPlane = new MacroStabilityInwardsSlipPlaneUpliftVan(leftGrid, rightGrid, tangentLines);

            var output = new MacroStabilityInwardsOutput(slidingCurve, slipPlane, new MacroStabilityInwardsOutput.ConstructionProperties
            {
                FactorOfStability = random.NextDouble(),
                ForbiddenZonesXEntryMax = random.NextDouble(),
                ForbiddenZonesXEntryMin = random.NextDouble()
            });

            // Call
            MacroStabilityInwardsCalculationOutputEntity entity = output.Create();

            // Assert
            Assert.IsNotNull(entity);
            MacroStabilityInwardsCalculationOutputEntityTestHelper.AssertOutputPropertyValues(output, entity);
        }
Ejemplo n.º 2
0
        public void Constructor_ExpectedValues()
        {
            // Setup
            var slidingCurve = new MacroStabilityInwardsSlidingCurve(MacroStabilityInwardsSlidingCircleTestFactory.Create(),
                                                                     MacroStabilityInwardsSlidingCircleTestFactory.Create(),
                                                                     new MacroStabilityInwardsSlice[0], 0, 0);

            var slipPlane = new MacroStabilityInwardsSlipPlaneUpliftVan(MacroStabilityInwardsGridTestFactory.Create(),
                                                                        MacroStabilityInwardsGridTestFactory.Create(),
                                                                        new RoundedDouble[0]);

            var    random            = new Random(21);
            double factorOfStability = random.NextDouble();
            double zValue            = random.NextDouble();
            double xEntryMin         = random.NextDouble();
            double xEntryMax         = random.NextDouble();

            var properties = new MacroStabilityInwardsOutput.ConstructionProperties
            {
                FactorOfStability       = factorOfStability,
                ForbiddenZonesXEntryMin = xEntryMin,
                ForbiddenZonesXEntryMax = xEntryMax
            };

            // Call
            var output = new MacroStabilityInwardsOutput(slidingCurve, slipPlane, properties);

            // Assert
            Assert.IsInstanceOf <CloneableObservable>(output);
            Assert.IsInstanceOf <ICalculationOutput>(output);

            Assert.AreSame(slidingCurve, output.SlidingCurve);
            Assert.AreSame(slipPlane, output.SlipPlane);

            Assert.AreEqual(factorOfStability, output.FactorOfStability);
            Assert.AreEqual(xEntryMin, output.ForbiddenZonesXEntryMin);
            Assert.AreEqual(xEntryMax, output.ForbiddenZonesXEntryMax);
        }
 /// <summary>
 /// Creates the areas for <see cref="MacroStabilityInwardsSlice.TotalPorePressure"/>
 /// values in <paramref name="slidingCurve"/>.
 /// </summary>
 /// <param name="slidingCurve">The <see cref="MacroStabilityInwardsSlidingCurve"/> to
 /// get the slices from.</param>
 /// <returns>A collection of collections of points in 2D space containing areas representing the
 /// slice output values, or an empty collection when <paramref name="slidingCurve"/> is <c>null</c>.
 /// </returns>
 public static IEnumerable <IEnumerable <Point2D> > CreateTotalPorePressureAreas(MacroStabilityInwardsSlidingCurve slidingCurve)
 {
     return(CreateParameterAreas(slidingCurve?.Slices, slice => slice.TotalPorePressure, 0.125));
 }
 /// <summary>
 /// Creates the areas for <see cref="MacroStabilityInwardsSlice.EffectiveStress"/>
 /// values in <paramref name="slidingCurve"/>.
 /// </summary>
 /// <param name="slidingCurve">The <see cref="MacroStabilityInwardsSlidingCurve"/> to
 /// get the slices from.</param>
 /// <returns>A collection of collections of points in 2D space containing areas representing the
 /// slice output values, or an empty collection when <paramref name="slidingCurve"/> is <c>null</c>.
 /// </returns>
 public static IEnumerable <IEnumerable <Point2D> > CreateEffectiveStressAreas(MacroStabilityInwardsSlidingCurve slidingCurve)
 {
     return(CreateParameterAreas(slidingCurve?.Slices, slice => slice.EffectiveStress, 0.125));
 }
 /// <summary>
 /// Creates the areas for <see cref="MacroStabilityInwardsSlice.Cohesion"/>
 /// values in <paramref name="slidingCurve"/>.
 /// </summary>
 /// <param name="slidingCurve">The <see cref="MacroStabilityInwardsSlidingCurve"/> to
 /// get the slices from.</param>
 /// <returns>A collection of collections of points in 2D space containing areas representing the
 /// slice output values, or an empty collection when <paramref name="slidingCurve"/> is <c>null</c>.
 /// </returns>
 public static IEnumerable <IEnumerable <Point2D> > CreateCohesionAreas(MacroStabilityInwardsSlidingCurve slidingCurve)
 {
     return(CreateParameterAreas(slidingCurve?.Slices, slice => slice.Cohesion, 0.125));
 }
 /// <summary>
 /// Creates the areas for <see cref="MacroStabilityInwardsSlice.OverConsolidationRatio"/>
 /// values in <paramref name="slidingCurve"/>.
 /// </summary>
 /// <param name="slidingCurve">The <see cref="MacroStabilityInwardsSlidingCurve"/> to
 /// get the slices from.</param>
 /// <returns>A collection of collections of points in 2D space containing areas representing the
 /// slice output values, or an empty collection when <paramref name="slidingCurve"/> is <c>null</c>.
 /// </returns>
 public static IEnumerable <IEnumerable <Point2D> > CreateOverConsolidationRatioAreas(MacroStabilityInwardsSlidingCurve slidingCurve)
 {
     return(CreateParameterAreas(slidingCurve?.Slices, slice => slice.OverConsolidationRatio, 0.05));
 }