-
-
Notifications
You must be signed in to change notification settings - Fork 756
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed behaviour of the type analysis when the clr type is a generic type
- Loading branch information
1 parent
38ef66b
commit 10a7746
Showing
4 changed files
with
170 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
using System; | ||
using Xunit; | ||
|
||
namespace HotChocolate.Internal | ||
{ | ||
public class ReflectionUtilsTests | ||
{ | ||
[Fact] | ||
public void GetTypeNameFromGenericType() | ||
{ | ||
// arrange | ||
Type type = typeof(GenericNonNestedFoo<string>); | ||
|
||
// act | ||
string typeName = type.GetTypeName(); | ||
|
||
// assert | ||
Assert.Equal( | ||
"HotChocolate.Internal.GenericNonNestedFoo<System.String>", | ||
typeName); | ||
} | ||
|
||
[Fact] | ||
public void GetTypeNameFromType() | ||
{ | ||
// arrange | ||
Type type = typeof(ReflectionUtilsTests); | ||
|
||
// act | ||
string typeName = type.GetTypeName(); | ||
|
||
// assert | ||
Assert.Equal( | ||
"HotChocolate.Internal.ReflectionUtilsTests", | ||
typeName); | ||
} | ||
|
||
[Fact] | ||
public void GetTypeNameFromGenericNestedType() | ||
{ | ||
// arrange | ||
Type type = typeof(GenericNestedFoo<string>); | ||
|
||
// act | ||
string typeName = type.GetTypeName(); | ||
|
||
// assert | ||
Assert.Equal( | ||
"HotChocolate.Internal.ReflectionUtilsTests.GenericNestedFoo<System.String>", | ||
typeName); | ||
} | ||
|
||
[Fact] | ||
public void GetTypeNameFromNestedType() | ||
{ | ||
// arrange | ||
Type type = typeof(Foo); | ||
|
||
// act | ||
string typeName = type.GetTypeName(); | ||
|
||
// assert | ||
Assert.Equal( | ||
"HotChocolate.Internal.ReflectionUtilsTests.Foo", | ||
typeName); | ||
} | ||
|
||
public class GenericNestedFoo<T> | ||
{ | ||
public T Value { get; } | ||
} | ||
|
||
public class Foo | ||
{ | ||
public string Value { get; } | ||
} | ||
} | ||
|
||
public class GenericNonNestedFoo<T> | ||
{ | ||
public T Value { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters