-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* enhanced IsNullable methods * XML doc updates and some cleanup * updated editorconfig
- Loading branch information
1 parent
e177602
commit 7c541a9
Showing
24 changed files
with
255 additions
and
75 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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,40 @@ | ||
using System.Collections.Generic; | ||
using JK.Common.TypeHelpers; | ||
using JK.Common.TypeHelpers; | ||
|
||
namespace JK.Common.Tests.TypeHelpers; | ||
|
||
public class TypeHelperTests | ||
{ | ||
[Theory] | ||
[MemberData(nameof(IsNullable_Data))] | ||
public void IsNullable_Tests(Type type, bool expected) | ||
[MemberData(nameof(IsNullableT_Data))] | ||
public void IsNullableT_Theories(Type type, bool expected) | ||
{ | ||
var actual = TypeHelper.IsNullable(type); | ||
var actual = TypeHelper.IsNullableT(type); | ||
Assert.Equal(expected, actual); | ||
} | ||
|
||
[Fact] | ||
public void IsNullableT_False() | ||
{ | ||
var actual = TypeHelper.IsNullable<int>(); | ||
Assert.False(actual); | ||
} | ||
public static TheoryData<Type, bool> IsNullableT_Data() | ||
=> new() | ||
{ | ||
{ typeof(int), false }, | ||
{ typeof(int?), true }, | ||
{ typeof(string), false }, | ||
{ typeof(ComplexObject), false }, | ||
}; | ||
|
||
[Fact] | ||
public void IsNullableT_True() | ||
[Theory] | ||
[MemberData(nameof(IsNullable_Data))] | ||
public void IsNullable_Theories(Type type, bool expected) | ||
{ | ||
var actual = TypeHelper.IsNullable<int?>(); | ||
Assert.True(actual); | ||
var actual = TypeHelper.IsNullable(type); | ||
Assert.Equal(expected, actual); | ||
} | ||
|
||
public static IEnumerable<object[]> IsNullable_Data() | ||
=> new List<object[]> | ||
public static TheoryData<Type, bool> IsNullable_Data() | ||
=> new() | ||
{ | ||
new object[] { typeof(int), false }, | ||
new object[] { typeof(int?), true }, | ||
new object[] { typeof(ComplexObject), false } | ||
{ typeof(int), false }, | ||
{ typeof(int?), true }, | ||
{ typeof(string), true }, | ||
{ typeof(ComplexObject), true } | ||
}; | ||
} |
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
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
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
Oops, something went wrong.