Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.Forms/DisplayAssessmentSectionAssemblyCategoryGroup.cs =================================================================== diff -u --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.Forms/DisplayAssessmentSectionAssemblyCategoryGroup.cs (revision 0) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.Forms/DisplayAssessmentSectionAssemblyCategoryGroup.cs (revision 20410c8a25492802a771e8a90144d3805780f62e) @@ -0,0 +1,47 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets 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 Core.Common.Util.Attributes; +using Ringtoets.AssemblyTool.Forms.Properties; + +namespace Ringtoets.AssemblyTool.Forms +{ + /// + /// Enum defining the assembly categories to display for an assessment section. + /// + public enum DisplayAssessmentSectionAssemblyCategoryGroup + { + [ResourcesDisplayName(typeof(Resources), nameof(Resources.DisplayAssessmentSectionAssemblyCategoryGroup_APlus_DisplayName))] + APlus = 1, + + [ResourcesDisplayName(typeof(Resources), nameof(Resources.DisplayAssessmentSectionAssemblyCategoryGroup_A_DisplayName))] + A = 2, + + [ResourcesDisplayName(typeof(Resources), nameof(Resources.DisplayAssessmentSectionAssemblyCategoryGroup_B_DisplayName))] + B = 3, + + [ResourcesDisplayName(typeof(Resources), nameof(Resources.DisplayAssessmentSectionAssemblyCategoryGroup_C_DisplayName))] + C = 4, + + [ResourcesDisplayName(typeof(Resources), nameof(Resources.DisplayAssessmentSectionAssemblyCategoryGroup_D_DisplayName))] + D = 5 + } +} \ No newline at end of file Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.Forms/DisplayAssessmentSectionAssemblyCategoryGroupConverter.cs =================================================================== diff -u --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.Forms/DisplayAssessmentSectionAssemblyCategoryGroupConverter.cs (revision 0) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.Forms/DisplayAssessmentSectionAssemblyCategoryGroupConverter.cs (revision 20410c8a25492802a771e8a90144d3805780f62e) @@ -0,0 +1,70 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets 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 Ringtoets.AssemblyTool.Data; + +namespace Ringtoets.AssemblyTool.Forms +{ + /// + /// Converter to convert + /// into . + /// + public static class DisplayAssessmentSectionAssemblyCategoryGroupConverter + { + /// + /// Converts into + /// . + /// + /// The group to convert. + /// The converted . + /// Thrown when + /// is an invalid value. + /// Thrown when + /// is a valid value, but unsupported. + public static DisplayAssessmentSectionAssemblyCategoryGroup Convert(AssessmentSectionAssemblyCategoryGroup categoryGroup) + { + if (!Enum.IsDefined(typeof(AssessmentSectionAssemblyCategoryGroup), categoryGroup)) + { + throw new InvalidEnumArgumentException(nameof(categoryGroup), + (int) categoryGroup, + typeof(AssessmentSectionAssemblyCategoryGroup)); + } + + switch (categoryGroup) + { + case AssessmentSectionAssemblyCategoryGroup.APlus: + return DisplayAssessmentSectionAssemblyCategoryGroup.APlus; + case AssessmentSectionAssemblyCategoryGroup.A: + return DisplayAssessmentSectionAssemblyCategoryGroup.A; + case AssessmentSectionAssemblyCategoryGroup.B: + return DisplayAssessmentSectionAssemblyCategoryGroup.B; + case AssessmentSectionAssemblyCategoryGroup.C: + return DisplayAssessmentSectionAssemblyCategoryGroup.C; + case AssessmentSectionAssemblyCategoryGroup.D: + return DisplayAssessmentSectionAssemblyCategoryGroup.D; + default: + throw new NotSupportedException(); + } + } + } +} \ No newline at end of file Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -r77cd65fa92945a8edbc4e7bf15f59459c404b97a -r20410c8a25492802a771e8a90144d3805780f62e --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 77cd65fa92945a8edbc4e7bf15f59459c404b97a) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 20410c8a25492802a771e8a90144d3805780f62e) @@ -82,6 +82,51 @@ } /// + /// Looks up a localized string similar to A. + /// + internal static string DisplayAssessmentSectionAssemblyCategoryGroup_A_DisplayName { + get { + return ResourceManager.GetString("DisplayAssessmentSectionAssemblyCategoryGroup_A_DisplayName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A+. + /// + internal static string DisplayAssessmentSectionAssemblyCategoryGroup_APlus_DisplayName { + get { + return ResourceManager.GetString("DisplayAssessmentSectionAssemblyCategoryGroup_APlus_DisplayName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to B. + /// + internal static string DisplayAssessmentSectionAssemblyCategoryGroup_B_DisplayName { + get { + return ResourceManager.GetString("DisplayAssessmentSectionAssemblyCategoryGroup_B_DisplayName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to C. + /// + internal static string DisplayAssessmentSectionAssemblyCategoryGroup_C_DisplayName { + get { + return ResourceManager.GetString("DisplayAssessmentSectionAssemblyCategoryGroup_C_DisplayName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to D. + /// + internal static string DisplayAssessmentSectionAssemblyCategoryGroup_D_DisplayName { + get { + return ResourceManager.GetString("DisplayAssessmentSectionAssemblyCategoryGroup_D_DisplayName", resourceCulture); + } + } + + /// /// Looks up a localized string similar to . /// internal static string DisplayFailureMechanismSectionAssemblyCategoryGroup_None_DisplayName { Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.Forms/Properties/Resources.resx =================================================================== diff -u -r77cd65fa92945a8edbc4e7bf15f59459c404b97a -r20410c8a25492802a771e8a90144d3805780f62e --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.Forms/Properties/Resources.resx (.../Resources.resx) (revision 77cd65fa92945a8edbc4e7bf15f59459c404b97a) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.Forms/Properties/Resources.resx (.../Resources.resx) (revision 20410c8a25492802a771e8a90144d3805780f62e) @@ -150,4 +150,19 @@ NVT + + A+ + + + A + + + B + + + C + + + D + \ No newline at end of file Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.Forms/Ringtoets.AssemblyTool.Forms.csproj =================================================================== diff -u -re770aa409686b28f0e540a0303332ac0d908eaa0 -r20410c8a25492802a771e8a90144d3805780f62e --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.Forms/Ringtoets.AssemblyTool.Forms.csproj (.../Ringtoets.AssemblyTool.Forms.csproj) (revision e770aa409686b28f0e540a0303332ac0d908eaa0) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.Forms/Ringtoets.AssemblyTool.Forms.csproj (.../Ringtoets.AssemblyTool.Forms.csproj) (revision 20410c8a25492802a771e8a90144d3805780f62e) @@ -11,7 +11,9 @@ + + @@ -43,6 +45,7 @@ ResXFileCodeGenerator Resources.Designer.cs + Designer \ No newline at end of file Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.Forms.Test/DisplayAssessmentSectionAssemblyCategoryGroupConverterTest.cs =================================================================== diff -u --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.Forms.Test/DisplayAssessmentSectionAssemblyCategoryGroupConverterTest.cs (revision 0) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.Forms.Test/DisplayAssessmentSectionAssemblyCategoryGroupConverterTest.cs (revision 20410c8a25492802a771e8a90144d3805780f62e) @@ -0,0 +1,59 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets 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 Ringtoets.AssemblyTool.Data; + +namespace Ringtoets.AssemblyTool.Forms.Test +{ + [TestFixture] + public class DisplayAssessmentSectionAssemblyCategoryGroupConverterTest + { + [Test] + public void Convert_InvalidValue_ThrowsInvalidEnumArgumentException() + { + // Call + TestDelegate test = () => DisplayAssessmentSectionAssemblyCategoryGroupConverter.Convert((AssessmentSectionAssemblyCategoryGroup) 99); + + // Assert + const string expectedMessage = "The value of argument 'categoryGroup' (99) is invalid for Enum type 'AssessmentSectionAssemblyCategoryGroup'."; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage); + } + + [Test] + [TestCase(AssessmentSectionAssemblyCategoryGroup.APlus, DisplayAssessmentSectionAssemblyCategoryGroup.APlus)] + [TestCase(AssessmentSectionAssemblyCategoryGroup.A, DisplayAssessmentSectionAssemblyCategoryGroup.A)] + [TestCase(AssessmentSectionAssemblyCategoryGroup.B, DisplayAssessmentSectionAssemblyCategoryGroup.B)] + [TestCase(AssessmentSectionAssemblyCategoryGroup.C, DisplayAssessmentSectionAssemblyCategoryGroup.C)] + [TestCase(AssessmentSectionAssemblyCategoryGroup.D, DisplayAssessmentSectionAssemblyCategoryGroup.D)] + public void Convert_ValidValue_ReturnsConvertedValue(AssessmentSectionAssemblyCategoryGroup categoryGroup, + DisplayAssessmentSectionAssemblyCategoryGroup expectedDisplayCategoryGroup) + { + // Call + DisplayAssessmentSectionAssemblyCategoryGroup displayCategoryGroup = DisplayAssessmentSectionAssemblyCategoryGroupConverter.Convert(categoryGroup); + + // Assert + Assert.AreEqual(expectedDisplayCategoryGroup, displayCategoryGroup); + } + } +} \ No newline at end of file Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.Forms.Test/DisplayAssessmentSectionAssemblyCategoryGroupTest.cs =================================================================== diff -u --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.Forms.Test/DisplayAssessmentSectionAssemblyCategoryGroupTest.cs (revision 0) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.Forms.Test/DisplayAssessmentSectionAssemblyCategoryGroupTest.cs (revision 20410c8a25492802a771e8a90144d3805780f62e) @@ -0,0 +1,81 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets 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 Core.Common.TestUtil; +using NUnit.Framework; + +namespace Ringtoets.AssemblyTool.Forms.Test +{ + [TestFixture] + public class DisplayAssessmentSectionAssemblyCategoryGroupTest : EnumWithDisplayNameTestFixture + { + protected override IDictionary ExpectedValueForEnumValues + { + get + { + return new Dictionary + { + { + DisplayAssessmentSectionAssemblyCategoryGroup.APlus, 1 + }, + { + DisplayAssessmentSectionAssemblyCategoryGroup.A, 2 + }, + { + DisplayAssessmentSectionAssemblyCategoryGroup.B, 3 + }, + { + DisplayAssessmentSectionAssemblyCategoryGroup.C, 4 + }, + { + DisplayAssessmentSectionAssemblyCategoryGroup.D, 5 + } + }; + } + } + + protected override IDictionary ExpectedDisplayNameForEnumValues + { + get + { + return new Dictionary + { + { + DisplayAssessmentSectionAssemblyCategoryGroup.APlus, "A+" + }, + { + DisplayAssessmentSectionAssemblyCategoryGroup.A, "A" + }, + { + DisplayAssessmentSectionAssemblyCategoryGroup.B, "B" + }, + { + DisplayAssessmentSectionAssemblyCategoryGroup.C, "C" + }, + { + DisplayAssessmentSectionAssemblyCategoryGroup.D, "D" + } + }; + } + } + } +} \ No newline at end of file Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.Forms.Test/Ringtoets.AssemblyTool.Forms.Test.csproj =================================================================== diff -u -re770aa409686b28f0e540a0303332ac0d908eaa0 -r20410c8a25492802a771e8a90144d3805780f62e --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.Forms.Test/Ringtoets.AssemblyTool.Forms.Test.csproj (.../Ringtoets.AssemblyTool.Forms.Test.csproj) (revision e770aa409686b28f0e540a0303332ac0d908eaa0) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.Forms.Test/Ringtoets.AssemblyTool.Forms.Test.csproj (.../Ringtoets.AssemblyTool.Forms.Test.csproj) (revision 20410c8a25492802a771e8a90144d3805780f62e) @@ -14,7 +14,9 @@ + +