Skip to content

Commit

Permalink
build fix?
Browse files Browse the repository at this point in the history
  • Loading branch information
adamsitnik committed Feb 19, 2024
1 parent 17a46f7 commit 8d9b537
Showing 1 changed file with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,19 @@ public void GetTypeByName_ValidType_ReturnsExpected(string typeName, Type expect
Assert.Equal(expectedType, Type.GetType(typeName.ToLower(), throwOnError: false, ignoreCase: true));
}

public static IEnumerable<object[]> GetTypeByName_Invalid_ClrArguments()
{
Type expectedException = PlatformDetection.IsMonoRuntime
? typeof(ArgumentException) // https://github.com/dotnet/runtime/issues/45033
: typeof(TypeLoadException);

yield return new object[] { "System.Int32&&", expectedException, true };
yield return new object[] { "System.Int32&*", expectedException, true };
yield return new object[] { "System.Int32&[]", expectedException, true };
yield return new object[] { "System.Int32&[*]", expectedException, true };
yield return new object[] { "System.Int32&[,]", expectedException, true };
}

[Theory]
[InlineData("system.nullable`1[system.int32]", typeof(TypeLoadException), false)]
[InlineData("System.NonExistingType", typeof(TypeLoadException), false)]
Expand All @@ -522,11 +535,7 @@ public void GetTypeByName_ValidType_ReturnsExpected(string typeName, Type expect
[InlineData("Outside`1[System.Boolean, System.Int32]", typeof(ArgumentException), true)]
[InlineData(".System.Int32", typeof(TypeLoadException), false)]
[InlineData("..Outside`1", typeof(TypeLoadException), false)]
[InlineData("System.Int32&&", typeof(TypeLoadException), false)]
[InlineData("System.Int32&*", typeof(TypeLoadException), false)]
[InlineData("System.Int32&[]", typeof(TypeLoadException), false)]
[InlineData("System.Int32&[*]", typeof(TypeLoadException), false)]
[InlineData("System.Int32&[,]", typeof(TypeLoadException), false)]
[MemberData(nameof(GetTypeByName_Invalid_ClrArguments))]
public void GetTypeByName_Invalid(string typeName, Type expectedException, bool alwaysThrowsException)
{
if (!alwaysThrowsException)
Expand Down

0 comments on commit 8d9b537

Please sign in to comment.