当前位置: 首页>>代码示例>>C#>>正文


C# ItineraryController.MarkComplete方法代码示例

本文整理汇总了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);
        }
开发者ID:dpaquette,项目名称:allReady,代码行数:13,代码来源:ItineraryAdminControllerTests.cs

示例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);
        }
开发者ID:dpaquette,项目名称:allReady,代码行数:14,代码来源:ItineraryAdminControllerTests.cs

示例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>()));
        }
开发者ID:dpaquette,项目名称:allReady,代码行数:10,代码来源:ItineraryAdminControllerTests.cs

示例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);
        }
开发者ID:dpaquette,项目名称:allReady,代码行数:15,代码来源:ItineraryAdminControllerTests.cs

示例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);
        }
开发者ID:dpaquette,项目名称:allReady,代码行数:11,代码来源:ItineraryAdminControllerTests.cs

示例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));
        }
开发者ID:gftrader,项目名称:allReady,代码行数:16,代码来源:ItineraryAdminControllerTests.cs

示例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));
        }
开发者ID:gftrader,项目名称:allReady,代码行数:12,代码来源:ItineraryAdminControllerTests.cs

示例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);
        }
开发者ID:gftrader,项目名称:allReady,代码行数:19,代码来源:ItineraryAdminControllerTests.cs

示例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);
        }
开发者ID:gftrader,项目名称:allReady,代码行数:19,代码来源:ItineraryAdminControllerTests.cs


注:本文中的AllReady.Areas.Admin.Controllers.ItineraryController.MarkComplete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。