File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change 1
1
using System ;
2
2
using System . Data ;
3
+ using System . Data . Common ;
3
4
using System . IO ;
4
5
using System . Threading . Tasks ;
5
6
using MySql . Data . MySqlClient ;
@@ -430,6 +431,15 @@ public async Task BulkLoadDataReader()
430
431
}
431
432
432
433
#if ! NETCOREAPP1_1_2
434
+ [ Fact ]
435
+ public void BulkCopyNullDataTable ( )
436
+ {
437
+ using var connection = new MySqlConnection ( GetLocalConnectionString ( ) ) ;
438
+ connection . Open ( ) ;
439
+ var bulkCopy = new MySqlBulkCopy ( connection ) ;
440
+ Assert . ThrowsAsync < ArgumentNullException > ( async ( ) => await bulkCopy . WriteToServerAsync ( default ( DataTable ) ) ) ;
441
+ }
442
+
433
443
[ Fact ]
434
444
public async Task BulkLoadDataTableWithLongData ( )
435
445
{
@@ -492,6 +502,15 @@ public async Task BulkLoadDataTableWithTooLongData()
492
502
await Assert . ThrowsAsync < MySqlException > ( async ( ) => await bulkCopy . WriteToServerAsync ( dataTable ) ) ;
493
503
}
494
504
#endif
505
+
506
+ [ Fact ]
507
+ public void BulkCopyNullDataReader ( )
508
+ {
509
+ using var connection = new MySqlConnection ( GetLocalConnectionString ( ) ) ;
510
+ connection . Open ( ) ;
511
+ var bulkCopy = new MySqlBulkCopy ( connection ) ;
512
+ Assert . ThrowsAsync < ArgumentNullException > ( async ( ) => await bulkCopy . WriteToServerAsync ( default ( DbDataReader ) ) ) ;
513
+ }
495
514
#endif
496
515
497
516
private static string GetConnectionString ( ) => BulkLoaderSync . GetConnectionString ( ) ;
Original file line number Diff line number Diff line change 1
1
using System ;
2
2
using System . Data ;
3
+ using System . Data . Common ;
3
4
using System . IO ;
4
5
using MySql . Data . MySqlClient ;
5
6
using Xunit ;
@@ -511,6 +512,15 @@ public void BulkLoadDataReader()
511
512
}
512
513
513
514
#if ! NETCOREAPP1_1_2
515
+ [ Fact ]
516
+ public void BulkCopyNullDataTable ( )
517
+ {
518
+ using var connection = new MySqlConnection ( GetLocalConnectionString ( ) ) ;
519
+ connection . Open ( ) ;
520
+ var bulkCopy = new MySqlBulkCopy ( connection ) ;
521
+ Assert . Throws < ArgumentNullException > ( ( ) => bulkCopy . WriteToServer ( default ( DataTable ) ) ) ;
522
+ }
523
+
514
524
[ SkippableFact ( ServerFeatures . LargePackets ) ]
515
525
public void BulkLoadDataTableWithLongBlob ( )
516
526
{
@@ -688,6 +698,15 @@ public void BulkLoadDataTableWithTooLongString()
688
698
Assert . Throws < MySqlException > ( ( ) => bulkCopy . WriteToServer ( dataTable ) ) ;
689
699
}
690
700
#endif
701
+
702
+ [ Fact ]
703
+ public void BulkCopyNullDataReader ( )
704
+ {
705
+ using var connection = new MySqlConnection ( GetLocalConnectionString ( ) ) ;
706
+ connection . Open ( ) ;
707
+ var bulkCopy = new MySqlBulkCopy ( connection ) ;
708
+ Assert . Throws < ArgumentNullException > ( ( ) => bulkCopy . WriteToServer ( default ( DbDataReader ) ) ) ;
709
+ }
691
710
#endif
692
711
693
712
internal static string GetConnectionString ( ) => AppConfig . ConnectionString ;
You can’t perform that action at this time.
0 commit comments