@@ -15,6 +15,14 @@ public void Test_Guard_IsNull_Ok()
1515 {
1616 Guard . IsNull < object > ( null , nameof ( Test_Guard_IsNull_Ok ) ) ;
1717 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 ) ;
1826 }
1927
2028 [ TestMethod ]
@@ -28,14 +36,47 @@ public void Test_Guard_IsNull_ClassFail()
2836 [ ExpectedException ( typeof ( ArgumentException ) ) ]
2937 public void Test_Guard_IsNull_StructFail ( )
3038 {
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 ) ;
3264 }
3365
3466 [ TestMethod ]
3567 public void Test_Guard_IsNotNull_Ok ( )
3668 {
3769 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 ) ;
3980 }
4081
4182 [ TestMethod ]
@@ -52,6 +93,30 @@ public void Test_Guard_IsNotNull_StructFail()
5293 Guard . IsNotNull < int > ( null , nameof ( Test_Guard_IsNotNull_StructFail ) ) ;
5394 }
5495
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+
55120 [ TestMethod ]
56121 public void Test_Guard_IsOfT_Ok ( )
57122 {
0 commit comments