@@ -49,29 +49,37 @@ public static void Ctor_String_String()
4949 }
5050
5151 [ Fact ]
52- public static void ThrowIfNull_NonNull_DoesntThrow ( )
52+ public static unsafe void ThrowIfNull_NonNull_DoesntThrow ( )
5353 {
5454 foreach ( object o in new [ ] { new object ( ) , "" , "argument" } )
5555 {
5656 ArgumentNullException . ThrowIfNull ( o ) ;
5757 ArgumentNullException . ThrowIfNull ( o , "paramName" ) ;
5858 }
59+
60+ int i = 0 ;
61+ ArgumentNullException . ThrowIfNull ( & i ) ;
62+ ArgumentNullException . ThrowIfNull ( & i , "paramName" ) ;
5963 }
6064
6165 [ Theory ]
6266 [ InlineData ( null ) ]
6367 [ InlineData ( "" ) ]
6468 [ InlineData ( "name" ) ]
65- public static void ThrowIfNull_Null_ThrowsArgumentNullException ( string paramName )
69+ public static unsafe void ThrowIfNull_Null_ThrowsArgumentNullException ( string paramName )
6670 {
67- AssertExtensions . Throws < ArgumentNullException > ( paramName , ( ) => ArgumentNullException . ThrowIfNull ( null , paramName ) ) ;
71+ AssertExtensions . Throws < ArgumentNullException > ( paramName , ( ) => ArgumentNullException . ThrowIfNull ( ( object ) null , paramName ) ) ;
72+ AssertExtensions . Throws < ArgumentNullException > ( paramName , ( ) => ArgumentNullException . ThrowIfNull ( ( void * ) null , paramName ) ) ;
6873 }
6974
7075 [ Fact ]
71- public static void ThrowIfNull_UsesArgumentExpression ( )
76+ public static unsafe void ThrowIfNull_UsesArgumentExpression ( )
7277 {
73- object something = null ;
74- AssertExtensions . Throws < ArgumentNullException > ( nameof ( something ) , ( ) => ArgumentNullException . ThrowIfNull ( something ) ) ;
78+ object someObject = null ;
79+ AssertExtensions . Throws < ArgumentNullException > ( nameof ( someObject ) , ( ) => ArgumentNullException . ThrowIfNull ( someObject ) ) ;
80+
81+ byte * somePointer = null ;
82+ AssertExtensions . Throws < ArgumentNullException > ( nameof ( somePointer ) , ( ) => ArgumentNullException . ThrowIfNull ( somePointer ) ) ;
7583 }
7684 }
7785}
0 commit comments