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))); }
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)); }
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); }