Example #1
0
        public void Constructor_ValidParameters_ExpectedValues()
        {
            // Setup
            var random = new Random(39);
            FailureMechanismSection section = GetTestFailureMechanismSection();
            double sectionStart             = random.NextDouble();
            double sectionEnd = random.NextDouble();
            var    probabilityAssessmentInput = new TestProbabilityAssessmentInput(random.NextDouble(), random.NextDouble());

            // Call
            var sectionRow = new FailureMechanismSectionProbabilityAssessmentRow(section, sectionStart, sectionEnd, probabilityAssessmentInput);

            // Assert
            Assert.IsInstanceOf <FailureMechanismSectionRow>(sectionRow);

            Assert.AreEqual(section.Name, sectionRow.Name);

            Assert.AreEqual(sectionStart, sectionRow.SectionStart, sectionRow.SectionStart.GetAccuracy());
            Assert.AreEqual(sectionEnd, sectionRow.SectionEnd, sectionRow.SectionEnd.GetAccuracy());

            Assert.AreEqual(section.Length, sectionRow.Length, sectionRow.Length.GetAccuracy());

            Assert.AreEqual(2, sectionRow.N.NumberOfDecimalPlaces);
            AssertLengthEffect(probabilityAssessmentInput, section, sectionRow);
        }
Example #2
0
        public void GivenRow_WhenProbabilityAssessmentInputChanged_ThenLengthEffectChangedAccordingly()
        {
            // Given
            var random = new Random(39);
            FailureMechanismSection section = GetTestFailureMechanismSection();
            var probabilityAssessmentInput  = new TestProbabilityAssessmentInput(random.NextDouble(), random.NextDouble());
            var sectionRow = new FailureMechanismSectionProbabilityAssessmentRow(section, double.NaN, double.NaN, probabilityAssessmentInput);

            // Precondition
            AssertLengthEffect(probabilityAssessmentInput, section, sectionRow);

            // When
            probabilityAssessmentInput.A = random.NextDouble();

            // Then
            AssertLengthEffect(probabilityAssessmentInput, section, sectionRow);
        }
Example #3
0
 private static void AssertLengthEffect(ProbabilityAssessmentInput probabilityAssessmentInput, FailureMechanismSection section, FailureMechanismSectionProbabilityAssessmentRow sectionRow)
 {
     Assert.AreEqual(probabilityAssessmentInput.GetN(section.Length), sectionRow.N, sectionRow.N.GetAccuracy());
 }