本文整理汇总了C#中AllReady.Areas.Admin.Controllers.ItineraryController类的典型用法代码示例。如果您正苦于以下问题:C# ItineraryController类的具体用法?C# ItineraryController怎么用?C# ItineraryController使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ItineraryController类属于AllReady.Areas.Admin.Controllers命名空间,在下文中一共展示了ItineraryController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ControllerHasAreaAuthorizeAttributeWithCorrectPolicy
public void ControllerHasAreaAuthorizeAttributeWithCorrectPolicy()
{
var sut = new ItineraryController(null, null);
var attribute = sut.GetAttributes().OfType<AuthorizeAttribute>().SingleOrDefault();
Assert.NotNull(attribute);
Assert.Equal(attribute.Policy, "OrgAdmin");
}
示例2: ControllerHasAreaAuthorizeAttributeWithCorrectPolicy
public void ControllerHasAreaAuthorizeAttributeWithCorrectPolicy()
{
var sut = new ItineraryController(Mock.Of<IMediator>(), MockSuccessValidation().Object);
var attribute = sut.GetAttributes().OfType<AuthorizeAttribute>().SingleOrDefault();
Assert.NotNull(attribute);
Assert.Equal(attribute.Policy, "OrgAdmin");
}
示例3: ControllerHasAreaAtttributeWithTheCorrectAreaName
public void ControllerHasAreaAtttributeWithTheCorrectAreaName()
{
var sut = new ItineraryController(null, null);
var attribute = sut.GetAttributes().OfType<AreaAttribute>().SingleOrDefault();
Assert.NotNull(attribute);
Assert.Equal(attribute.RouteValue, "Admin");
}
示例4: DetailsHasRouteAttributeWithCorrectRoute
public void DetailsHasRouteAttributeWithCorrectRoute()
{
var sut = new ItineraryController(Mock.Of<IMediator>(), MockSuccessValidation().Object);
var routeAttribute = sut.GetAttributesOn(x => x.Details(It.IsAny<int>())).OfType<RouteAttribute>().SingleOrDefault();
Assert.NotNull(routeAttribute);
Assert.Equal(routeAttribute.Template, "Admin/Itinerary/Details/{id}");
}
示例5: DetailsHasRouteAttributeWithCorrectRoute
public void DetailsHasRouteAttributeWithCorrectRoute()
{
var sut = new ItineraryController(null, null);
var routeAttribute = sut.GetAttributesOn(x => x.Details(It.IsAny<int>())).OfType<RouteAttribute>().SingleOrDefault();
Assert.NotNull(routeAttribute);
Assert.Equal(routeAttribute.Template, "Admin/Itinerary/Details/{id}");
}
示例6: ControllerHasAreaAtttributeWithTheCorrectAreaName
public void ControllerHasAreaAtttributeWithTheCorrectAreaName()
{
var sut = new ItineraryController(Mock.Of<IMediator>(), MockSuccessValidation().Object);
var attribute = sut.GetAttributes().OfType<AreaAttribute>().SingleOrDefault();
Assert.NotNull(attribute);
Assert.Equal(attribute.RouteValue, "Admin");
}
示例7: 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>()));
}
示例8: 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);
}
示例9: 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);
}
示例10: 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);
}
示例11: 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);
}
示例12: SelectRequestsGetHasHttpGetAttribute
public void SelectRequestsGetHasHttpGetAttribute()
{
var sut = new ItineraryController(null, null);
var attribute = sut.GetAttributesOn(x => x.SelectRequests(It.IsAny<int>())).OfType<HttpGetAttribute>().SingleOrDefault();
Assert.NotNull(attribute);
}
示例13: 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)));
}
示例14: EditPost_SendsItinerarySummaryQuery_WithCorrectId
public async Task EditPost_SendsItinerarySummaryQuery_WithCorrectId()
{
var mediator = new Mock<IMediator>();
mediator.Setup(x => x.SendAsync(It.IsAny<ItinerarySummaryQuery>())).ReturnsAsync(null).Verifiable();
var sut = new ItineraryController(mediator.Object, Mock.Of<IItineraryEditModelValidator>());
await sut.Edit(new ItineraryEditViewModel { Id = 50 });
mediator.Verify(x => x.SendAsync(It.Is<ItinerarySummaryQuery>(y => y.ItineraryId == 50)), Times.Once);
}
示例15: ItineraryController
public async Task AddTeamMemberRedirectsToCorrectActionWithCorrectRouteValuesWhenOrganizationIdIsNotZero_AndUserIsOrgAdmin_AndIdOrSelectedTeamMemberIsNotZero()
{
const int itineraryId = 1;
const int orgId = 1;
var mockMediator = new Mock<IMediator>();
mockMediator.Setup(x => x.SendAsync(It.IsAny<AddTeamMemberCommand>())).ReturnsAsync(true);
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.AddTeamMember(itineraryId, 1) as RedirectToActionResult;
Assert.Equal(result.ActionName, nameof(ItineraryController.Details));
Assert.Equal(result.RouteValues, new Dictionary<string, object> { ["id"] = itineraryId });
}