Пример #1
0
        private FailureMechanismAssemblyResultRow CreateGrassCoverErosionOutwardsFailureMechanismAssemblyResultRow()
        {
            GrassCoverErosionOutwardsFailureMechanism grassCoverErosionOutwards = AssessmentSection.GrassCoverErosionOutwards;

            return(FailureMechanismAssemblyResultRowFactory.CreateRow(
                       grassCoverErosionOutwards, () => GrassCoverErosionOutwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism(grassCoverErosionOutwards, AssessmentSection)));
        }
Пример #2
0
        private FailureMechanismAssemblyResultRow CreateClosingStructuresFailureMechanismAssemblyResultRow()
        {
            ClosingStructuresFailureMechanism closingStructures = AssessmentSection.ClosingStructures;

            return(FailureMechanismAssemblyResultRowFactory.CreateRow(
                       closingStructures, () => ClosingStructuresFailureMechanismAssemblyFactory.AssembleFailureMechanism(closingStructures, AssessmentSection)));
        }
Пример #3
0
        private FailureMechanismAssemblyResultRow CreateStabilityStoneCoverFailureMechanismAssemblyResultRow()
        {
            StabilityStoneCoverFailureMechanism stabilityStoneCover = AssessmentSection.StabilityStoneCover;

            return(FailureMechanismAssemblyResultRowFactory.CreateRow(
                       stabilityStoneCover, () => StabilityStoneCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism(stabilityStoneCover, AssessmentSection)));
        }
Пример #4
0
        private FailureMechanismAssemblyResultRow CreateWaveImpactFailureMechanismAssemblyResultRow()
        {
            WaveImpactAsphaltCoverFailureMechanism waveImpactAsphaltCover = AssessmentSection.WaveImpactAsphaltCover;

            return(FailureMechanismAssemblyResultRowFactory.CreateRow(
                       waveImpactAsphaltCover, () => WaveImpactAsphaltCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism(waveImpactAsphaltCover, AssessmentSection)));
        }
Пример #5
0
        private FailureMechanismAssemblyResultRow CreateMacroStabilityInwardsFailureMechanismAssemblyResultRow()
        {
            MacroStabilityInwardsFailureMechanism macroStabilityInwards = AssessmentSection.MacroStabilityInwards;

            return(FailureMechanismAssemblyResultRowFactory.CreateRow(
                       macroStabilityInwards, () => MacroStabilityInwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism(macroStabilityInwards, AssessmentSection)));
        }
Пример #6
0
        private FailureMechanismAssemblyResultRow CreateStabilityPointsStructuresFailureMechanismAssemblyResultRow()
        {
            StabilityPointStructuresFailureMechanism stabilityPointStructures = AssessmentSection.StabilityPointStructures;

            return(FailureMechanismAssemblyResultRowFactory.CreateRow(
                       stabilityPointStructures, () => StabilityPointStructuresFailureMechanismAssemblyFactory.AssembleFailureMechanism(stabilityPointStructures, AssessmentSection)));
        }
Пример #7
0
        private FailureMechanismAssemblyResultRow CreateHeightStructuresFailureMechanismAssemblyResultRow()
        {
            HeightStructuresFailureMechanism heightStructures = AssessmentSection.HeightStructures;

            return(FailureMechanismAssemblyResultRowFactory.CreateRow(
                       heightStructures, () => HeightStructuresFailureMechanismAssemblyFactory.AssembleFailureMechanism(heightStructures, AssessmentSection)));
        }
Пример #8
0
        private FailureMechanismAssemblyResultRow CreatePipingStructureFailureMechanismAssemblyResultRow()
        {
            PipingStructureFailureMechanism pipingStructure = AssessmentSection.PipingStructure;

            return(FailureMechanismAssemblyResultRowFactory.CreateRow(
                       pipingStructure, () => PipingStructureFailureMechanismAssemblyFactory.AssembleFailureMechanism(pipingStructure, AssessmentSection)));
        }
