public async Task DeleteUserEnqueues()
            {
                var username = "******";
                // Arrange
                var testUser = new User()
                {
                    Username = username
                };

                var testService = new TestAsynchronousDeleteAccountService(shouldFail: false);

                testService.SetupSimple();
                var deleteAccountService = testService.GetTestService();
                var messageSerializer    = new AccountDeleteMessageSerializer();

                // Act
                var result = await deleteAccountService.DeleteAccountAsync(testUser, testUser, AccountDeletionOrphanPackagePolicy.UnlistOrphans);

                // Assert
                Assert.Equal(1, testService.TopicClient.SendAsyncCallCount);
                Assert.True(result.Success);
                Assert.Equal(string.Format(ServicesStrings.AsyncAccountDelete_Success, username), result.Description);

                var message = testService.TopicClient.LastSentMessage;

                Assert.NotNull(message);
                var messageData = messageSerializer.Deserialize(message);

                Assert.Equal(username, messageData.Username);
                Assert.Equal("GalleryUser", messageData.Source);
            }
            public async Task NullUserThrows()
            {
                // Arrange
                var testService = new TestAsynchronousDeleteAccountService(shouldFail: false);

                testService.SetupSimple();
                var deleteAccountService = testService.GetTestService();

                // Assert
                await Assert.ThrowsAsync <ArgumentNullException>(() => deleteAccountService.DeleteAccountAsync(
                                                                     null,
                                                                     new User("AdminUser"),
                                                                     orphanPackagePolicy: AccountDeletionOrphanPackagePolicy.UnlistOrphans));
            }
            public async Task FailedEnqueueStops()
            {
                // Arrange
                var testUser = new User()
                {
                    Username = "******"
                };

                var testService = new TestAsynchronousDeleteAccountService(shouldFail: true);

                testService.SetupSimple();
                var deleteAccountService = testService.GetTestService();

                var result = await deleteAccountService.DeleteAccountAsync(testUser, testUser, AccountDeletionOrphanPackagePolicy.UnlistOrphans);

                Assert.False(result.Success);
                Assert.Equal(ServicesStrings.AsyncAccountDelete_Fail, result.Description);
            }
            public async Task FailedSupportRequestStops()
            {
                // Arrange
                var testUser = new User()
                {
                    Username = "******"
                };

                var testService = new TestAsynchronousDeleteAccountService(shouldFail: true);

                testService.SupportRequestMock
                .Setup(sr => sr.TryAddDeleteSupportRequestAsync(It.IsAny <User>()))
                .Returns(Task.FromResult(false));
                var deleteAccountService = testService.GetTestService();

                var result = await deleteAccountService.DeleteAccountAsync(testUser, testUser, AccountDeletionOrphanPackagePolicy.UnlistOrphans);

                Assert.False(result.Success);
                Assert.Equal(ServicesStrings.AccountDelete_CreateSupportRequestFails, result.Description);
            }