本文整理汇总了C#中AllReady.Areas.Admin.Controllers.SiteController.DeleteUser方法的典型用法代码示例。如果您正苦于以下问题:C# SiteController.DeleteUser方法的具体用法?C# SiteController.DeleteUser怎么用?C# SiteController.DeleteUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AllReady.Areas.Admin.Controllers.SiteController
的用法示例。
在下文中一共展示了SiteController.DeleteUser方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeleteUserSendsUserQueryWithCorrectUserId
public async Task DeleteUserSendsUserQueryWithCorrectUserId()
{
var mediator = new Mock<IMediator>();
const string userId = "foo_id";
mediator.Setup(x => x.SendAsync(It.Is<UserQuery>(q => q.UserId == userId))).ReturnsAsync(new EditUserModel());
var controller = new SiteController(null, null, mediator.Object);
await controller.DeleteUser(userId);
mediator.Verify(m =>m.SendAsync(It.Is<UserQuery>(q =>q.UserId == userId)), Times.Once);
}
示例2: DeleteUserReturnsTheCorrectViewModel
public async Task DeleteUserReturnsTheCorrectViewModel()
{
var mediator = new Mock<IMediator>();
const string userId = "foo_id";
mediator.Setup(x => x.SendAsync(It.IsAny<UserQuery>())).ReturnsAsync(new EditUserModel());
var controller = new SiteController(null, null, mediator.Object);
var result = await controller.DeleteUser(userId);
var model = ((ViewResult)result).ViewData.Model as DeleteUserModel;
Assert.Equal(model.UserId, userId);
Assert.IsType<DeleteUserModel>(model);
}