@@ -21,10 +21,20 @@ public void UpdatedRowSource_SetInvalidValue_Throws()
2121 Assert . Equal ( UpdateRowSource . Both , cmd . UpdatedRowSource ) ;
2222 cmd . UpdatedRowSource = UpdateRowSource . FirstReturnedRecord ;
2323 Assert . Equal ( UpdateRowSource . FirstReturnedRecord , cmd . UpdatedRowSource ) ;
24- AssertExtensions . Throws < ArgumentOutOfRangeException > (
25- ( ) => cmd . UpdatedRowSource = ( UpdateRowSource ) InvalidValue ,
26- $ "The { nameof ( UpdateRowSource ) } enumeration value, { InvalidValue } , is invalid. (Parameter \' { nameof ( UpdateRowSource ) } \' )"
27- ) ;
24+ if ( PlatformDetection . IsFullFramework )
25+ {
26+ AssertExtensions . Throws < ArgumentOutOfRangeException > (
27+ ( ) => cmd . UpdatedRowSource = ( UpdateRowSource ) InvalidValue ,
28+ $ "The { nameof ( UpdateRowSource ) } enumeration value, { InvalidValue } , is invalid.\r \n Parameter name: { nameof ( UpdateRowSource ) } "
29+ ) ;
30+ }
31+ else
32+ {
33+ AssertExtensions . Throws < ArgumentOutOfRangeException > (
34+ ( ) => cmd . UpdatedRowSource = ( UpdateRowSource ) InvalidValue ,
35+ $ "The { nameof ( UpdateRowSource ) } enumeration value, { InvalidValue } , is invalid. (Parameter \' { nameof ( UpdateRowSource ) } \' )"
36+ ) ;
37+ }
2838 }
2939 }
3040
@@ -34,10 +44,20 @@ public void CommandTimeout_SetInvalidValue_Throws()
3444 const int InvalidValue = - 1 ;
3545 using ( var cmd = new OleDbCommand ( default , connection , transaction ) )
3646 {
37- AssertExtensions . Throws < ArgumentException > (
38- ( ) => cmd . CommandTimeout = InvalidValue ,
39- $ "Invalid CommandTimeout value { InvalidValue } ; the value must be >= 0. (Parameter \' { nameof ( cmd . CommandTimeout ) } \' )"
40- ) ;
47+ if ( PlatformDetection . IsFullFramework )
48+ {
49+ AssertExtensions . Throws < ArgumentException > (
50+ ( ) => cmd . CommandTimeout = InvalidValue ,
51+ $ "Invalid CommandTimeout value { InvalidValue } ; the value must be >= 0.\r \n Parameter name: { nameof ( cmd . CommandTimeout ) } "
52+ ) ;
53+ }
54+ else
55+ {
56+ AssertExtensions . Throws < ArgumentException > (
57+ ( ) => cmd . CommandTimeout = InvalidValue ,
58+ $ "Invalid CommandTimeout value { InvalidValue } ; the value must be >= 0. (Parameter \' { nameof ( cmd . CommandTimeout ) } \' )"
59+ ) ;
60+ }
4161 }
4262 }
4363
@@ -61,10 +81,20 @@ public void CommandType_SetInvalidValue_Throws()
6181 const int InvalidValue = 0 ;
6282 using ( var cmd = ( OleDbCommand ) OleDbFactory . Instance . CreateCommand ( ) )
6383 {
64- AssertExtensions . Throws < ArgumentOutOfRangeException > (
65- ( ) => cmd . CommandType = ( CommandType ) InvalidValue ,
66- $ "The CommandType enumeration value, { InvalidValue } , is invalid. (Parameter \' { nameof ( cmd . CommandType ) } \' )"
67- ) ;
84+ if ( PlatformDetection . IsFullFramework )
85+ {
86+ AssertExtensions . Throws < ArgumentOutOfRangeException > (
87+ ( ) => cmd . CommandType = ( CommandType ) InvalidValue ,
88+ $ "The CommandType enumeration value, { InvalidValue } , is invalid.\r \n Parameter name: { nameof ( cmd . CommandType ) } "
89+ ) ;
90+ }
91+ else
92+ {
93+ AssertExtensions . Throws < ArgumentOutOfRangeException > (
94+ ( ) => cmd . CommandType = ( CommandType ) InvalidValue ,
95+ $ "The CommandType enumeration value, { InvalidValue } , is invalid. (Parameter \' { nameof ( cmd . CommandType ) } \' )"
96+ ) ;
97+ }
6898 }
6999 }
70100
@@ -149,10 +179,20 @@ public void Prepare_InsertMultipleItems_UseTableDirectToVerify()
149179 public void Parameters_AddNullParameter_Throws ( )
150180 {
151181 RunTest ( ( command , tableName ) => {
152- AssertExtensions . Throws < ArgumentNullException > (
153- ( ) => command . Parameters . Add ( null ) ,
154- $ "The { nameof ( OleDbParameterCollection ) } only accepts non-null { nameof ( OleDbParameter ) } type objects. (Parameter \' value\' )"
155- ) ;
182+ if ( PlatformDetection . IsFullFramework )
183+ {
184+ AssertExtensions . Throws < ArgumentNullException > (
185+ ( ) => command . Parameters . Add ( null ) ,
186+ $ "The { nameof ( OleDbParameterCollection ) } only accepts non-null { nameof ( OleDbParameter ) } type objects.\r \n Parameter name: value"
187+ ) ;
188+ }
189+ else
190+ {
191+ AssertExtensions . Throws < ArgumentNullException > (
192+ ( ) => command . Parameters . Add ( null ) ,
193+ $ "The { nameof ( OleDbParameterCollection ) } only accepts non-null { nameof ( OleDbParameter ) } type objects. (Parameter \' value\' )"
194+ ) ;
195+ }
156196 command . CommandText = "SELECT * FROM " + tableName + " WHERE NumPlants = ?" ;
157197 command . Parameters . Add ( new OleDbParameter ( "@p1" , 7 ) ) ;
158198 using ( OleDbDataReader reader = command . ExecuteReader ( ) )
0 commit comments