Пример #9
0
        private FailureMechanismAssemblyResultRow CreateDuneErosionFailureMechanismAssemblyResultRow()
        {
            DuneErosionFailureMechanism duneErosion = AssessmentSection.DuneErosion;

            return(FailureMechanismAssemblyResultRowFactory.CreateRow(
                       duneErosion, () => DuneErosionFailureMechanismAssemblyFactory.AssembleFailureMechanism(duneErosion, AssessmentSection)));
        }
Пример #10
0
        public void CreateRow_FailureMechanismInAssemblyWithPerformAssemblyFuncReturningResult_ReturnsExpectedRow()
        {
            // Setup
            const string failureMechanismName = "Failure Mechanism Name";
            const string failureMechanismCode = "Code";

            var mocks            = new MockRepository();
            var failureMechanism = mocks.Stub <IFailureMechanism>();

            failureMechanism.Stub(fm => fm.Name).Return(failureMechanismName);
            failureMechanism.Stub(fm => fm.Code).Return(failureMechanismCode);
            failureMechanism.Stub(fm => fm.AssemblyResult).Return(new FailureMechanismAssemblyResult
            {
                ProbabilityResultType = FailureMechanismAssemblyProbabilityResultType.Automatic
            });
            mocks.ReplayAll();

            failureMechanism.InAssembly = true;

            var    random         = new Random(21);
            double assemblyResult = random.NextDouble();

            // Call
            FailureMechanismAssemblyResultRow row = FailureMechanismAssemblyResultRowFactory.CreateRow(failureMechanism, () => new FailureMechanismAssemblyResultWrapper(
                                                                                                           assemblyResult, random.NextEnumValue <AssemblyMethod>()));

            // Assert
            Assert.IsEmpty(row.ColumnStateDefinitions[probabilityIndex].ErrorText);

            Assert.AreEqual(failureMechanismName, row.Name);
            Assert.AreEqual(failureMechanismCode, row.Code);
            Assert.AreEqual(assemblyResult, row.Probability);

            mocks.VerifyAll();
        }
Пример #11
0
        public void CreateRow_FailureMechanismNotInAssembly_ReturnsExpectedRow()
        {
            // Setup
            const string failureMechanismName = "Failure Mechanism Name";
            const string failureMechanismCode = "Code";

            var mocks            = new MockRepository();
            var failureMechanism = mocks.Stub <IFailureMechanism>();

            failureMechanism.Stub(fm => fm.Name).Return(failureMechanismName);
            failureMechanism.Stub(fm => fm.Code).Return(failureMechanismCode);
            mocks.ReplayAll();

            failureMechanism.InAssembly = false;

            // Call
            FailureMechanismAssemblyResultRow row = FailureMechanismAssemblyResultRowFactory.CreateRow(failureMechanism, () => null);

            // Assert
            Assert.IsEmpty(row.ColumnStateDefinitions[probabilityIndex].ErrorText);

            Assert.AreEqual(failureMechanismName, row.Name);
            Assert.AreEqual(failureMechanismCode, row.Code);
            Assert.IsNaN(row.Probability);

            mocks.VerifyAll();
        }
Пример #12
0
        public void CreateRow_FailureMechanismInAssemblyWithInvalidManualAssembly_ReturnsExpectedRow()
        {
            // Setup
            const string failureMechanismName = "Failure Mechanism Name";
            const string failureMechanismCode = "Code";

            var mocks            = new MockRepository();
            var failureMechanism = mocks.Stub <IFailureMechanism>();

            failureMechanism.Stub(fm => fm.Name).Return(failureMechanismName);
            failureMechanism.Stub(fm => fm.Code).Return(failureMechanismCode);
            failureMechanism.Stub(fm => fm.AssemblyResult).Return(new FailureMechanismAssemblyResult
            {
                ManualFailureMechanismAssemblyProbability = double.NaN,
                ProbabilityResultType = FailureMechanismAssemblyProbabilityResultType.Manual
            });
            mocks.ReplayAll();

            failureMechanism.InAssembly = true;

            // Call
            FailureMechanismAssemblyResultRow row = FailureMechanismAssemblyResultRowFactory.CreateRow(failureMechanism, () => null);

            // Assert
            Assert.AreEqual("Er moet een waarde worden ingevuld voor de faalkans.", row.ColumnStateDefinitions[probabilityIndex].ErrorText);

            Assert.AreEqual(failureMechanismName, row.Name);
            Assert.AreEqual(failureMechanismCode, row.Code);
            Assert.IsNaN(row.Probability);

            mocks.VerifyAll();
        }
