Index: Riskeer/Common/src/Riskeer.Common.Forms/Helpers/FailureMechanismSectionAssemblyGroupDisplayHelper.cs =================================================================== diff -u --- Riskeer/Common/src/Riskeer.Common.Forms/Helpers/FailureMechanismSectionAssemblyGroupDisplayHelper.cs (revision 0) +++ Riskeer/Common/src/Riskeer.Common.Forms/Helpers/FailureMechanismSectionAssemblyGroupDisplayHelper.cs (revision 4a64277ef497b20aecb01c5494708749b8233c84) @@ -0,0 +1,52 @@ +// Copyright (C) Stichting Deltares 2021. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.ComponentModel; +using Core.Common.Util; +using Riskeer.AssemblyTool.Data; +using Riskeer.AssemblyTool.Forms; + +namespace Riskeer.Common.Forms.Helpers +{ + /// + /// Helper class for displaying . + /// + public static class FailureMechanismSectionAssemblyGroupDisplayHelper + { + /// + /// Gets the display name of the given . + /// + /// The assembly group to get the display name for. + /// The display name. + /// Thrown when + /// is an invalid value. + /// Thrown when + /// is a valid value, but unsupported. + public static string GetAssemblyGroupDisplayName(FailureMechanismSectionAssemblyGroup assemblyGroup) + { + DisplayFailureMechanismSectionAssemblyGroup displayAssemblyGroup = DisplayFailureMechanismSectionAssemblyGroupConverter.Convert( + assemblyGroup); + + return new EnumDisplayWrapper(displayAssemblyGroup).DisplayName; + } + } +} \ No newline at end of file Fisheye: Tag 4a64277ef497b20aecb01c5494708749b8233c84 refers to a dead (removed) revision in file `Riskeer/Common/src/Riskeer.Common.Forms/Helpers/FailureMechanismSectionAssemblyGroupHelper.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/Common/test/Riskeer.Common.Forms.Test/Helpers/FailureMechanismSectionAssemblyGroupDisplayHelperTest.cs =================================================================== diff -u --- Riskeer/Common/test/Riskeer.Common.Forms.Test/Helpers/FailureMechanismSectionAssemblyGroupDisplayHelperTest.cs (revision 0) +++ Riskeer/Common/test/Riskeer.Common.Forms.Test/Helpers/FailureMechanismSectionAssemblyGroupDisplayHelperTest.cs (revision 4a64277ef497b20aecb01c5494708749b8233c84) @@ -0,0 +1,66 @@ +// Copyright (C) Stichting Deltares 2021. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.ComponentModel; +using Core.Common.TestUtil; +using NUnit.Framework; +using Riskeer.AssemblyTool.Data; +using Riskeer.Common.Forms.Helpers; + +namespace Riskeer.Common.Forms.Test.Helpers +{ + [TestFixture] + public class FailureMechanismSectionAssemblyGroupDisplayHelperTest + { + [Test] + public void GetAssemblyGroupDisplayName_InvalidValue_ThrowsInvalidEnumArgumentException() + { + // Call + void Call() => FailureMechanismSectionAssemblyGroupDisplayHelper.GetAssemblyGroupDisplayName((FailureMechanismSectionAssemblyGroup) 99); + + // Assert + var expectedMessage = $"The value of argument 'assemblyGroup' (99) is invalid for Enum type '{nameof(FailureMechanismSectionAssemblyGroup)}'."; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(Call, expectedMessage); + } + + [Test] + [TestCase(FailureMechanismSectionAssemblyGroup.ND, "ND")] + [TestCase(FailureMechanismSectionAssemblyGroup.III, "+III")] + [TestCase(FailureMechanismSectionAssemblyGroup.II, "+II")] + [TestCase(FailureMechanismSectionAssemblyGroup.I, "+I")] + [TestCase(FailureMechanismSectionAssemblyGroup.ZeroPlus, "+0")] + [TestCase(FailureMechanismSectionAssemblyGroup.Zero, "0")] + [TestCase(FailureMechanismSectionAssemblyGroup.IMin, "-I")] + [TestCase(FailureMechanismSectionAssemblyGroup.IIMin, "-II")] + [TestCase(FailureMechanismSectionAssemblyGroup.IIIMin, "-III")] + [TestCase(FailureMechanismSectionAssemblyGroup.D, "D")] + [TestCase(FailureMechanismSectionAssemblyGroup.Gr, "")] + public void GetAssemblyGroupDisplayName_ValidValue_ReturnsDisplayName(FailureMechanismSectionAssemblyGroup categoryGroup, + string expectedDisplayName) + { + // Call + string displayName = FailureMechanismSectionAssemblyGroupDisplayHelper.GetAssemblyGroupDisplayName(categoryGroup); + + // Assert + Assert.AreEqual(expectedDisplayName, displayName); + } + } +} \ No newline at end of file Fisheye: Tag 4a64277ef497b20aecb01c5494708749b8233c84 refers to a dead (removed) revision in file `Riskeer/Common/test/Riskeer.Common.Forms.Test/Helpers/FailureMechanismSectionAssemblyGroupHelperTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/Piping/src/Riskeer.Piping.Forms/Views/PipingFailureMechanismSectionResultRow.cs =================================================================== diff -u -r995aa1582669e2a3ccc92b9a4365ee51f624130b -r4a64277ef497b20aecb01c5494708749b8233c84 --- Riskeer/Piping/src/Riskeer.Piping.Forms/Views/PipingFailureMechanismSectionResultRow.cs (.../PipingFailureMechanismSectionResultRow.cs) (revision 995aa1582669e2a3ccc92b9a4365ee51f624130b) +++ Riskeer/Piping/src/Riskeer.Piping.Forms/Views/PipingFailureMechanismSectionResultRow.cs (.../PipingFailureMechanismSectionResultRow.cs) (revision 4a64277ef497b20aecb01c5494708749b8233c84) @@ -267,7 +267,7 @@ /// /// Gets the assembly group. /// - public string AssemblyGroup => FailureMechanismSectionAssemblyGroupHelper.GetAssemblyGroupDisplayName(AssemblyResult.AssemblyGroup); + public string AssemblyGroup => FailureMechanismSectionAssemblyGroupDisplayHelper.GetAssemblyGroupDisplayName(AssemblyResult.AssemblyGroup); public override void Update() { Index: Riskeer/Piping/test/Riskeer.Piping.Forms.Test/Views/PipingFailureMechanismSectionResultRowTest.cs =================================================================== diff -u -r00f1aeb03b58ee1e86805ce9280cb3baef8b9e40 -r4a64277ef497b20aecb01c5494708749b8233c84 --- Riskeer/Piping/test/Riskeer.Piping.Forms.Test/Views/PipingFailureMechanismSectionResultRowTest.cs (.../PipingFailureMechanismSectionResultRowTest.cs) (revision 00f1aeb03b58ee1e86805ce9280cb3baef8b9e40) +++ Riskeer/Piping/test/Riskeer.Piping.Forms.Test/Views/PipingFailureMechanismSectionResultRowTest.cs (.../PipingFailureMechanismSectionResultRowTest.cs) (revision 4a64277ef497b20aecb01c5494708749b8233c84) @@ -605,7 +605,7 @@ Assert.AreEqual(rowAssemblyResult.ProfileProbability, row.ProfileProbability); Assert.AreEqual(rowAssemblyResult.SectionProbability, row.SectionProbability); Assert.AreEqual(rowAssemblyResult.N, row.SectionN); - Assert.AreEqual(FailureMechanismSectionAssemblyGroupHelper.GetAssemblyGroupDisplayName(rowAssemblyResult.AssemblyGroup), + Assert.AreEqual(FailureMechanismSectionAssemblyGroupDisplayHelper.GetAssemblyGroupDisplayName(rowAssemblyResult.AssemblyGroup), row.AssemblyGroup); }