Index: Riskeer/Common/src/Riskeer.Common.Forms/Factories/RiskeerGraphNodeFactory.cs =================================================================== diff -u -r3265d1d674a16b70b7133f599bb1bc677d245784 -r1384e667040601d692d142d82705afecb2b0661e --- Riskeer/Common/src/Riskeer.Common.Forms/Factories/RiskeerGraphNodeFactory.cs (.../RiskeerGraphNodeFactory.cs) (revision 3265d1d674a16b70b7133f599bb1bc677d245784) +++ Riskeer/Common/src/Riskeer.Common.Forms/Factories/RiskeerGraphNodeFactory.cs (.../RiskeerGraphNodeFactory.cs) (revision 1384e667040601d692d142d82705afecb2b0661e) @@ -30,6 +30,7 @@ using Core.Common.Util; using Core.Components.PointedTree.Data; using Riskeer.Common.Data.IllustrationPoints; +using Riskeer.Common.Forms.Helpers; using Riskeer.Common.Forms.Properties; namespace Riskeer.Common.Forms.Factories @@ -161,9 +162,12 @@ private static string CreateGraphNodeContent(RoundedDouble beta) { + double probability = StatisticsConverter.ReliabilityToProbability(beta); + return string.Format(Resources.GraphNodeConverter_GraphNodeContent_Probability_0_Beta_1, - StatisticsConverter.ReliabilityToProbability(beta).ToString("0.##E+0", CultureInfo.CurrentCulture), - beta); + probability < 0.00001 ? + probability.ToString("0.#####E+0", CultureInfo.CurrentCulture) : + ProbabilityFormattingHelper.Format(StatisticsConverter.ReliabilityToProbability(beta)), beta); } } } \ No newline at end of file Index: Riskeer/Common/test/Riskeer.Common.Forms.Test/Factories/RiskeerGraphNodeFactoryTest.cs =================================================================== diff -u -r8f9a9907d39bd6b9a9418aa2f34aee8b37522d40 -r1384e667040601d692d142d82705afecb2b0661e --- Riskeer/Common/test/Riskeer.Common.Forms.Test/Factories/RiskeerGraphNodeFactoryTest.cs (.../RiskeerGraphNodeFactoryTest.cs) (revision 8f9a9907d39bd6b9a9418aa2f34aee8b37522d40) +++ Riskeer/Common/test/Riskeer.Common.Forms.Test/Factories/RiskeerGraphNodeFactoryTest.cs (.../RiskeerGraphNodeFactoryTest.cs) (revision 1384e667040601d692d142d82705afecb2b0661e) @@ -154,6 +154,44 @@ } [Test] + [TestCase(1, "1/1")] + [TestCase(0.1, "1/10")] + [TestCase(0.00001, "1/100.000")] + [TestCase(0.000012, "1/83.332")] + [TestCase(0.00000123, "1,22998E-6")] + [TestCase(0.0000099, "9,90019E-6")] + public void CreateGraphNode_FaultTreeIllustrationPointNodeDataWithChildren_ReturnsExpectedGraphNodeContent(double probability, string expectedProbability) + { + // Setup + var random = new Random(31); + double beta = StatisticsConverter.ProbabilityToReliability(probability); + var illustrationPoint = new FaultTreeIllustrationPoint( + "Illustration Point", + beta, + Enumerable.Empty(), + random.NextEnumValue()); + + IEnumerable childGraphNodes = new[] + { + CreateTestGraphNode() + }; + + // Call + GraphNode graphNode = RiskeerGraphNodeFactory.CreateGraphNode(illustrationPoint, + childGraphNodes); + + RoundedDouble roundedBeta = ((RoundedDouble) beta).ToPrecision(5); + + string expectedGraphNodeContent = $"{illustrationPoint.Name}{Environment.NewLine}" + + $"{Environment.NewLine}" + + $"Berekende kans* = {expectedProbability}{Environment.NewLine}" + + $"Betrouwbaarheidsindex = {roundedBeta}"; + + // Assert + Assert.AreEqual(expectedGraphNodeContent, graphNode.Content); + } + + [Test] public void CreateGraphNode_WithFaultTreeIllustrationPointButChildrenNull_ThrowsArgumentNullException() { // Setup