Index: Riskeer/Common/src/Riskeer.Common.Data/AssemblyTool/AssemblyToolGroupBoundariesFactory.cs =================================================================== diff -u -rafed83a0655d0c6f8527d6bc41417db7cce91931 -r5c92c1b7301fef7753270ec2fde2f78af73ee48b --- Riskeer/Common/src/Riskeer.Common.Data/AssemblyTool/AssemblyToolGroupBoundariesFactory.cs (.../AssemblyToolGroupBoundariesFactory.cs) (revision afed83a0655d0c6f8527d6bc41417db7cce91931) +++ Riskeer/Common/src/Riskeer.Common.Data/AssemblyTool/AssemblyToolGroupBoundariesFactory.cs (.../AssemblyToolGroupBoundariesFactory.cs) (revision 5c92c1b7301fef7753270ec2fde2f78af73ee48b) @@ -29,7 +29,7 @@ namespace Riskeer.Common.Data.AssemblyTool { /// - /// Factory for calculating the assembly tool group boundaries. + /// Factory for calculating the failure mechanism section assembly group boundaries. /// public static class AssemblyToolGroupBoundariesFactory { Fisheye: Tag 5c92c1b7301fef7753270ec2fde2f78af73ee48b refers to a dead (removed) revision in file `Riskeer/Common/src/Riskeer.Common.Forms/Helpers/AssemblyCategoryGroupColorHelper.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/Common/src/Riskeer.Common.Forms/Helpers/AssessmentSectionAssemblyGroupColorHelper.cs =================================================================== diff -u --- Riskeer/Common/src/Riskeer.Common.Forms/Helpers/AssessmentSectionAssemblyGroupColorHelper.cs (revision 0) +++ Riskeer/Common/src/Riskeer.Common.Forms/Helpers/AssessmentSectionAssemblyGroupColorHelper.cs (revision 5c92c1b7301fef7753270ec2fde2f78af73ee48b) @@ -0,0 +1,73 @@ +// 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 System.Drawing; +using Riskeer.AssemblyTool.Data; + +namespace Riskeer.Common.Forms.Helpers +{ + /// + /// Helper class for determining the colors belonging to various assessment section assembly groups. + /// + public static class AssessmentSectionAssemblyGroupColorHelper + { + /// + /// Gets the color for an assessment section assembly group. + /// + /// The assembly group to get the color for. + /// The corresponding to the given assembly group. + /// Thrown when + /// has an invalid value for . + /// Thrown when + /// is not supported. + public static Color GetAssessmentSectionAssemblyGroupColor(AssessmentSectionAssemblyGroup assessmentSectionAssemblyGroup) + { + if (!Enum.IsDefined(typeof(AssessmentSectionAssemblyGroup), assessmentSectionAssemblyGroup)) + { + throw new InvalidEnumArgumentException(nameof(assessmentSectionAssemblyGroup), + (int) assessmentSectionAssemblyGroup, + typeof(AssessmentSectionAssemblyGroup)); + } + + switch (assessmentSectionAssemblyGroup) + { + case AssessmentSectionAssemblyGroup.APlus: + return Color.FromArgb(0, 255, 0); + case AssessmentSectionAssemblyGroup.A: + return Color.FromArgb(118, 147, 60); + case AssessmentSectionAssemblyGroup.B: + return Color.FromArgb(255, 255, 0); + case AssessmentSectionAssemblyGroup.C: + return Color.FromArgb(255, 153, 0); + case AssessmentSectionAssemblyGroup.D: + return Color.FromArgb(255, 0, 0); + case AssessmentSectionAssemblyGroup.None: + case AssessmentSectionAssemblyGroup.NotApplicable: + case AssessmentSectionAssemblyGroup.NotAssessed: + return Color.White; + default: + throw new NotSupportedException(); + } + } + } +} \ No newline at end of file Fisheye: Tag 5c92c1b7301fef7753270ec2fde2f78af73ee48b refers to a dead (removed) revision in file `Riskeer/Common/test/Riskeer.Common.Forms.Test/Helpers/AssemblyCategoryGroupColorHelperTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/Common/test/Riskeer.Common.Forms.Test/Helpers/AssessmentSectionAssemblyGroupColorHelperTest.cs =================================================================== diff -u --- Riskeer/Common/test/Riskeer.Common.Forms.Test/Helpers/AssessmentSectionAssemblyGroupColorHelperTest.cs (revision 0) +++ Riskeer/Common/test/Riskeer.Common.Forms.Test/Helpers/AssessmentSectionAssemblyGroupColorHelperTest.cs (revision 5c92c1b7301fef7753270ec2fde2f78af73ee48b) @@ -0,0 +1,58 @@ +// 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 System.Drawing; +using Core.Common.TestUtil; +using NUnit.Framework; +using Riskeer.AssemblyTool.Data; +using Riskeer.Common.Forms.Helpers; +using Riskeer.Common.Forms.TestUtil; + +namespace Riskeer.Common.Forms.Test.Helpers +{ + [TestFixture] + public class AssessmentSectionAssemblyGroupColorHelperTest + { + [Test] + public void GetAssessmentSectionAssemblyGroupColorWithInvalidAssessmentSectionAssemblyGroup_ThrowsInvalidEnumArgumentException() + { + // Call + void Call() => AssessmentSectionAssemblyGroupColorHelper.GetAssessmentSectionAssemblyGroupColor((AssessmentSectionAssemblyGroup) 99); + + // Assert + const string expectedMessage = "The value of argument 'assessmentSectionAssemblyGroup' (99) is invalid for Enum type 'AssessmentSectionAssemblyGroup'."; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(Call, expectedMessage); + } + + [Test] + [TestCaseSource(typeof(AssessmentSectionAssemblyGroupColorTestHelper), nameof(AssessmentSectionAssemblyGroupColorTestHelper.AssessmentSectionAssemblyGroupColorCases))] + public void GetAssessmentSectionAssemblyGroupColor_WithAssessmentSectionAssemblyGroup_ReturnsExpectedColor( + AssessmentSectionAssemblyGroup assessmentSectionAssemblyGroup, Color expectedColor) + { + // Call + Color color = AssessmentSectionAssemblyGroupColorHelper.GetAssessmentSectionAssemblyGroupColor(assessmentSectionAssemblyGroup); + + // Assert + Assert.AreEqual(expectedColor, color); + } + } +} \ No newline at end of file Fisheye: Tag 5c92c1b7301fef7753270ec2fde2f78af73ee48b refers to a dead (removed) revision in file `Riskeer/Common/test/Riskeer.Common.Forms.TestUtil/AssemblyCategoryColorTestHelper.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/Common/test/Riskeer.Common.Forms.TestUtil/AssessmentSectionAssemblyGroupColorTestHelper.cs =================================================================== diff -u --- Riskeer/Common/test/Riskeer.Common.Forms.TestUtil/AssessmentSectionAssemblyGroupColorTestHelper.cs (revision 0) +++ Riskeer/Common/test/Riskeer.Common.Forms.TestUtil/AssessmentSectionAssemblyGroupColorTestHelper.cs (revision 5c92c1b7301fef7753270ec2fde2f78af73ee48b) @@ -0,0 +1,53 @@ +// 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.Collections.Generic; +using System.Drawing; +using NUnit.Framework; +using Riskeer.AssemblyTool.Data; + +namespace Riskeer.Common.Forms.TestUtil +{ + /// + /// Class that can be used to assert the color corresponding to assessment section assembly groups. + /// + public static class AssessmentSectionAssemblyGroupColorTestHelper + { + /// + /// Gets a collection of test cases to test the colors belonging to various + /// values. + /// + public static IEnumerable AssessmentSectionAssemblyGroupColorCases + { + get + { + yield return new TestCaseData(AssessmentSectionAssemblyGroup.APlus, Color.FromArgb(0, 255, 0)); + yield return new TestCaseData(AssessmentSectionAssemblyGroup.A, Color.FromArgb(118, 147, 60)); + yield return new TestCaseData(AssessmentSectionAssemblyGroup.B, Color.FromArgb(255, 255, 0)); + yield return new TestCaseData(AssessmentSectionAssemblyGroup.C, Color.FromArgb(255, 153, 0)); + yield return new TestCaseData(AssessmentSectionAssemblyGroup.D, Color.FromArgb(255, 0, 0)); + yield return new TestCaseData(AssessmentSectionAssemblyGroup.None, Color.White); + yield return new TestCaseData(AssessmentSectionAssemblyGroup.NotAssessed, Color.White); + yield return new TestCaseData(AssessmentSectionAssemblyGroup.NotApplicable, Color.White); + } + } + } +} \ No newline at end of file Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Controls/AssessmentSectionAssemblyResultControl.cs =================================================================== diff -u -r921a4a5b07e757058cfdf6a9be5d256cd08c8c12 -r5c92c1b7301fef7753270ec2fde2f78af73ee48b --- Riskeer/Integration/src/Riskeer.Integration.Forms/Controls/AssessmentSectionAssemblyResultControl.cs (.../AssessmentSectionAssemblyResultControl.cs) (revision 921a4a5b07e757058cfdf6a9be5d256cd08c8c12) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/Controls/AssessmentSectionAssemblyResultControl.cs (.../AssessmentSectionAssemblyResultControl.cs) (revision 5c92c1b7301fef7753270ec2fde2f78af73ee48b) @@ -86,7 +86,7 @@ } groupLabel.Text = new EnumDisplayWrapper(result.AssemblyCategoryGroup).DisplayName; - groupLabel.BackColor = AssemblyCategoryGroupColorHelper.GetAssessmentSectionAssemblyCategoryGroupColor(result.AssemblyCategoryGroup); + groupLabel.BackColor = AssessmentSectionAssemblyGroupColorHelper.GetAssessmentSectionAssemblyGroupColor(result.AssemblyCategoryGroup); probabilityLabel.Text = ProbabilityFormattingHelper.FormatWithDiscreteNumbers(result.Probability); } Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssessmentSectionAssemblyGroupsView.cs =================================================================== diff -u -r921a4a5b07e757058cfdf6a9be5d256cd08c8c12 -r5c92c1b7301fef7753270ec2fde2f78af73ee48b --- Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssessmentSectionAssemblyGroupsView.cs (.../AssessmentSectionAssemblyGroupsView.cs) (revision 921a4a5b07e757058cfdf6a9be5d256cd08c8c12) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssessmentSectionAssemblyGroupsView.cs (.../AssessmentSectionAssemblyGroupsView.cs) (revision 5c92c1b7301fef7753270ec2fde2f78af73ee48b) @@ -91,7 +91,7 @@ FailureMechanismContribution.LowerLimitNorm) .Select(group => new Tuple( group, - AssemblyCategoryGroupColorHelper.GetAssessmentSectionAssemblyCategoryGroupColor(group.Group), + AssessmentSectionAssemblyGroupColorHelper.GetAssessmentSectionAssemblyGroupColor(group.Group), group.Group)).ToArray()); } } Index: Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Controls/AssessmentSectionAssemblyResultControlTest.cs =================================================================== diff -u -r921a4a5b07e757058cfdf6a9be5d256cd08c8c12 -r5c92c1b7301fef7753270ec2fde2f78af73ee48b --- Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Controls/AssessmentSectionAssemblyResultControlTest.cs (.../AssessmentSectionAssemblyResultControlTest.cs) (revision 921a4a5b07e757058cfdf6a9be5d256cd08c8c12) +++ Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Controls/AssessmentSectionAssemblyResultControlTest.cs (.../AssessmentSectionAssemblyResultControlTest.cs) (revision 5c92c1b7301fef7753270ec2fde2f78af73ee48b) @@ -222,7 +222,7 @@ { Assert.AreEqual(new EnumDisplayWrapper(result).DisplayName, groupLabel.Text); - Assert.AreEqual(AssemblyCategoryGroupColorHelper.GetAssessmentSectionAssemblyCategoryGroupColor(result), + Assert.AreEqual(AssessmentSectionAssemblyGroupColorHelper.GetAssessmentSectionAssemblyGroupColor(result), groupLabel.BackColor); }