コード例 #1
0
        public void ReadNonAdoptableFailureMechanismSectionResultEntity_ParameterValues_SectionResultWithParameterValues()
        {
            // Setup
            var    random     = new Random(21);
            bool   isRelevant = random.NextBoolean();
            var    initialFailureMechanismResultType = random.NextEnumValue <NonAdoptableInitialFailureMechanismResultType>();
            double manualSectionProbability          = random.NextDouble();
            var    furtherAnalysisType       = random.NextEnumValue <FailureMechanismSectionResultFurtherAnalysisType>();
            double refinedSectionProbability = random.NextDouble();

            var entity = new NonAdoptableFailureMechanismSectionResultEntity
            {
                IsRelevant = Convert.ToByte(isRelevant),
                InitialFailureMechanismResultType = Convert.ToByte(initialFailureMechanismResultType),
                ManualInitialFailureMechanismResultSectionProbability = manualSectionProbability,
                FurtherAnalysisType       = Convert.ToByte(furtherAnalysisType),
                RefinedSectionProbability = refinedSectionProbability
            };
            var sectionResult = new NonAdoptableFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection());

            // Call
            entity.Read(sectionResult);

            // Assert
            Assert.AreEqual(isRelevant, sectionResult.IsRelevant);
            Assert.AreEqual(initialFailureMechanismResultType, sectionResult.InitialFailureMechanismResultType);
            Assert.AreEqual(manualSectionProbability, sectionResult.ManualInitialFailureMechanismResultSectionProbability);
            Assert.AreEqual(furtherAnalysisType, sectionResult.FurtherAnalysisType);
            Assert.AreEqual(refinedSectionProbability, sectionResult.RefinedSectionProbability);
        }
コード例 #2
0
        public void ReadNonAdoptableFailureMechanismSectionResultEntity_EntityWithNullValues_SectionResultWithNaNValues()
        {
            // Setup
            var entity        = new NonAdoptableFailureMechanismSectionResultEntity();
            var sectionResult = new NonAdoptableFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection());

            // Call
            entity.Read(sectionResult);

            // Assert
            Assert.IsNaN(sectionResult.ManualInitialFailureMechanismResultSectionProbability);
            Assert.IsNaN(sectionResult.RefinedSectionProbability);
        }
コード例 #3
0
        public void ReadNonAdoptableFailureMechanismSectionResultEntity_SectionResultNull_ThrowsArgumentNullException()
        {
            // Setup
            var entity = new NonAdoptableFailureMechanismSectionResultEntity();

            // Call
            void Call() => entity.Read(null);

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

            Assert.AreEqual("sectionResult", exception.ParamName);
        }