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


C# ItineraryController.SelectRequests方法代码示例

本文整理汇总了C#中AllReady.Areas.Admin.Controllers.ItineraryController.SelectRequests方法的典型用法代码示例。如果您正苦于以下问题:C# ItineraryController.SelectRequests方法的具体用法?C# ItineraryController.SelectRequests怎么用?C# ItineraryController.SelectRequests使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AllReady.Areas.Admin.Controllers.ItineraryController的用法示例。


在下文中一共展示了ItineraryController.SelectRequests方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SelectRequestsPostWithTwoParametersSetsSelectItineraryRequestsModelWithTheCorrectData

        public async Task SelectRequestsPostWithTwoParametersSetsSelectItineraryRequestsModelWithTheCorrectData()
        {
            var itineraryRequestsModel = new SelectItineraryRequestsViewModel { KeywordsFilter = "These are keywords" };
            var itinerary = GetItineraryForSelectRequestHappyPathTests();
            var returnedRequests = GetRequestsForSelectRequestHappyPathTests();

            var mediator = new Mock<IMediator>();
            mediator.Setup(x => x.SendAsync(It.Is<ItineraryDetailQuery>(y => y.ItineraryId == itinerary.Id)))
                    .ReturnsAsync(itinerary);
            mediator.Setup(x => x.SendAsync(It.Is<RequestListItemsQuery>(y =>
                y.Criteria.Keywords.Equals(itineraryRequestsModel.KeywordsFilter) &&
                y.Criteria.EventId == itinerary.EventId)))
                .ReturnsAsync(returnedRequests);

            var sut = new ItineraryController(mediator.Object, null);

            var view = await sut.SelectRequests(itinerary.Id, itineraryRequestsModel);

            RunSelectRequestsHappyPathTests(view, itinerary, returnedRequests);
        }
开发者ID:dpaquette,项目名称:allReady,代码行数:20,代码来源:ItineraryAdminControllerTests.cs

示例2: SelectRequestsPostWithSingleParameterSetsSelectItineraryRequestsModelWithTheCorrectData

        public async Task SelectRequestsPostWithSingleParameterSetsSelectItineraryRequestsModelWithTheCorrectData()
        {
            const int organizationId = 4;

            var itinerary = GetItineraryForSelectRequestHappyPathTests();
            var returnedRequests = GetRequestsForSelectRequestHappyPathTests();

            var mediator = new Mock<IMediator>();
            mediator.Setup(x => x.SendAsync(It.Is<ItineraryDetailQuery>(y => y.ItineraryId == itinerary.Id))).ReturnsAsync(itinerary);
            mediator.Setup(x => x.SendAsync(It.IsAny<RequestListItemsQuery>())).ReturnsAsync(returnedRequests);
            mediator.Setup(x => x.SendAsync(It.IsAny<OrganizationIdQuery>())).ReturnsAsync(organizationId);

            var sut = new ItineraryController(mediator.Object, null);
            sut.MakeUserAnOrgAdmin(organizationId.ToString());

            var view = await sut.SelectRequests(itinerary.Id, new SelectItineraryRequestsViewModel());

            RunSelectRequestsHappyPathTests(view, itinerary, returnedRequests);
        }
开发者ID:dpaquette,项目名称:allReady,代码行数:19,代码来源:ItineraryAdminControllerTests.cs

示例3: SelectRequestsGetReturnsUnauthorizedResult_WhenUserIsNotOrgAdmin

        public async Task SelectRequestsGetReturnsUnauthorizedResult_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.SelectRequests(It.IsAny<int>());

            Assert.IsType<UnauthorizedResult>(result);
        }
开发者ID:dpaquette,项目名称:allReady,代码行数:12,代码来源:ItineraryAdminControllerTests.cs

示例4: SelectRequestsGetReturnsUnauthorizedResult_WhenOrgIdIsZero

        public async Task SelectRequestsGetReturnsUnauthorizedResult_WhenOrgIdIsZero()
        {
            var sut = new ItineraryController(Mock.Of<IMediator>(), null);

            var result = await sut.SelectRequests(It.IsAny<int>());

            Assert.IsType<UnauthorizedResult>(result);
        }
开发者ID:dpaquette,项目名称:allReady,代码行数:8,代码来源:ItineraryAdminControllerTests.cs

示例5: SelectRequestsGetSendsOrganizationIdQueryWithCorrectItineraryId

        public async Task SelectRequestsGetSendsOrganizationIdQueryWithCorrectItineraryId()
        {
            const int itineraryId = 1;

            var mediator = new Mock<IMediator>();

            var sut = new ItineraryController(mediator.Object, null);
            await sut.SelectRequests(itineraryId);

            mediator.Verify(x => x.SendAsync(It.Is<OrganizationIdQuery>(y => y.ItineraryId == itineraryId)));
        }
开发者ID:dpaquette,项目名称:allReady,代码行数:11,代码来源:ItineraryAdminControllerTests.cs

示例6: SelectRequestsWithSingleParameterSetsSelectItineraryRequestsModelWithTheCorrectData

        public async Task SelectRequestsWithSingleParameterSetsSelectItineraryRequestsModelWithTheCorrectData()
        {
            var organizationId = 4;
            var itineraryRequestsModel = new SelectItineraryRequestsModel();
            var itinerary = GetItineraryForSelectRequestHappyPathTests();
            var returnedRequests = GetRequestsForSelectRequestHappyPathTests();
            var mediator = new Mock<IMediator>();
            mediator.Setup(x => x.SendAsync(It.Is<ItineraryDetailQuery>(y => y.ItineraryId == itinerary.Id)))
                    .ReturnsAsync(itinerary);
            mediator.Setup(x => x.SendAsync(It.IsAny<RequestListItemsQuery>()))
                    .ReturnsAsync(returnedRequests);
            mediator.Setup(x => x.SendAsync(It.IsAny<OrganizationIdQuery>()))
                    .ReturnsAsync(organizationId);
            var sut = new ItineraryController(mediator.Object, MockSuccessValidation().Object);
            sut.SetClaims(new List<Claim>
            {
                new Claim(AllReady.Security.ClaimTypes.UserType, UserType.OrgAdmin.ToString()),
                new Claim(AllReady.Security.ClaimTypes.Organization, organizationId.ToString())
            });

            var view = await sut.SelectRequests(itinerary.Id, itineraryRequestsModel);

            RunSelectRequestsHappyPathTests(view, itinerary, returnedRequests);
        }
开发者ID:gftrader,项目名称:allReady,代码行数:24,代码来源:ItineraryAdminControllerTests.cs


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