public void CreateCalculateStrategy_WithProbabilisticConfigurations_ReturnsExpectedStrategy(
            PipingFailureMechanism failureMechanism, PipingScenarioConfigurationPerFailureMechanismSectionType configurationType)
        {
            // Setup
            var mocks             = new MockRepository();
            var assessmentSection = mocks.Stub <IAssessmentSection>();

            mocks.ReplayAll();

            FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();

            failureMechanism.SetSections(new[]
            {
                section
            }, "APath");

            PipingScenarioConfigurationPerFailureMechanismSection scenarioConfigurationPerFailureMechanismSection =
                failureMechanism.ScenarioConfigurationsPerFailureMechanismSection.Single();

            scenarioConfigurationPerFailureMechanismSection.ScenarioConfigurationType = configurationType;

            // Call
            IFailureMechanismSectionResultCalculateProbabilityStrategy strategy =
                PipingFailureMechanismSectionResultCalculateProbabilityStrategyFactory.CreateCalculateStrategy(
                    failureMechanism.SectionResults.Single(), failureMechanism, assessmentSection);

            // Assert
            Assert.IsInstanceOf <ProbabilisticPipingFailureMechanismSectionResultCalculateProbabilityStrategy>(strategy);
        }
        public void CreateCalculateStrategy_AssessmentSectionNull_ThrowsArgumentNullException()
        {
            // Setup
            FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
            var sectionResult = new AdoptableWithProfileProbabilityFailureMechanismSectionResult(section);
            PipingScenarioConfigurationPerFailureMechanismSection scenarioConfigurationForSection = CreateScenarioConfigurationForSection(section);

            var failureMechanism = new PipingFailureMechanism();

            // Call
            void Call() => PipingFailureMechanismSectionResultCalculateProbabilityStrategyFactory.CreateCalculateStrategy(
                sectionResult, failureMechanism, null);

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

            Assert.AreEqual("assessmentSection", exception.ParamName);
        }
        public void CreateCalculateStrategy_SectionResultNull_ThrowsArgumentNullException()
        {
            // Setup
            var mocks             = new MockRepository();
            var assessmentSection = mocks.Stub <IAssessmentSection>();

            mocks.ReplayAll();

            var failureMechanism = new PipingFailureMechanism();

            // Call
            void Call() => PipingFailureMechanismSectionResultCalculateProbabilityStrategyFactory.CreateCalculateStrategy(
                null, failureMechanism, assessmentSection);

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

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

            mocks.VerifyAll();
        }
        public void CreateCalculateStrategy_FailureMechanismNull_ThrowsArgumentNullException()
        {
            // Setup
            var mocks             = new MockRepository();
            var assessmentSection = mocks.Stub <IAssessmentSection>();

            mocks.ReplayAll();

            FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
            var sectionResult = new AdoptableWithProfileProbabilityFailureMechanismSectionResult(section);

            // Call
            void Call() => PipingFailureMechanismSectionResultCalculateProbabilityStrategyFactory.CreateCalculateStrategy(
                sectionResult, null, assessmentSection);

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

            Assert.AreEqual("failureMechanism", exception.ParamName);

            mocks.VerifyAll();
        }
Example #5
0
 protected override AdoptableWithProfileProbabilityFailureMechanismSectionResultRow CreateFailureMechanismSectionResultRow(AdoptableWithProfileProbabilityFailureMechanismSectionResult sectionResult)
 {
     return(new AdoptableWithProfileProbabilityFailureMechanismSectionResultRow(
                sectionResult,
                PipingFailureMechanismSectionResultCalculateProbabilityStrategyFactory.CreateCalculateStrategy(sectionResult, FailureMechanism, AssessmentSection),
                CreateErrorProvider(sectionResult),
                () => PipingFailureMechanismAssemblyFactory.AssembleSection(sectionResult, FailureMechanism, AssessmentSection),
                () => FailureMechanism.GeneralInput.ApplyLengthEffectInSection,
                new AdoptableWithProfileProbabilityFailureMechanismSectionResultRow.ConstructionProperties
     {
         InitialFailureMechanismResultTypeIndex = initialFailureMechanismResultTypeIndex,
         InitialFailureMechanismResultProfileProbabilityIndex = initialFailureMechanismResultProfileProbabilityIndex,
         InitialFailureMechanismResultSectionProbabilityIndex = initialFailureMechanismResultSectionProbabilityIndex,
         FurtherAnalysisTypeIndex = furtherAnalysisTypeIndex,
         ProbabilityRefinementTypeIndex = probabilityRefinementTypeIndex,
         RefinedProfileProbabilityIndex = refinedProfileProbabilityIndex,
         RefinedSectionProbabilityIndex = refinedSectionProbabilityIndex,
         ProfileProbabilityIndex = profileProbabilityIndex,
         SectionProbabilityIndex = sectionProbabilityIndex,
         SectionNIndex = sectionNIndex,
         AssemblyGroupIndex = assemblyGroupIndex
     }));
 }