Exemple #1
0
        public void Create_WithValidProperties_ReturnsEntityWithPropertiesSet()
        {
            // Setup
            var random = new Random(31);
            MacroStabilityInwardsSoilLayer2D soilLayer = CreateMacroStabilityInwardsSoilLayer2D();
            int order = random.Next();

            // Call
            MacroStabilityInwardsSoilLayerTwoDEntity entity = soilLayer.Create(order);

            // Assert
            AssertMacroStabilityInwardsSoilLayerTwoDEntity(soilLayer, entity, order);
        }
Exemple #2
0
        public void Create_StringPropertiesDoNotShareReference()
        {
            // Setup
            const string materialName = "MaterialName";
            var          soilLayer    = new MacroStabilityInwardsSoilLayer2D(RingTestFactory.CreateRandomRing())
            {
                Data =
                {
                    MaterialName = materialName
                }
            };

            // Call
            MacroStabilityInwardsSoilLayerTwoDEntity entity = soilLayer.Create(0);

            // Assert
            TestHelper.AssertAreEqualButNotSame(materialName, entity.MaterialName);
        }
Exemple #3
0
        public void Create_WithNestedLayers_ReturnsEntityWithNestedLayersSet()
        {
            // Setup
            MacroStabilityInwardsSoilLayer2D parentLayer = MacroStabilityInwardsSoilLayer2DTestFactory.CreateMacroStabilityInwardsSoilLayer2D(new[]
            {
                CreateMacroStabilityInwardsSoilLayer2D(),
                CreateMacroStabilityInwardsSoilLayer2D(),
                CreateMacroStabilityInwardsSoilLayer2D()
            });

            // Call
            MacroStabilityInwardsSoilLayerTwoDEntity entity = parentLayer.Create(0);

            // Assert
            Assert.IsNotNull(entity);
            Assert.AreEqual(parentLayer.NestedLayers.Count(), entity.MacroStabilityInwardsSoilLayerTwoDEntity1.Count);

            for (var i = 0; i < parentLayer.NestedLayers.Count(); i++)
            {
                AssertMacroStabilityInwardsSoilLayerTwoDEntity(parentLayer.NestedLayers.ElementAt(i),
                                                               entity.MacroStabilityInwardsSoilLayerTwoDEntity1.ElementAt(i),
                                                               i);
            }
        }
Exemple #4
0
        public void Create_WithNaNProperties_ReturnsEntityWithPropertiesSetToNull()
        {
            // Setup
            var soilLayer = new MacroStabilityInwardsSoilLayer2D(RingTestFactory.CreateRandomRing())
            {
                Data =
                {
                    AbovePhreaticLevel         =
                    {
                        Mean                   = RoundedDouble.NaN,
                        CoefficientOfVariation = RoundedDouble.NaN,
                        Shift                  = RoundedDouble.NaN
                    },
                    BelowPhreaticLevel         =
                    {
                        Mean                   = RoundedDouble.NaN,
                        CoefficientOfVariation = RoundedDouble.NaN,
                        Shift                  = RoundedDouble.NaN
                    },
                    Cohesion                   =
                    {
                        Mean                   = RoundedDouble.NaN,
                        CoefficientOfVariation = RoundedDouble.NaN
                    },
                    FrictionAngle              =
                    {
                        Mean                   = RoundedDouble.NaN,
                        CoefficientOfVariation = RoundedDouble.NaN
                    },
                    ShearStrengthRatio         =
                    {
                        Mean                   = RoundedDouble.NaN,
                        CoefficientOfVariation = RoundedDouble.NaN
                    },
                    StrengthIncreaseExponent   =
                    {
                        Mean                   = RoundedDouble.NaN,
                        CoefficientOfVariation = RoundedDouble.NaN
                    },
                    Pop                        =
                    {
                        Mean                   = RoundedDouble.NaN,
                        CoefficientOfVariation = RoundedDouble.NaN
                    }
                }
            };

            // Call
            MacroStabilityInwardsSoilLayerTwoDEntity entity = soilLayer.Create(0);

            // Assert
            Assert.IsNotNull(entity);
            Assert.IsNull(entity.AbovePhreaticLevelMean);
            Assert.IsNull(entity.AbovePhreaticLevelCoefficientOfVariation);
            Assert.IsNull(entity.AbovePhreaticLevelShift);
            Assert.IsNull(entity.BelowPhreaticLevelMean);
            Assert.IsNull(entity.BelowPhreaticLevelCoefficientOfVariation);
            Assert.IsNull(entity.BelowPhreaticLevelShift);
            Assert.IsNull(entity.CohesionMean);
            Assert.IsNull(entity.CohesionCoefficientOfVariation);
            Assert.IsNull(entity.FrictionAngleMean);
            Assert.IsNull(entity.FrictionAngleCoefficientOfVariation);
            Assert.IsNull(entity.ShearStrengthRatioMean);
            Assert.IsNull(entity.ShearStrengthRatioCoefficientOfVariation);
            Assert.IsNull(entity.StrengthIncreaseExponentMean);
            Assert.IsNull(entity.StrengthIncreaseExponentCoefficientOfVariation);
            Assert.IsNull(entity.PopMean);
            Assert.IsNull(entity.PopCoefficientOfVariation);
        }