Exemple #1
0
        public async Task ConfirmDeletUserSendsDeleteUserCommandAsync()
        {
            var          mediator   = new Mock <IMediator>();
            var          controller = new SiteController(null, null, null, null, mediator.Object);
            const string userId     = "foo_id";

            await controller.ConfirmDeleteUser(userId);

            mediator.Verify(b => b.SendAsync(It.Is <DeleteUserCommand>(u => u.UserId == userId)));
        }
Exemple #2
0
        public async Task ConfirmDeletUserRedirectsToCorrectAction()
        {
            var applicationUser = CreateApplicationUserMock();

            var controller = new SiteController(applicationUser.Object, null, null);

            var result = await controller.ConfirmDeleteUser(It.IsAny <string>()) as RedirectToActionResult;

            Assert.Equal(result.ActionName, nameof(SiteController.Index));
        }
Exemple #3
0
        public async Task ConfirmDeletUserInvokesFindByIdAsync()
        {
            const string userId      = "userId";
            var          userManager = CreateApplicationUserMock();

            var controller = new SiteController(userManager.Object, null, null);

            await controller.ConfirmDeleteUser(userId);

            userManager.Verify(x => x.FindByIdAsync(userId), Times.Once);
        }