Index: Riskeer/Common/test/Riskeer.Common.Data.Test/AssemblyTool/AssemblyToolHelperTest.cs =================================================================== diff -u -r8bd81257e03971742d60a23ef7ddcb0202988e2d -rc1c8baa0d6dc754d20f83752bd08c29cdaa6fc26 --- Riskeer/Common/test/Riskeer.Common.Data.Test/AssemblyTool/AssemblyToolHelperTest.cs (.../AssemblyToolHelperTest.cs) (revision 8bd81257e03971742d60a23ef7ddcb0202988e2d) +++ Riskeer/Common/test/Riskeer.Common.Data.Test/AssemblyTool/AssemblyToolHelperTest.cs (.../AssemblyToolHelperTest.cs) (revision c1c8baa0d6dc754d20f83752bd08c29cdaa6fc26) @@ -27,6 +27,7 @@ using Rhino.Mocks; using Riskeer.AssemblyTool.Data; using Riskeer.AssemblyTool.KernelWrapper.Calculators; +using Riskeer.AssemblyTool.KernelWrapper.Calculators.Assembly; using Riskeer.AssemblyTool.KernelWrapper.TestUtil.Calculators; using Riskeer.AssemblyTool.KernelWrapper.TestUtil.Calculators.Assembly; using Riskeer.Common.Data.AssemblyTool; @@ -302,5 +303,45 @@ mocks.VerifyAll(); } + + [Test] + public void AssembleFailureMechanism_WithFailurePathInAssemblyAndProbabilityResultTypeAutomaticAndFailureMechanismAssemblyThrowsException_ThrowsAssemblyException() + { + // Setup + var mocks = new MockRepository(); + var failurePath = mocks.Stub>(); + failurePath.Stub(fp => fp.AssemblyResult) + .Return(new FailurePathAssemblyResult + { + ProbabilityResultType = FailurePathAssemblyProbabilityResultType.Automatic, + ManualFailurePathAssemblyProbability = double.NaN + }); + failurePath.Stub(fp => fp.SectionResults) + .Return(new ObservableList + { + new TestFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) + }); + mocks.ReplayAll(); + + failurePath.InAssembly = true; + + using (new AssemblyToolCalculatorFactoryConfig()) + { + var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; + FailureMechanismAssemblyCalculatorStub failureMechanismAssemblyCalculator = calculatorFactory.LastCreatedFailureMechanismAssemblyCalculator; + failureMechanismAssemblyCalculator.ThrowExceptionOnCalculate = true; + + // Call + void Call() => AssemblyToolHelper.AssemblyFailureMechanism(failurePath, sr => null, double.NaN); + + // Assert + var exception = Assert.Throws(Call); + Exception innerException = exception.InnerException; + Assert.IsInstanceOf(innerException); + Assert.AreEqual(innerException.Message, exception.Message); + } + + mocks.VerifyAll(); + } } } \ No newline at end of file