本文整理汇总了C#中AllReady.Areas.Admin.Controllers.ItineraryController.MarkComplete方法的典型用法代码示例。如果您正苦于以下问题:C# ItineraryController.MarkComplete方法的具体用法?C# ItineraryController.MarkComplete怎么用?C# ItineraryController.MarkComplete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AllReady.Areas.Admin.Controllers.ItineraryController
的用法示例。
在下文中一共展示了ItineraryController.MarkComplete方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MarkCompleteReturnsRedirectToActionWhenOrganizationIsNotZero_AndUserIsOrgAdmin
public async Task MarkCompleteReturnsRedirectToActionWhenOrganizationIsNotZero_AndUserIsOrgAdmin()
{
const int orgId = 1;
var mockMediator = new Mock<IMediator>();
mockMediator.Setup(x => x.SendAsync(It.IsAny<OrganizationIdQuery>())).ReturnsAsync(orgId);
var sut = new ItineraryController(mockMediator.Object, null);
sut.MakeUserAnOrgAdmin(orgId.ToString());
var result = await sut.MarkComplete(It.IsAny<int>(), It.IsAny<Guid>());
Assert.IsType<RedirectToActionResult>(result);
}
示例2: MarkCompleteReturnsRedirectToAction_WithActionName_Details
public async Task MarkCompleteReturnsRedirectToAction_WithActionName_Details()
{
const int orgId = 1;
var mockMediator = new Mock<IMediator>();
mockMediator.Setup(x => x.SendAsync(It.IsAny<OrganizationIdQuery>())).ReturnsAsync(orgId);
var sut = new ItineraryController(mockMediator.Object, null);
sut.MakeUserAnOrgAdmin(orgId.ToString());
var result = await sut.MarkComplete(It.IsAny<int>(), It.IsAny<Guid>());
var actionResult = (RedirectToActionResult)result;
Assert.Equal("Details", actionResult.ActionName);
}
示例3: MarkCompleteReturnsHttpUnauthorizedWhenUserIsNotOrgAdmin
public async Task MarkCompleteReturnsHttpUnauthorizedWhenUserIsNotOrgAdmin()
{
var mockMediator = new Mock<IMediator>();
mockMediator.Setup(x => x.SendAsync(It.IsAny<OrganizationIdQuery>())).ReturnsAsync(1);
var sut = new ItineraryController(mockMediator.Object, null);
sut.MakeUserNotAnOrgAdmin();
Assert.IsType<UnauthorizedResult>(await sut.MarkComplete(It.IsAny<int>(), It.IsAny<Guid>()));
}
示例4: ItineraryController
public async Task MarkCompleteSendsRequestStatusChangeCommandWithCorrectRequestIdWhenOrganizationIsNotZero_AndUserIsOrgAdmin()
{
var requestId = Guid.NewGuid();
const int orgId = 1;
var mockMediator = new Mock<IMediator>();
mockMediator.Setup(x => x.SendAsync(It.IsAny<OrganizationIdQuery>())).ReturnsAsync(orgId);
var sut = new ItineraryController(mockMediator.Object, null);
sut.MakeUserAnOrgAdmin(orgId.ToString());
await sut.MarkComplete(It.IsAny<int>(), requestId);
mockMediator.Verify(x => x.SendAsync(It.Is<ChangeRequestStatusCommand>(y => y.RequestId == requestId)), Times.Once);
}
示例5: MarkCompleteSendsOrganizationIdQueryWithCorrectItineraryId
public async Task MarkCompleteSendsOrganizationIdQueryWithCorrectItineraryId()
{
var itineraryId = It.IsAny<int>();
var mockMediator = new Mock<IMediator>();
var sut = new ItineraryController(mockMediator.Object, null);
await sut.MarkComplete(itineraryId, It.IsAny<Guid>());
mockMediator.Verify(x => x.SendAsync(It.Is<OrganizationIdQuery>(y => y.ItineraryId == itineraryId)), Times.Once);
}
示例6: MarkCompleteReturnsHttpUnauthorizedWhenUserIsNotOrgAdmin
public async Task MarkCompleteReturnsHttpUnauthorizedWhenUserIsNotOrgAdmin()
{
var itineraryId = It.IsAny<int>();
var requestId = It.IsAny<Guid>();
var mockMediator = new Mock<IMediator>();
mockMediator.Setup(x => x.SendAsync(It.IsAny<OrganizationIdQuery>())).ReturnsAsync(1);
var sut = new ItineraryController(mockMediator.Object, MockSuccessValidation().Object);
sut.SetClaims(new List<Claim>
{
new Claim(AllReady.Security.ClaimTypes.UserType, UserType.BasicUser.ToString())
});
Assert.IsType<UnauthorizedResult>(await sut.MarkComplete(itineraryId, requestId));
}
示例7: MarkCompleteReturnsHttpUnauthorizedWhenOrganizationIdIsZero
public async Task MarkCompleteReturnsHttpUnauthorizedWhenOrganizationIdIsZero()
{
var itineraryId = It.IsAny<int>();
var requestId = It.IsAny<Guid>();
var mockMediator = new Mock<IMediator>();
mockMediator.Setup(x => x.SendAsync(It.IsAny<OrganizationIdQuery>())).ReturnsAsync(0);
var sut = new ItineraryController(mockMediator.Object, MockSuccessValidation().Object);
Assert.IsType<UnauthorizedResult>(await sut.MarkComplete(itineraryId, requestId));
}
示例8: MarkCompleteReturnsRedirectToAction_WithActionName_Details
public async Task MarkCompleteReturnsRedirectToAction_WithActionName_Details()
{
var itineraryId = It.IsAny<int>();
var requestId = It.IsAny<Guid>();
var mockMediator = new Mock<IMediator>();
mockMediator.Setup(x => x.SendAsync(It.IsAny<OrganizationIdQuery>())).ReturnsAsync(1);
var sut = new ItineraryController(mockMediator.Object, MockSuccessValidation().Object);
sut.SetClaims(new List<Claim>
{
new Claim(AllReady.Security.ClaimTypes.UserType, UserType.OrgAdmin.ToString()),
new Claim(AllReady.Security.ClaimTypes.Organization, "1")
});
var result = await sut.MarkComplete(itineraryId, requestId);
var actionResult = (RedirectToActionResult)result;
Assert.Equal("Details", actionResult.ActionName);
}
示例9: ItineraryController
public async Task MarkCompleteSendsRequestStatusChangeCommandWithCorrectTaskSignupIdWhenOrganizationIsNotZero_AndUserIsOrgAdmin()
{
var itineraryId = It.IsAny<int>();
var requestId = It.IsAny<Guid>();
var mockMediator = new Mock<IMediator>();
mockMediator.Setup(x => x.SendAsync(It.IsAny<OrganizationIdQuery>())).ReturnsAsync(1);
var sut = new ItineraryController(mockMediator.Object, MockSuccessValidation().Object);
sut.SetClaims(new List<Claim>
{
new Claim(AllReady.Security.ClaimTypes.UserType, UserType.OrgAdmin.ToString()),
new Claim(AllReady.Security.ClaimTypes.Organization, "1")
});
await sut.MarkComplete(itineraryId, requestId);
mockMediator.Verify(x => x.SendAsync(It.Is<RequestStatusChangeCommand>(y => y.RequestId == requestId)), Times.Once);
}