本文整理汇总了C#中AllReady.Areas.Admin.Controllers.ItineraryController.ConfirmRemoveRequest方法的典型用法代码示例。如果您正苦于以下问题:C# ItineraryController.ConfirmRemoveRequest方法的具体用法?C# ItineraryController.ConfirmRemoveRequest怎么用?C# ItineraryController.ConfirmRemoveRequest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AllReady.Areas.Admin.Controllers.ItineraryController
的用法示例。
在下文中一共展示了ItineraryController.ConfirmRemoveRequest方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConfirmRemoveRequestRetrunsCorrectViewAndViewModel
public async Task ConfirmRemoveRequestRetrunsCorrectViewAndViewModel()
{
const int orgId = 1;
var mediator = new Mock<IMediator>();
mediator.Setup(x => x.SendAsync(It.IsAny<OrganizationIdQuery>())).ReturnsAsync(orgId);
mediator.Setup(x => x.SendAsync(It.IsAny<RequestSummaryQuery>())).ReturnsAsync(new RequestSummaryViewModel());
var sut = new ItineraryController(mediator.Object, null);
sut.MakeUserAnOrgAdmin(orgId.ToString());
var result = await sut.ConfirmRemoveRequest(It.IsAny<int>(), It.IsAny<Guid>()) as ViewResult;
var resultViewModel = result.ViewData.Model as RequestSummaryViewModel;
Assert.Equal(result.ViewName, "ConfirmRemoveRequest");
Assert.IsType<RequestSummaryViewModel>(resultViewModel);
}
示例2: ConfirmRemoveRequestAssignsCorrectTitleOnViewModel
public async Task ConfirmRemoveRequestAssignsCorrectTitleOnViewModel()
{
const int orgId = 1;
var requestId = Guid.NewGuid();
var viewModel = new RequestSummaryViewModel { Name = "ViewModelName" };
var mediator = new Mock<IMediator>();
mediator.Setup(x => x.SendAsync(It.IsAny<OrganizationIdQuery>())).ReturnsAsync(orgId);
mediator.Setup(x => x.SendAsync(It.IsAny<RequestSummaryQuery>())).ReturnsAsync(viewModel);
var sut = new ItineraryController(mediator.Object, null);
sut.MakeUserAnOrgAdmin(orgId.ToString());
var result = await sut.ConfirmRemoveRequest(It.IsAny<int>(), requestId) as ViewResult;
var resultViewModel = result.ViewData.Model as RequestSummaryViewModel;
Assert.Equal(resultViewModel.Title, $"Remove request: {viewModel.Name}");
}
示例3: ConfirmRemoveRequestSetsUserIsOrgAdminToTrue_WhenUserIsOrgAdmin
public async Task ConfirmRemoveRequestSetsUserIsOrgAdminToTrue_WhenUserIsOrgAdmin()
{
const int orgId = 1;
var mediator = new Mock<IMediator>();
mediator.Setup(x => x.SendAsync(It.IsAny<OrganizationIdQuery>())).ReturnsAsync(orgId);
mediator.Setup(x => x.SendAsync(It.IsAny<RequestSummaryQuery>())).ReturnsAsync(new RequestSummaryViewModel());
var sut = new ItineraryController(mediator.Object, null);
sut.MakeUserAnOrgAdmin(orgId.ToString());
var result = await sut.ConfirmRemoveRequest(It.IsAny<int>(), It.IsAny<Guid>()) as ViewResult;
var resultViewModel = result.ViewData.Model as RequestSummaryViewModel;
Assert.True(resultViewModel.UserIsOrgAdmin);
}
示例4: ConfirmRemoveRequestSendsRequestSummaryQueryWithCorrectRequestId
public async Task ConfirmRemoveRequestSendsRequestSummaryQueryWithCorrectRequestId()
{
const int orgId = 1;
var requestId = Guid.NewGuid();
var mediator = new Mock<IMediator>();
mediator.Setup(x => x.SendAsync(It.IsAny<OrganizationIdQuery>())).ReturnsAsync(orgId);
var sut = new ItineraryController(mediator.Object, null);
sut.MakeUserAnOrgAdmin(orgId.ToString());
await sut.ConfirmRemoveRequest(It.IsAny<int>(), requestId);
mediator.Verify(x => x.SendAsync(It.Is<RequestSummaryQuery>(y => y.RequestId == requestId)));
}
示例5: ConfirmRemoveRequestReturnsNotFoundResult_WhenViewModelIsNull
public async Task ConfirmRemoveRequestReturnsNotFoundResult_WhenViewModelIsNull()
{
const int orgId = 1;
var mediator = new Mock<IMediator>();
mediator.Setup(x => x.SendAsync(It.IsAny<OrganizationIdQuery>())).ReturnsAsync(orgId);
var sut = new ItineraryController(mediator.Object, null);
sut.MakeUserAnOrgAdmin(orgId.ToString());
var result = await sut.ConfirmRemoveRequest(It.IsAny<int>(), It.IsAny<Guid>());
Assert.IsType<NotFoundResult>(result);
}
示例6: ConfirmRemoveRequestReturnsUnauthorizedResult_WhenUserIsNotOrgAdmin
public async Task ConfirmRemoveRequestReturnsUnauthorizedResult_WhenUserIsNotOrgAdmin()
{
var mediator = new Mock<IMediator>();
mediator.Setup(x => x.SendAsync(It.IsAny<OrganizationIdQuery>())).ReturnsAsync(1);
var sut = new ItineraryController(mediator.Object, null);
sut.MakeUserNotAnOrgAdmin();
var result = await sut.ConfirmRemoveRequest(It.IsAny<int>(), It.IsAny<Guid>());
Assert.IsType<UnauthorizedResult>(result);
}
示例7: ConfirmRemoveRequestReturnsUnauthorizedResult_WhenOrgIdIsZero
public async Task ConfirmRemoveRequestReturnsUnauthorizedResult_WhenOrgIdIsZero()
{
const int orgId = 0;
var mediator = new Mock<IMediator>();
mediator.Setup(x => x.SendAsync(It.IsAny<OrganizationIdQuery>())).ReturnsAsync(orgId);
var sut = new ItineraryController(mediator.Object, null);
var result = await sut.ConfirmRemoveRequest(It.IsAny<int>(), It.IsAny<Guid>());
Assert.IsType<UnauthorizedResult>(result);
}
示例8: ConfirmRemoveRequestSendsOrganizationIdQueryWithCorrectItineraryId
public async Task ConfirmRemoveRequestSendsOrganizationIdQueryWithCorrectItineraryId()
{
const int itineraryId = 1;
var mediator = new Mock<IMediator>();
var sut = new ItineraryController(mediator.Object, null);
await sut.ConfirmRemoveRequest(itineraryId, It.IsAny<Guid>());
mediator.Verify(x => x.SendAsync(It.Is<OrganizationIdQuery>(y => y.ItineraryId == itineraryId)), Times.Once);
}