public async Task EndConversationAsync_Succeeds()
        {
            // Arrange
            await InitializeDatabaseAsync();
            var provider = new SqlServerServiceBroker(connection);
            var handle = await BeginDialogAsync();

            // Act
            await provider.EndConversationAsync(new EndConversationArguments(handle));
            var sql = @"SELECT [state] FROM sys.conversation_endpoints WHERE conversation_handle = @handle";
            var results = await connection.QueryAsync(sql, new { handle });

            // Assert
            Assert.Empty(results);
        }
        public async Task EndConversationAsync_UsesTransaction()
        {
            // Arrange
            await InitializeDatabaseAsync();
            var provider = new SqlServerServiceBroker(connection);
            var handle = await BeginDialogAsync();

            // Act
            using (var transaction = await provider.BeginTransactionAsync())
            {
                await provider.EndConversationAsync(new EndConversationArguments(handle));
                transaction.Rollback();
            }

            var sql = @"SELECT [state] FROM sys.conversation_endpoints WHERE conversation_handle = @handle";
            var results = await connection.QueryAsync(sql, new { handle });

            // Assert
            Assert.NotEmpty(results);
        }
        public async Task EndConversationAsync_ArgumentsCannotBeNull()
        {
            // Arrange
            var provider = new SqlServerServiceBroker(connection);

            // Act
            Func<Task> call = async () => await provider.EndConversationAsync(null);

            // Assert
            await Assert.ThrowsAsync<ArgumentNullException>("arguments", call);
        }