private FailureMechanismAssemblyResultRow CreateGrassCoverErosionOutwardsFailureMechanismAssemblyResultRow()
        {
            GrassCoverErosionOutwardsFailureMechanism grassCoverErosionOutwards = AssessmentSection.GrassCoverErosionOutwards;

            return(FailureMechanismAssemblyResultRowFactory.CreateRow(
                       grassCoverErosionOutwards, () => GrassCoverErosionOutwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism(grassCoverErosionOutwards, AssessmentSection)));
        }
        private FailureMechanismAssemblyResultRow CreateClosingStructuresFailureMechanismAssemblyResultRow()
        {
            ClosingStructuresFailureMechanism closingStructures = AssessmentSection.ClosingStructures;

            return(FailureMechanismAssemblyResultRowFactory.CreateRow(
                       closingStructures, () => ClosingStructuresFailureMechanismAssemblyFactory.AssembleFailureMechanism(closingStructures, AssessmentSection)));
        }
        private FailureMechanismAssemblyResultRow CreateStabilityStoneCoverFailureMechanismAssemblyResultRow()
        {
            StabilityStoneCoverFailureMechanism stabilityStoneCover = AssessmentSection.StabilityStoneCover;

            return(FailureMechanismAssemblyResultRowFactory.CreateRow(
                       stabilityStoneCover, () => StabilityStoneCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism(stabilityStoneCover, AssessmentSection)));
        }
        private FailureMechanismAssemblyResultRow CreateWaveImpactFailureMechanismAssemblyResultRow()
        {
            WaveImpactAsphaltCoverFailureMechanism waveImpactAsphaltCover = AssessmentSection.WaveImpactAsphaltCover;

            return(FailureMechanismAssemblyResultRowFactory.CreateRow(
                       waveImpactAsphaltCover, () => WaveImpactAsphaltCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism(waveImpactAsphaltCover, AssessmentSection)));
        }
        private FailureMechanismAssemblyResultRow CreateMacroStabilityInwardsFailureMechanismAssemblyResultRow()
        {
            MacroStabilityInwardsFailureMechanism macroStabilityInwards = AssessmentSection.MacroStabilityInwards;

            return(FailureMechanismAssemblyResultRowFactory.CreateRow(
                       macroStabilityInwards, () => MacroStabilityInwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism(macroStabilityInwards, AssessmentSection)));
        }
        private FailureMechanismAssemblyResultRow CreateStabilityPointsStructuresFailureMechanismAssemblyResultRow()
        {
            StabilityPointStructuresFailureMechanism stabilityPointStructures = AssessmentSection.StabilityPointStructures;

            return(FailureMechanismAssemblyResultRowFactory.CreateRow(
                       stabilityPointStructures, () => StabilityPointStructuresFailureMechanismAssemblyFactory.AssembleFailureMechanism(stabilityPointStructures, AssessmentSection)));
        }
        private FailureMechanismAssemblyResultRow CreateHeightStructuresFailureMechanismAssemblyResultRow()
        {
            HeightStructuresFailureMechanism heightStructures = AssessmentSection.HeightStructures;

            return(FailureMechanismAssemblyResultRowFactory.CreateRow(
                       heightStructures, () => HeightStructuresFailureMechanismAssemblyFactory.AssembleFailureMechanism(heightStructures, AssessmentSection)));
        }
        private FailureMechanismAssemblyResultRow CreatePipingStructureFailureMechanismAssemblyResultRow()
        {
            PipingStructureFailureMechanism pipingStructure = AssessmentSection.PipingStructure;

            return(FailureMechanismAssemblyResultRowFactory.CreateRow(
                       pipingStructure, () => PipingStructureFailureMechanismAssemblyFactory.AssembleFailureMechanism(pipingStructure, AssessmentSection)));
        }
        private FailureMechanismAssemblyResultRow CreateDuneErosionFailureMechanismAssemblyResultRow()
        {
            DuneErosionFailureMechanism duneErosion = AssessmentSection.DuneErosion;

            return(FailureMechanismAssemblyResultRowFactory.CreateRow(
                       duneErosion, () => DuneErosionFailureMechanismAssemblyFactory.AssembleFailureMechanism(duneErosion, AssessmentSection)));
        }
Exemple #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();
        }
Exemple #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();
        }
Exemple #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();
        }
Exemple #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();
        }
 private IEnumerable <FailureMechanismAssemblyResultRow> CreateSpecificFailureMechanismResultRows()
 {
     return(AssessmentSection.SpecificFailureMechanisms
            .Select(fp => FailureMechanismAssemblyResultRowFactory.CreateRow(
                        fp, () => FailureMechanismAssemblyFactory.AssembleFailureMechanism(fp, AssessmentSection))
                    )
            .ToArray());
 }
Exemple #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);
        }
Exemple #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();
        }
 private FailureMechanismAssemblyResultRow CreateStandAloneFailureMechanismAssemblyResultRow <TFailureMechanism>(TFailureMechanism failureMechanism)
     where TFailureMechanism : IHasGeneralInput, IFailureMechanism <NonAdoptableWithProfileProbabilityFailureMechanismSectionResult>
 {
     return(FailureMechanismAssemblyResultRowFactory.CreateRow(
                failureMechanism, () => FailureMechanismAssemblyFactory.AssembleFailureMechanism(failureMechanism, AssessmentSection)));
 }