VALIDATEOBJECT(target);
TypeHandle th = target->GetType();
- if (!th.IsEnum())
- FCThrowArgument(NULL, NULL);
-
+ _ASSERTE(th.IsEnum());
+
OBJECTREF result = NULL;
HELPER_METHOD_FRAME_BEGIN_RET_0();
public static void ConvertTo_WithContext_Negative()
{
AssertExtensions.Throws<ArgumentException>(null, () => EnumConverterTests.s_someEnumConverter.ConvertTo(TypeConverterTests.s_context, null, 3, typeof(string)));
- AssertExtensions.Throws<ArgumentException>(null, "enumType", () => new EnumConverter(typeof(Enum)).ConvertTo(TypeConverterTests.s_context, null, SomeFlagsEnum.Option1, typeof(string)));
+ AssertExtensions.Throws<ArgumentException>("enumType", () => new EnumConverter(typeof(Enum)).ConvertTo(TypeConverterTests.s_context, null, SomeFlagsEnum.Option1, typeof(string)));
}
[Fact]
if (value == null)
throw new ArgumentNullException(nameof(value));
+ if (!IsEnum)
+ throw new ArgumentException(SR.Arg_MustBeEnum, "enumType");
+
// Check if both of them are of the same type
RuntimeType valueType = (RuntimeType)value.GetType();
}
[Fact]
- [ActiveIssue("https://github.com/mono/mono/issues/15028", TestRuntimes.Mono)]
public void IsEnumDefined_Invalid()
{
- AssertExtensions.Throws<ArgumentException>("", () => typeof(NonGenericClassWithNoInterfaces).GetTypeInfo().IsEnumDefined(10));
+ AssertExtensions.Throws<ArgumentException>("enumType", () => typeof(NonGenericClassWithNoInterfaces).GetTypeInfo().IsEnumDefined(10));
+ AssertExtensions.Throws<ArgumentException>("enumType", () => typeof(NonGenericClassWithNoInterfaces).GetTypeInfo().IsEnumDefined("10"));
Assert.Throws<ArgumentNullException>(() => typeof(IntEnum).GetTypeInfo().IsEnumDefined(null));
Assert.Throws<InvalidOperationException>(() => typeof(IntEnum).GetTypeInfo().IsEnumDefined(new NonGenericClassWithNoInterfaces()));
}