File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
tests/NetEvolve.Arguments.Tests.Unit Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 22
33using System ;
44using System . Collections . Generic ;
5+ using System . Threading . Tasks ;
56using TUnit . Assertions . Extensions ;
67
78public sealed partial class ArgumentTests
@@ -58,6 +59,28 @@ public void ThrowIfNullOrEmpty_WhenIEnumerableNull_ThrowsArgumentNullException()
5859 _ = Assert . Throws < ArgumentNullException > ( nameof ( argument ) , Act ) ;
5960 }
6061
62+ [ Test ]
63+ [ MethodDataSource ( nameof ( ThrowIfNullOrEmptyEnumerableData ) ) ]
64+ public void ThrowIfNullOrEmpty_WhenIEnumerableEmpty_ThrowsArgumentException ( IEnumerable < string > ? argument )
65+ {
66+ // Act
67+ void Act ( ) => Argument . ThrowIfNullOrEmpty ( argument ) ;
68+
69+ // Assert
70+ _ = Assert . Throws < ArgumentException > ( nameof ( argument ) , Act ) ;
71+ }
72+
73+ [ Test ]
74+ [ MethodDataSource ( nameof ( ThrowIfNullOrEmptyEnumerableWithData ) ) ]
75+ public async Task ThrowIfNullOrEmpty_WhenIEnumerableEmpty_Expected ( IEnumerable < string > ? argument )
76+ {
77+ // Act
78+ Argument . ThrowIfNullOrEmpty ( argument ) ;
79+
80+ // Assert
81+ _ = await Assert . That ( argument ) . IsNotNull ( ) . And . IsNotEmpty ( ) ;
82+ }
83+
6184 public static IEnumerable < IEnumerable < string > > ThrowIfNullOrEmptyEnumerableData =>
6285 [ Array . Empty < string > ( ) , new List < string > ( ) , new HashSet < string > ( ) ] ;
6386
You can’t perform that action at this time.
0 commit comments