/// <summary>
        /// Configures Rebus to use SQL Server to store outbox messages.
        /// </summary>
        /// <param name="configurer"></param>
        /// <param name="connectionFactory">Connection factory which should return a shared connection</param>
        /// <param name="tableName">Outbox messages table name including schema</param>
        /// <param name="automaticallyCreateTables">Create outbox messages table automatically</param>
        /// <exception cref="ArgumentNullException"></exception>
        public static void UseSqlServer(this StandardConfigurer <IOutboxStorage> configurer,
                                        Func <Task <DbConnection> > connectionFactory, string tableName, bool automaticallyCreateTables = true)
        {
            if (configurer == null)
            {
                throw new ArgumentNullException(nameof(configurer));
            }
            if (connectionFactory == null)
            {
                throw new ArgumentNullException(nameof(connectionFactory));
            }
            if (tableName == null)
            {
                throw new ArgumentNullException(nameof(tableName));
            }

            configurer.Register(c =>
            {
                var subscriptionStorage = new SqlServerOutboxStorage(connectionFactory, tableName);

                if (automaticallyCreateTables)
                {
                    subscriptionStorage.EnsureTableIsCreated();
                }

                return(subscriptionStorage);
            });
        }
    protected override void SetUp()
    {
        base.SetUp();

        const string tableName = "Outbox";

        SqlTestHelper.DropAllTables();

        _storage = new SqlServerOutboxStorage(GetNewDbConnection, new TableName("dbo", tableName));
        _storage.Initialize();
    }