Index: Core/Common/test/Core.Common.TestUtil/Properties/Resources.Designer.cs =================================================================== diff -u -r3d088548dfdebfd5c3adbbd67075b42e134f5c03 -r7aa6fe496ac776030c01c7153d079319d260f5d2 --- Core/Common/test/Core.Common.TestUtil/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 3d088548dfdebfd5c3adbbd67075b42e134f5c03) +++ Core/Common/test/Core.Common.TestUtil/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 7aa6fe496ac776030c01c7153d079319d260f5d2) @@ -1,4 +1,4 @@ -// Copyright (C) Stichting Deltares 2021. All rights reserved. +// Copyright (C) Stichting Deltares 2021. All rights reserved. // // This file is part of Riskeer. // @@ -100,5 +100,14 @@ return ((System.Drawing.Bitmap)(obj)); } } + + /// + /// Looks up a localized string similar to Display name. + /// + internal static string TestEnum_DisplayNameValueDisplayName { + get { + return ResourceManager.GetString("TestEnum_DisplayNameValueDisplayName", resourceCulture); + } + } } } Index: Core/Common/test/Core.Common.TestUtil/Properties/Resources.resx =================================================================== diff -u -r96c96a5f55735cb1d019a5fd8677200e2079284d -r7aa6fe496ac776030c01c7153d079319d260f5d2 --- Core/Common/test/Core.Common.TestUtil/Properties/Resources.resx (.../Resources.resx) (revision 96c96a5f55735cb1d019a5fd8677200e2079284d) +++ Core/Common/test/Core.Common.TestUtil/Properties/Resources.resx (.../Resources.resx) (revision 7aa6fe496ac776030c01c7153d079319d260f5d2) @@ -124,4 +124,7 @@ ..\Resources\database.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + Display name + \ No newline at end of file Index: Core/Common/test/Core.Common.TestUtil/TestEnum.cs =================================================================== diff -u --- Core/Common/test/Core.Common.TestUtil/TestEnum.cs (revision 0) +++ Core/Common/test/Core.Common.TestUtil/TestEnum.cs (revision 7aa6fe496ac776030c01c7153d079319d260f5d2) @@ -0,0 +1,37 @@ +// 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 Lesser 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 Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser 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.TestUtil.Properties; +using Core.Common.Util.Attributes; + +namespace Core.Common.TestUtil +{ + /// + /// Simple enum that can be used in tests. + /// + public enum TestEnum + { + NoDisplayName, + + [ResourcesDisplayName(typeof(Resources), nameof(Resources.TestEnum_DisplayNameValueDisplayName))] + DisplayName + } +} \ No newline at end of file Index: Core/Common/test/Core.Common.Util.Test/EnumDisplayWrapperTest.cs =================================================================== diff -u -r3d088548dfdebfd5c3adbbd67075b42e134f5c03 -r7aa6fe496ac776030c01c7153d079319d260f5d2 --- Core/Common/test/Core.Common.Util.Test/EnumDisplayWrapperTest.cs (.../EnumDisplayWrapperTest.cs) (revision 3d088548dfdebfd5c3adbbd67075b42e134f5c03) +++ Core/Common/test/Core.Common.Util.Test/EnumDisplayWrapperTest.cs (.../EnumDisplayWrapperTest.cs) (revision 7aa6fe496ac776030c01c7153d079319d260f5d2) @@ -20,9 +20,8 @@ // All rights reserved. using System; -using Core.Common.Util.Attributes; +using Core.Common.TestUtil; using Core.Common.Util.Exceptions; -using Core.Common.Util.Test.Properties; using NUnit.Framework; namespace Core.Common.Util.Test @@ -76,7 +75,7 @@ string displayName = wrapper.DisplayName; // Assert - Assert.AreEqual(Resources.EnumDisplayWrapperTest_DisplayNameValueDisplayName, displayName); + Assert.AreEqual("Display name", displayName); } [Test] @@ -91,13 +90,5 @@ // Assert Assert.AreEqual(wrapper.DisplayName, wrapperToString); } - - private enum TestEnum - { - NoDisplayName, - - [ResourcesDisplayName(typeof(Resources), nameof(Resources.EnumDisplayWrapperTest_DisplayNameValueDisplayName))] - DisplayName - } } } \ No newline at end of file Index: Core/Common/test/Core.Common.Util.Test/Properties/Resources.Designer.cs =================================================================== diff -u -rb63fade0e22ce3993cd31e2ced93261ed43e6c42 -r7aa6fe496ac776030c01c7153d079319d260f5d2 --- Core/Common/test/Core.Common.Util.Test/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision b63fade0e22ce3993cd31e2ced93261ed43e6c42) +++ Core/Common/test/Core.Common.Util.Test/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 7aa6fe496ac776030c01c7153d079319d260f5d2) @@ -1,4 +1,4 @@ -// Copyright (C) Stichting Deltares 2021. All rights reserved. +// Copyright (C) Stichting Deltares 2021. All rights reserved. // // This file is part of Riskeer. // @@ -131,15 +131,6 @@ } /// - /// Looks up a localized string similar to Display name. - /// - internal static string EnumDisplayWrapperTest_DisplayNameValueDisplayName { - get { - return ResourceManager.GetString("EnumDisplayWrapperTest_DisplayNameValueDisplayName", resourceCulture); - } - } - - /// /// Looks up a localized string similar to Awesome enum value. /// internal static string EnumStringResource { Index: Core/Common/test/Core.Common.Util.Test/Properties/Resources.resx =================================================================== diff -u -rb63fade0e22ce3993cd31e2ced93261ed43e6c42 -r7aa6fe496ac776030c01c7153d079319d260f5d2 --- Core/Common/test/Core.Common.Util.Test/Properties/Resources.resx (.../Resources.resx) (revision b63fade0e22ce3993cd31e2ced93261ed43e6c42) +++ Core/Common/test/Core.Common.Util.Test/Properties/Resources.resx (.../Resources.resx) (revision 7aa6fe496ac776030c01c7153d079319d260f5d2) @@ -148,9 +148,6 @@ Awesome method value - - Display name - <first> Index: Riskeer/Common/test/Riskeer.Common.Forms.Test/Builders/FailureMechanismSectionResultViewColumnBuilderTest.cs =================================================================== diff -u -rbc54874a0f939d22f710507d58b9b6178727523e -r7aa6fe496ac776030c01c7153d079319d260f5d2 --- Riskeer/Common/test/Riskeer.Common.Forms.Test/Builders/FailureMechanismSectionResultViewColumnBuilderTest.cs (.../FailureMechanismSectionResultViewColumnBuilderTest.cs) (revision bc54874a0f939d22f710507d58b9b6178727523e) +++ Riskeer/Common/test/Riskeer.Common.Forms.Test/Builders/FailureMechanismSectionResultViewColumnBuilderTest.cs (.../FailureMechanismSectionResultViewColumnBuilderTest.cs) (revision 7aa6fe496ac776030c01c7153d079319d260f5d2) @@ -24,6 +24,7 @@ using System.Linq; using System.Windows.Forms; using Core.Common.Controls.DataGrid; +using Core.Common.TestUtil; using Core.Common.Util; using NUnit.Extensions.Forms; using NUnit.Framework; @@ -172,7 +173,7 @@ public void AddInitialFailureMechanismResultTypeColumn_DataGridViewControlNull_ThrowsArgumentNullException() { // Call - void Call() => FailureMechanismSectionResultViewColumnBuilder.AddInitialFailureMechanismResultTypeColumn(null, "property"); + void Call() => FailureMechanismSectionResultViewColumnBuilder.AddInitialFailureMechanismResultTypeColumn(null, "property"); // Assert var exception = Assert.Throws(Call); @@ -183,7 +184,7 @@ public void AddInitialFailureMechanismResultTypeColumn_DataPropertyNameNull_ThrowsArgumentNullException() { // Call - void Call() => FailureMechanismSectionResultViewColumnBuilder.AddInitialFailureMechanismResultTypeColumn(new DataGridViewControl(), null); + void Call() => FailureMechanismSectionResultViewColumnBuilder.AddInitialFailureMechanismResultTypeColumn(new DataGridViewControl(), null); // Assert var exception = Assert.Throws(Call); @@ -205,7 +206,7 @@ Assert.AreEqual(0, dataGridView.ColumnCount); // Call - FailureMechanismSectionResultViewColumnBuilder.AddInitialFailureMechanismResultTypeColumn(control, dataPropertyName); + FailureMechanismSectionResultViewColumnBuilder.AddInitialFailureMechanismResultTypeColumn(control, dataPropertyName); // Assert Assert.AreEqual(1, dataGridView.ColumnCount); @@ -216,8 +217,8 @@ Assert.AreEqual("Value", columnData.ValueMember); Assert.AreEqual("DisplayName", columnData.DisplayMember); - IEnumerable> expectedDataSource = CreateExpectedEnumDisplayWrappers(); - AssertEnumDisplayWrappersAreEqual(expectedDataSource, (EnumDisplayWrapper[]) columnData.DataSource); + IEnumerable> expectedDataSource = CreateExpectedEnumDisplayWrappers(); + AssertEnumDisplayWrappersAreEqual(expectedDataSource, (EnumDisplayWrapper[]) columnData.DataSource); } }