예제 #1
0
        private static async Task Main()
        {
            using (var root = Tracer.Instance.StartActive("root"))
            {
                using (var connection = CreateConnection())
                {
                    var testQueries = new RelationalDatabaseTestHarness <SqlConnection, SqlCommand, SqlDataReader>(
                        connection,
                        command => command.ExecuteNonQuery(),
                        command => command.ExecuteScalar(),
                        command => command.ExecuteReader(),
                        (command, behavior) => command.ExecuteReader(behavior),
                        command => command.ExecuteNonQueryAsync(),
                        command => command.ExecuteScalarAsync(),
                        command => command.ExecuteReaderAsync(),
                        (command, behavior) => command.ExecuteReaderAsync(behavior)
                        );


                    await testQueries.RunAsync();
                }

                using (var connection = CreateConnection())
                {
                    var testQueries = new RelationalDatabaseTestHarness <DbConnection, DbCommand, DbDataReader>(
                        connection,
                        command => command.ExecuteNonQuery(),
                        command => command.ExecuteScalar(),
                        command => command.ExecuteReader(),
                        (command, behavior) => command.ExecuteReader(behavior),
                        command => command.ExecuteNonQueryAsync(),
                        command => command.ExecuteScalarAsync(),
                        command => command.ExecuteReaderAsync(),
                        (command, behavior) => command.ExecuteReaderAsync(behavior)
                        );

                    await testQueries.RunAsync();
                }

                using (var connection = CreateConnection())
                {
                    var testQueries = new RelationalDatabaseTestHarness <IDbConnection, IDbCommand, IDataReader>(
                        connection,
                        command => command.ExecuteNonQuery(),
                        command => command.ExecuteScalar(),
                        command => command.ExecuteReader(),
                        (command, behavior) => command.ExecuteReader(behavior),
                        executeNonQueryAsync: null,
                        executeScalarAsync: null,
                        executeReaderAsync: null,
                        executeReaderWithBehaviorAsync: null
                        );

                    await testQueries.RunAsync();
                }
            }
        }
예제 #2
0
        private static async Task Main()
        {
            /* TODO: enable this after adding a MySql-specific integration
             * using (var connection = CreateConnection())
             * {
             *  var testQueries = new RelationalDatabaseTestHarness<MySqlConnection, MySqlCommand, MySqlDataReader>(
             *      connection,
             *      command => command.ExecuteNonQuery(),
             *      command => command.ExecuteScalar(),
             *      command => command.ExecuteReader(),
             *      (command, behavior) => command.ExecuteReader(behavior),
             *      command => command.ExecuteNonQueryAsync(),
             *      command => command.ExecuteScalarAsync(),
             *      executeReaderAsync: null,
             *      executeReaderWithBehaviorAsync: null
             *  );
             *
             *
             *  await testQueries.RunAsync();
             * }
             */

            using (var connection = CreateConnection())
            {
                var testQueries = new RelationalDatabaseTestHarness <DbConnection, DbCommand, DbDataReader>(
                    connection,
                    command => command.ExecuteNonQuery(),
                    command => command.ExecuteScalar(),
                    command => command.ExecuteReader(),
                    (command, behavior) => command.ExecuteReader(behavior),
                    command => command.ExecuteNonQueryAsync(),
                    command => command.ExecuteScalarAsync(),
                    command => command.ExecuteReaderAsync(),
                    (command, behavior) => command.ExecuteReaderAsync(behavior)
                    );

                await testQueries.RunAsync();
            }

            using (var connection = CreateConnection())
            {
                var testQueries = new RelationalDatabaseTestHarness <IDbConnection, IDbCommand, IDataReader>(
                    connection,
                    command => command.ExecuteNonQuery(),
                    command => command.ExecuteScalar(),
                    command => command.ExecuteReader(),
                    (command, behavior) => command.ExecuteReader(behavior),
                    executeNonQueryAsync: null,
                    executeScalarAsync: null,
                    executeReaderAsync: null,
                    executeReaderWithBehaviorAsync: null
                    );

                await testQueries.RunAsync();
            }
        }