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


C# ItineraryController.Details方法代码示例

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


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

示例1: DetailsReturnsHttpNotFoundResultWhenEventIsNull

        public async Task DetailsReturnsHttpNotFoundResultWhenEventIsNull()
        {
            var mockMediator = new Mock<IMediator>();
            mockMediator.Setup(mock => mock.SendAsync(It.IsAny<ItineraryDetailQuery>())).ReturnsAsync(null).Verifiable();

            var controller = new ItineraryController(mockMediator.Object, null);
            Assert.IsType<NotFoundResult>(await controller.Details(It.IsAny<int>()));
        }
开发者ID:mheggeseth,项目名称:allReady,代码行数:8,代码来源:ItineraryAdminControllerTests.cs

示例2: DetailsSendsEventDetailQueryWithCorrectEventId

        public async Task DetailsSendsEventDetailQueryWithCorrectEventId()
        {
            var mockMediator = new Mock<IMediator>();
            mockMediator.Setup(mock => mock.SendAsync(It.IsAny<ItineraryDetailQuery>())).ReturnsAsync(null).Verifiable();

            var sut = new ItineraryController(mockMediator.Object, null);
            await sut.Details(1);

            mockMediator.Verify(x => x.SendAsync(It.IsAny<ItineraryDetailQuery>()), Times.Once);
        }
开发者ID:dpaquette,项目名称:allReady,代码行数:10,代码来源:ItineraryAdminControllerTests.cs

示例3: DetailsReturnsHttpUnauthorizedResultWhenUserIsNotOrgAdmin

        public async Task DetailsReturnsHttpUnauthorizedResultWhenUserIsNotOrgAdmin()
        {
            var mediator = new Mock<IMediator>();
            mediator.Setup(x => x.SendAsync(It.IsAny<ItineraryDetailQuery>())).ReturnsAsync(new ItineraryDetailsViewModel());

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

            Assert.IsType<UnauthorizedResult>(await sut.Details(It.IsAny<int>()));
        }
开发者ID:dpaquette,项目名称:allReady,代码行数:10,代码来源:ItineraryAdminControllerTests.cs

示例4: DetailsReturnsCorrectViewAndViewModelWhenEventIsNotNullAndUserIsOrgAdmin

        public async Task DetailsReturnsCorrectViewAndViewModelWhenEventIsNotNullAndUserIsOrgAdmin()
        {
            const int orgId = 1;
            var viewModel = new ItineraryDetailsViewModel { OrganizationId = orgId };

            var mediator = new Mock<IMediator>();
            mediator.Setup(x => x.SendAsync(It.IsAny<ItineraryDetailQuery>())).ReturnsAsync(viewModel);

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

            var result = await sut.Details(It.IsAny<int>()) as ViewResult;
            Assert.Equal(result.ViewName, "Details");

            var resultViewModel = result.ViewData.Model;
            Assert.IsType<ItineraryDetailsViewModel>(resultViewModel);

            Assert.Equal(resultViewModel, viewModel);
        }
开发者ID:dpaquette,项目名称:allReady,代码行数:19,代码来源:ItineraryAdminControllerTests.cs

示例5: DetailsPost_ReturnsViewModelWithCorrectRequestListData

        public async Task DetailsPost_ReturnsViewModelWithCorrectRequestListData()
        {
            const int orgId = 1;
            var fullList = new List<RequestListViewModel> {new RequestListViewModel {Id = Guid.NewGuid()}};
            var filteredList = new List<RequestListViewModel> {new RequestListViewModel {Id = Guid.NewGuid()}};
            var viewModel = new ItineraryDetailsViewModel { OrganizationId = orgId, Requests = fullList};

            var mediator = new Mock<IMediator>();
            mediator.Setup(x => x.SendAsync(It.IsAny<ItineraryDetailQuery>())).ReturnsAsync(viewModel);
            mediator.Setup(x => x.SendAsync(It.IsAny<RequestListItemsQuery>())).ReturnsAsync(filteredList);

            var sut = new ItineraryController(mediator.Object, null);
            sut.MakeUserAnOrgAdmin(orgId.ToString());
            var result = await sut.Details(It.IsAny<int>(), It.IsAny<string>(), It.IsAny<RequestStatus?>()) as ViewResult;

            var model = (ItineraryDetailsViewModel) result.ViewData.Model;

            Assert.Equal(model.Requests, filteredList);
        }
开发者ID:stevejgordon,项目名称:allReady,代码行数:19,代码来源:ItineraryAdminControllerTests.cs

示例6: DetailsPost_SendsRequestListQueryWithCorrectData

        public async Task DetailsPost_SendsRequestListQueryWithCorrectData()
        {
            const int orgId = 1;
            const int itineraryId = 2;
            const string keywords = "search";
            const RequestStatus status = RequestStatus.Assigned;
            var viewModel = new ItineraryDetailsViewModel { OrganizationId = orgId, Id = 2 };
            var requestList = new List<RequestListViewModel>();

            var mediator = new Mock<IMediator>();
            mediator.Setup(x => x.SendAsync(It.IsAny<ItineraryDetailQuery>())).ReturnsAsync(viewModel);
            mediator.Setup(x => x.SendAsync(It.IsAny<RequestListItemsQuery>())).ReturnsAsync(requestList);

            var sut = new ItineraryController(mediator.Object, null);
            sut.MakeUserAnOrgAdmin(orgId.ToString());
            await sut.Details(itineraryId, keywords, status);

            mediator.Verify(x => x.SendAsync(It.Is<RequestListItemsQuery>(
                y => y.Criteria.ItineraryId == itineraryId &&
                     y.Criteria.Keywords == keywords &&
                     y.Criteria.Status == status)), Times.Once);
        }
开发者ID:stevejgordon,项目名称:allReady,代码行数:22,代码来源:ItineraryAdminControllerTests.cs


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