Index: Core/Components/src/Core.Components.GraphSharp.Forms/Converters/PointedTreeVertexTypeToStringConverter.cs =================================================================== diff -u -r6189fae3f21e2ee5eac80441472c2bcd5124c3da -r7824b1299ee61690e6bbbb5e665c80e516813653 --- Core/Components/src/Core.Components.GraphSharp.Forms/Converters/PointedTreeVertexTypeToStringConverter.cs (.../PointedTreeVertexTypeToStringConverter.cs) (revision 6189fae3f21e2ee5eac80441472c2bcd5124c3da) +++ Core/Components/src/Core.Components.GraphSharp.Forms/Converters/PointedTreeVertexTypeToStringConverter.cs (.../PointedTreeVertexTypeToStringConverter.cs) (revision 7824b1299ee61690e6bbbb5e665c80e516813653) @@ -34,7 +34,7 @@ { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { - if (targetType != typeof(string) || value == null) + if (value == null) { return null; } @@ -46,7 +46,9 @@ case PointedTreeVertexType.Diamond: return "Diamond"; default: - throw new InvalidEnumArgumentException(); + throw new InvalidEnumArgumentException(nameof(value), + (int) value, + typeof(PointedTreeVertexType)); } } Index: Core/Components/src/Core.Components.GraphSharp.Forms/Core.Components.GraphSharp.Forms.csproj =================================================================== diff -u -r6189fae3f21e2ee5eac80441472c2bcd5124c3da -r7824b1299ee61690e6bbbb5e665c80e516813653 --- Core/Components/src/Core.Components.GraphSharp.Forms/Core.Components.GraphSharp.Forms.csproj (.../Core.Components.GraphSharp.Forms.csproj) (revision 6189fae3f21e2ee5eac80441472c2bcd5124c3da) +++ Core/Components/src/Core.Components.GraphSharp.Forms/Core.Components.GraphSharp.Forms.csproj (.../Core.Components.GraphSharp.Forms.csproj) (revision 7824b1299ee61690e6bbbb5e665c80e516813653) @@ -101,6 +101,11 @@ + + {F49BD8B2-332A-4C91-A196-8CCE0A2C7D98} + Core.Common.Utils + False + {32358941-77c5-48a7-ad8b-dfb4f23b12a5} Core.Components.GraphSharp Index: Core/Components/test/Core.Components.GraphSharp.Forms.Test/Converters/PointedTreeVertexTypeToStringConverterTest.cs =================================================================== diff -u -r6189fae3f21e2ee5eac80441472c2bcd5124c3da -r7824b1299ee61690e6bbbb5e665c80e516813653 --- Core/Components/test/Core.Components.GraphSharp.Forms.Test/Converters/PointedTreeVertexTypeToStringConverterTest.cs (.../PointedTreeVertexTypeToStringConverterTest.cs) (revision 6189fae3f21e2ee5eac80441472c2bcd5124c3da) +++ Core/Components/test/Core.Components.GraphSharp.Forms.Test/Converters/PointedTreeVertexTypeToStringConverterTest.cs (.../PointedTreeVertexTypeToStringConverterTest.cs) (revision 7824b1299ee61690e6bbbb5e665c80e516813653) @@ -20,8 +20,10 @@ // All rights reserved. using System; +using System.ComponentModel; using System.Globalization; using System.Windows.Data; +using Core.Common.TestUtil; using Core.Components.GraphSharp.Data; using Core.Components.GraphSharp.Forms.Converters; using NUnit.Framework; @@ -55,16 +57,17 @@ } [Test] - public void Convert_TargetTypeNotString_ReturnNull() + public void Convert_InvalidPointedTreeVertexType_ThrowsInvalidEnumArgumentException() { // Setup var converter = new PointedTreeVertexTypeToStringConverter(); // Call - object convertedValue = converter.Convert(string.Empty, typeof(object), null, CultureInfo.InvariantCulture); + TestDelegate test = () => converter.Convert((PointedTreeVertexType) 99, typeof(string), null, CultureInfo.InvariantCulture); // Assert - Assert.IsNull(convertedValue); + const string message = "The value of argument 'value' (99) is invalid for Enum type 'PointedTreeVertexType'."; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, message); } [Test] Index: Core/Components/test/Core.Components.GraphSharp.Forms.Test/Core.Components.GraphSharp.Forms.Test.csproj =================================================================== diff -u -r6189fae3f21e2ee5eac80441472c2bcd5124c3da -r7824b1299ee61690e6bbbb5e665c80e516813653 --- Core/Components/test/Core.Components.GraphSharp.Forms.Test/Core.Components.GraphSharp.Forms.Test.csproj (.../Core.Components.GraphSharp.Forms.Test.csproj) (revision 6189fae3f21e2ee5eac80441472c2bcd5124c3da) +++ Core/Components/test/Core.Components.GraphSharp.Forms.Test/Core.Components.GraphSharp.Forms.Test.csproj (.../Core.Components.GraphSharp.Forms.Test.csproj) (revision 7824b1299ee61690e6bbbb5e665c80e516813653) @@ -96,6 +96,10 @@ + + {D749EE4C-CE50-4C17-BF01-9A953028C126} + Core.Common.TestUtil + {4e575459-ad64-4f5f-b313-9f8e0ec8c03f} Core.Components.GraphSharp.Forms