@@ -49,29 +49,37 @@ public static void Ctor_String_String()
49
49
}
50
50
51
51
[ Fact ]
52
- public static void ThrowIfNull_NonNull_DoesntThrow ( )
52
+ public static unsafe void ThrowIfNull_NonNull_DoesntThrow ( )
53
53
{
54
54
foreach ( object o in new [ ] { new object ( ) , "" , "argument" } )
55
55
{
56
56
ArgumentNullException . ThrowIfNull ( o ) ;
57
57
ArgumentNullException . ThrowIfNull ( o , "paramName" ) ;
58
58
}
59
+
60
+ int i = 0 ;
61
+ ArgumentNullException . ThrowIfNull ( & i ) ;
62
+ ArgumentNullException . ThrowIfNull ( & i , "paramName" ) ;
59
63
}
60
64
61
65
[ Theory ]
62
66
[ InlineData ( null ) ]
63
67
[ InlineData ( "" ) ]
64
68
[ InlineData ( "name" ) ]
65
- public static void ThrowIfNull_Null_ThrowsArgumentNullException ( string paramName )
69
+ public static unsafe void ThrowIfNull_Null_ThrowsArgumentNullException ( string paramName )
66
70
{
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 ) ) ;
68
73
}
69
74
70
75
[ Fact ]
71
- public static void ThrowIfNull_UsesArgumentExpression ( )
76
+ public static unsafe void ThrowIfNull_UsesArgumentExpression ( )
72
77
{
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 ) ) ;
75
83
}
76
84
}
77
85
}
0 commit comments