Пример #1
0
        public void Constructor_DefaultPropertiesSet()
        {
            // Call
            var probabilityAssessmentInput = new MacroStabilityInwardsProbabilityAssessmentInput();

            // Assert
            Assert.IsInstanceOf <ProbabilityAssessmentInput>(probabilityAssessmentInput);
            Assert.AreEqual(0.033, probabilityAssessmentInput.A);
            Assert.AreEqual(50, probabilityAssessmentInput.B);
        }
Пример #2
0
        public void ReadProbabilityAssessmentInput_EntityNull_ThrowsArgumentNullException()
        {
            // Setup
            var input = new MacroStabilityInwardsProbabilityAssessmentInput();

            // Call
            TestDelegate test = () => ((MacroStabilityInwardsFailureMechanismMetaEntity)null).ReadProbabilityAssessmentInput(input);

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

            Assert.AreEqual("entity", exception.ParamName);
        }
Пример #3
0
        public void ReadProbabilityAssessmentInput_ValidParameters_SetMacroStabilityInwardsProbabilityAssessmentInputProperties()
        {
            // Setup
            var inputToUpdate = new MacroStabilityInwardsProbabilityAssessmentInput();
            var entity        = new MacroStabilityInwardsFailureMechanismMetaEntity
            {
                A = new Random(31).NextDouble()
            };

            // Call
            entity.ReadProbabilityAssessmentInput(inputToUpdate);

            // Assert
            Assert.AreEqual(entity.A, inputToUpdate.A);
        }
        /// <summary>
        /// Read the <see cref="MacroStabilityInwardsFailureMechanismMetaEntity"/> and use the information to
        /// update the <paramref name="probabilityAssessmentInput"/>.
        /// </summary>
        /// <param name="entity">The <see cref="MacroStabilityInwardsFailureMechanismMetaEntity"/> to use to
        /// update the <paramref name="probabilityAssessmentInput"/>.</param>
        /// <param name="probabilityAssessmentInput">The <see cref="MacroStabilityInwardsProbabilityAssessmentInput"/> to be updated.</param>
        /// <exception cref="ArgumentNullException">Thrown when any input parameter is <c>null</c>.</exception>
        internal static void ReadProbabilityAssessmentInput(this MacroStabilityInwardsFailureMechanismMetaEntity entity,
                                                            MacroStabilityInwardsProbabilityAssessmentInput probabilityAssessmentInput)
        {
            if (entity == null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

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

            probabilityAssessmentInput.A = entity.A;
        }
        public void Constructor_ExpectedValues()
        {
            // Setup
            var mocks             = new MockRepository();
            var assessmentSection = mocks.Stub <IAssessmentSection>();

            assessmentSection.Stub(a => a.ReferenceLine).Return(new ReferenceLine());
            mocks.ReplayAll();

            var random           = new Random(21);
            var failureMechanism = new MacroStabilityInwardsFailureMechanism
            {
                InAssembly = random.NextBoolean()
            };

            // Call
            var properties = new MacroStabilityInwardsFailureMechanismProperties(failureMechanism, assessmentSection);

            // Assert
            Assert.IsInstanceOf <MacroStabilityInwardsFailureMechanismPropertiesBase>(properties);
            Assert.AreEqual(failureMechanism.Name, properties.Name);
            Assert.AreEqual(failureMechanism.Code, properties.Code);
            Assert.AreEqual(failureMechanism.InAssembly, properties.InAssembly);

            MacroStabilityInwardsProbabilityAssessmentInput probabilityAssessmentInput = failureMechanism.MacroStabilityInwardsProbabilityAssessmentInput;

            Assert.AreEqual(probabilityAssessmentInput.A, properties.A);
            Assert.AreEqual(probabilityAssessmentInput.B, properties.B);
            Assert.AreEqual(2, properties.N.NumberOfDecimalPlaces);
            Assert.AreEqual(probabilityAssessmentInput.GetN(assessmentSection.ReferenceLine.Length),
                            properties.N,
                            properties.N.GetAccuracy());
            Assert.AreEqual(2, properties.SectionLength.NumberOfDecimalPlaces);
            Assert.AreEqual(assessmentSection.ReferenceLine.Length,
                            properties.SectionLength,
                            properties.SectionLength.GetAccuracy());
            Assert.AreEqual(failureMechanism.GeneralInput.ApplyLengthEffectInSection, properties.ApplyLengthEffectInSection);

            mocks.VerifyAll();
        }