Пример #13
0
        public void CreateRow_FailureMechanismInAssemblyWithPerformAssemblyFuncThrowingAssemblyException_ReturnsExpectedRow()
        {
            // Setup
            const string failureMechanismName = "Failure Mechanism Name";
            const string failureMechanismCode = "Code";
            const string errorMessage         = "I am an error";

            var mocks            = new MockRepository();
            var failureMechanism = mocks.Stub <IFailureMechanism>();

            failureMechanism.Stub(fm => fm.Name).Return(failureMechanismName);
            failureMechanism.Stub(fm => fm.Code).Return(failureMechanismCode);
            failureMechanism.Stub(fm => fm.AssemblyResult).Return(new FailureMechanismAssemblyResult
            {
                ProbabilityResultType = FailureMechanismAssemblyProbabilityResultType.Automatic
            });
            mocks.ReplayAll();

            failureMechanism.InAssembly = true;

            // Call
            FailureMechanismAssemblyResultRow row = FailureMechanismAssemblyResultRowFactory.CreateRow(
                failureMechanism, () => throw new AssemblyException(errorMessage));

            // Assert
            Assert.AreEqual(errorMessage, row.ColumnStateDefinitions[probabilityIndex].ErrorText);

            Assert.AreEqual(failureMechanismName, row.Name);
            Assert.AreEqual(failureMechanismCode, row.Code);
            Assert.IsNaN(row.Probability);

            mocks.VerifyAll();
        }
Пример #14
0
 private IEnumerable <FailureMechanismAssemblyResultRow> CreateSpecificFailureMechanismResultRows()
 {
     return(AssessmentSection.SpecificFailureMechanisms
            .Select(fp => FailureMechanismAssemblyResultRowFactory.CreateRow(
                        fp, () => FailureMechanismAssemblyFactory.AssembleFailureMechanism(fp, AssessmentSection))
                    )
            .ToArray());
 }
Пример #15
0
        public void CreateRow_FailureMechanismNull_ThrowsArgumentNullException()
        {
            // Call
            void Call() => FailureMechanismAssemblyResultRowFactory.CreateRow(null, () => null);

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

            Assert.AreEqual("failureMechanism", exception.ParamName);
        }
Пример #16
0
        public void CreateRow_PerformAssemblyFuncNull_ThrowsArgumentNullException()
        {
            // Setup
            var mocks            = new MockRepository();
            var failureMechanism = mocks.Stub <IFailureMechanism>();

            mocks.ReplayAll();

            // Call
            void Call() => FailureMechanismAssemblyResultRowFactory.CreateRow(failureMechanism, null);

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

            Assert.AreEqual("performAssemblyFunc", exception.ParamName);
            mocks.VerifyAll();
        }
Пример #17
0
 private FailureMechanismAssemblyResultRow CreateStandAloneFailureMechanismAssemblyResultRow <TFailureMechanism>(TFailureMechanism failureMechanism)
     where TFailureMechanism : IHasGeneralInput, IFailureMechanism <NonAdoptableWithProfileProbabilityFailureMechanismSectionResult>
 {
     return(FailureMechanismAssemblyResultRowFactory.CreateRow(
                failureMechanism, () => FailureMechanismAssemblyFactory.AssembleFailureMechanism(failureMechanism, AssessmentSection)));
 }