本文整理汇总了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>()));
}
示例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);
}
示例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>()));
}
示例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);
}
示例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);
}
示例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);
}