|
1 | | -using System.Data; |
| 1 | +using System.Data; |
2 | 2 | using System.Threading.Tasks; |
3 | 3 | using MySql.Data.MySqlClient; |
4 | 4 | using Xunit; |
@@ -42,17 +42,37 @@ public async void CommandLoadCsvFile() |
42 | 42 | Assert.Equal(20, rowCount); |
43 | 43 | } |
44 | 44 |
|
45 | | - [BulkLoaderLocalCsvFileFact] |
| 45 | + [BulkLoaderLocalCsvFileFact(TrustedHost = true)] |
46 | 46 | public async void CommandLoadLocalCsvFile() |
47 | 47 | { |
48 | | - string insertInlineCommand = string.Format(m_loadDataInfileCommand, " LOCAL", AppConfig.MySqlBulkLoaderLocalCsvFile.Replace("\\", "\\\\")); |
| 48 | + string insertInlineCommand = string.Format(m_loadDataInfileCommand, " LOCAL", |
| 49 | + AppConfig.MySqlBulkLoaderLocalCsvFile.Replace("\\", "\\\\")); |
49 | 50 | MySqlCommand command = new MySqlCommand(insertInlineCommand, m_database.Connection); |
50 | | - if (m_database.Connection.State != ConnectionState.Open) await m_database.Connection.OpenAsync(); |
| 51 | + |
| 52 | + if (m_database.Connection.State != ConnectionState.Open) |
| 53 | + await m_database.Connection.OpenAsync(); |
| 54 | + |
51 | 55 | int rowCount = await command.ExecuteNonQueryAsync(); |
| 56 | + |
52 | 57 | m_database.Connection.Close(); |
53 | 58 | Assert.Equal(20, rowCount); |
54 | 59 | } |
55 | 60 |
|
| 61 | +#if !BASELINE |
| 62 | + [BulkLoaderLocalCsvFileFact(TrustedHost = false)] |
| 63 | + public async void ThrowsNotSupportedExceptionForNotTrustedHostAndNotStream() |
| 64 | + { |
| 65 | + string insertInlineCommand = string.Format(m_loadDataInfileCommand, " LOCAL", |
| 66 | + AppConfig.MySqlBulkLoaderLocalCsvFile.Replace("\\", "\\\\")); |
| 67 | + MySqlCommand command = new MySqlCommand(insertInlineCommand, m_database.Connection); |
| 68 | + |
| 69 | + if (m_database.Connection.State != ConnectionState.Open) |
| 70 | + await m_database.Connection.OpenAsync(); |
| 71 | + |
| 72 | + await Assert.ThrowsAsync<MySqlException>(async () => await command.ExecuteNonQueryAsync()); |
| 73 | + } |
| 74 | +#endif |
| 75 | + |
56 | 76 | readonly DatabaseFixture m_database; |
57 | 77 | readonly string m_testTable; |
58 | 78 | readonly string m_loadDataInfileCommand; |
|
0 commit comments