@@ -15,6 +15,14 @@ public void Test_Guard_IsNull_Ok()
15
15
{
16
16
Guard . IsNull < object > ( null , nameof ( Test_Guard_IsNull_Ok ) ) ;
17
17
Guard . IsNull < int > ( null , nameof ( Test_Guard_IsNull_Ok ) ) ;
18
+
19
+ static void Test < T > ( T ? obj )
20
+ {
21
+ Guard . IsNull ( obj , nameof ( Test_Guard_IsNull_Ok ) ) ;
22
+ }
23
+
24
+ Test < string > ( null ) ;
25
+ Test < int ? > ( null ) ;
18
26
}
19
27
20
28
[ TestMethod ]
@@ -28,14 +36,47 @@ public void Test_Guard_IsNull_ClassFail()
28
36
[ ExpectedException ( typeof ( ArgumentException ) ) ]
29
37
public void Test_Guard_IsNull_StructFail ( )
30
38
{
31
- Guard . IsNull < int > ( 7 , nameof ( Test_Guard_IsNull_StructFail ) ) ;
39
+ Guard . IsNull ( 7 , nameof ( Test_Guard_IsNull_StructFail ) ) ;
40
+ }
41
+
42
+ [ TestMethod ]
43
+ [ ExpectedException ( typeof ( ArgumentException ) ) ]
44
+ public void Test_Guard_IsNull_GenericClassFail ( )
45
+ {
46
+ static void Test < T > ( T ? obj )
47
+ {
48
+ Guard . IsNull ( obj , nameof ( Test_Guard_IsNull_GenericClassFail ) ) ;
49
+ }
50
+
51
+ Test ( "Hi!" ) ;
52
+ }
53
+
54
+ [ TestMethod ]
55
+ [ ExpectedException ( typeof ( ArgumentException ) ) ]
56
+ public void Test_Guard_IsNull_GenericStructFail ( )
57
+ {
58
+ static void Test < T > ( T ? obj )
59
+ {
60
+ Guard . IsNull ( obj , nameof ( Test_Guard_IsNull_GenericStructFail ) ) ;
61
+ }
62
+
63
+ Test ( 42 ) ;
32
64
}
33
65
34
66
[ TestMethod ]
35
67
public void Test_Guard_IsNotNull_Ok ( )
36
68
{
37
69
Guard . IsNotNull ( new object ( ) , nameof ( Test_Guard_IsNotNull_Ok ) ) ;
38
- Guard . IsNotNull < int > ( 7 , nameof ( Test_Guard_IsNotNull_Ok ) ) ;
70
+ Guard . IsNotNull ( 7 , nameof ( Test_Guard_IsNotNull_Ok ) ) ;
71
+
72
+ static void Test < T > ( T ? obj )
73
+ {
74
+ Guard . IsNotNull ( obj , nameof ( Test_Guard_IsNotNull_Ok ) ) ;
75
+ }
76
+
77
+ Test ( "Hi!" ) ;
78
+ Test ( 42 ) ;
79
+ Test < int ? > ( 42 ) ;
39
80
}
40
81
41
82
[ TestMethod ]
@@ -52,6 +93,30 @@ public void Test_Guard_IsNotNull_StructFail()
52
93
Guard . IsNotNull < int > ( null , nameof ( Test_Guard_IsNotNull_StructFail ) ) ;
53
94
}
54
95
96
+ [ TestMethod ]
97
+ [ ExpectedException ( typeof ( ArgumentNullException ) ) ]
98
+ public void Test_Guard_IsNotNull_GenericClassFail ( )
99
+ {
100
+ static void Test < T > ( T ? obj )
101
+ {
102
+ Guard . IsNotNull ( obj , nameof ( Test_Guard_IsNotNull_GenericClassFail ) ) ;
103
+ }
104
+
105
+ Test < string > ( null ) ;
106
+ }
107
+
108
+ [ TestMethod ]
109
+ [ ExpectedException ( typeof ( ArgumentNullException ) ) ]
110
+ public void Test_Guard_IsNotNull_GenericStructFail ( )
111
+ {
112
+ static void Test < T > ( T ? obj )
113
+ {
114
+ Guard . IsNotNull ( obj , nameof ( Test_Guard_IsNotNull_GenericClassFail ) ) ;
115
+ }
116
+
117
+ Test < int ? > ( null ) ;
118
+ }
119
+
55
120
[ TestMethod ]
56
121
public void Test_Guard_IsOfT_Ok ( )
57
122
{
0 commit comments