Beispiel #1
0
 public void NeedsCommands()
 {
     using var connection = new MySqlConnection(AppConfig.ConnectionString);
     connection.Open();
     using var batch = new MySqlBatch(connection);
     Assert.Throws <InvalidOperationException>(() => batch.ExecuteNonQuery());
 }
 public void NotDisposed()
 {
     using (var batch = new MySqlBatch())
     {
         batch.Dispose();
         Assert.Throws <ObjectDisposedException>(() => batch.ExecuteNonQuery());
     }
 }
Beispiel #3
0
 public void NeedsConnection()
 {
     using var batch = new MySqlBatch
           {
               BatchCommands =
               {
                   new MySqlBatchCommand("SELECT 1;"),
               },
           };
     Assert.Throws <InvalidOperationException>(() => batch.ExecuteNonQuery());
 }
Beispiel #4
0
 public void NeedsOpenConnection()
 {
     using var connection = new MySqlConnection(AppConfig.ConnectionString);
     using var batch      = new MySqlBatch(connection)
           {
               BatchCommands =
               {
                   new MySqlBatchCommand("SELECT 1;"),
               },
           };
     Assert.Throws <InvalidOperationException>(() => batch.ExecuteNonQuery());
 }
Beispiel #5
0
 public void NoCloseConnection()
 {
     using var connection = new MySqlConnection(AppConfig.ConnectionString);
     connection.Open();
     using var batch = new MySqlBatch(connection)
           {
               BatchCommands =
               {
                   new MySqlBatchCommand("SELECT 1;")
                   {
                       CommandBehavior = CommandBehavior.CloseConnection
                   },
               },
           };
     Assert.Throws <NotSupportedException>(() => batch.ExecuteNonQuery());
 }