本文整理汇总了C#中AllReady.Areas.Admin.Controllers.ItineraryController类的典型用法代码示例。如果您正苦于以下问题:C# ItineraryController类的具体用法?C# ItineraryController怎么用?C# ItineraryController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ItineraryController类属于AllReady.Areas.Admin.Controllers命名空间,在下文中一共展示了ItineraryController类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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");
}
开发者ID:dpaquette,项目名称:allReady,代码行数:7,代码来源:ItineraryAdminControllerTests.cs
示例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");
}
开发者ID:yobenzima,项目名称:allReady,代码行数:7,代码来源:ItineraryAdminControllerTests.cs
示例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");
}
开发者ID:dpaquette,项目名称:allReady,代码行数:7,代码来源:ItineraryAdminControllerTests.cs
示例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}");
}
开发者ID:yobenzima,项目名称:allReady,代码行数:7,代码来源:ItineraryAdminControllerTests.cs
示例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}");
}
开发者ID:dpaquette,项目名称:allReady,代码行数:7,代码来源:ItineraryAdminControllerTests.cs
示例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");
}
开发者ID:yobenzima,项目名称:allReady,代码行数:7,代码来源:ItineraryAdminControllerTests.cs
示例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>()));
}
开发者ID:dpaquette,项目名称:allReady,代码行数:8,代码来源:ItineraryAdminControllerTests.cs
示例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);
}
开发者ID:dpaquette,项目名称:allReady,代码行数:10,代码来源:ItineraryAdminControllerTests.cs
示例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);
}
开发者ID:dpaquette,项目名称:allReady,代码行数:19,代码来源:ItineraryAdminControllerTests.cs
示例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);
}
开发者ID:dpaquette,项目名称:allReady,代码行数:8,代码来源:ItineraryAdminControllerTests.cs
示例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);
}
开发者ID:dpaquette,项目名称:allReady,代码行数:12,代码来源:ItineraryAdminControllerTests.cs
示例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);
}
开发者ID:dpaquette,项目名称:allReady,代码行数:6,代码来源:ItineraryAdminControllerTests.cs
示例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)));
}
开发者ID:dpaquette,项目名称:allReady,代码行数:11,代码来源:ItineraryAdminControllerTests.cs
示例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);
}
开发者ID:dpaquette,项目名称:allReady,代码行数:10,代码来源:ItineraryAdminControllerTests.cs
示例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 });
}
开发者ID:dpaquette,项目名称:allReady,代码行数:16,代码来源:ItineraryAdminControllerTests.cs
示例16: EditPost_ReturnsBadResult_WhenEditItineraryQuery_ReturnsNull
public async Task EditPost_ReturnsBadResult_WhenEditItineraryQuery_ReturnsNull()
{
var mediator = new Mock<IMediator>();
mediator.Setup(x => x.SendAsync(It.IsAny<ItinerarySummaryQuery>())).ReturnsAsync(null);
var sut = new ItineraryController(mediator.Object, Mock.Of<IItineraryEditModelValidator>());
Assert.IsType<BadRequestResult>(await sut.Edit(new ItineraryEditViewModel { Id = 50 }));
}
开发者ID:dpaquette,项目名称:allReady,代码行数:9,代码来源:ItineraryAdminControllerTests.cs
示例17: AddTeamMemberSendsOrganizationIdQueryWithCorrectItineraryId
public async Task AddTeamMemberSendsOrganizationIdQueryWithCorrectItineraryId()
{
const int itineraryId = 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(1);
var sut = new ItineraryController(mockMediator.Object, null);
sut.SetClaims(new List<Claim>
{
new Claim(AllReady.Security.ClaimTypes.UserType, UserType.SiteAdmin.ToString())
});
await sut.AddTeamMember(itineraryId, 0);
mockMediator.Verify(x => x.SendAsync(It.Is<OrganizationIdQuery>(y => y.ItineraryId == itineraryId)), Times.Once);
}
开发者ID:dpaquette,项目名称:allReady,代码行数:18,代码来源:ItineraryAdminControllerTests.cs
示例18: AddRequestsSendsOrganizationIdQueryWithCorrectItineraryId
public async Task AddRequestsSendsOrganizationIdQueryWithCorrectItineraryId()
{
const int itineraryId = 1;
var mockMediator = new Mock<IMediator>();
var sut = new ItineraryController(mockMediator.Object, null);
await sut.AddRequests(itineraryId, It.IsAny<List<string>>());
mockMediator.Verify(x => x.SendAsync(It.Is<OrganizationIdQuery>(y => y.ItineraryId == itineraryId)), Times.Once);
}
开发者ID:dpaquette,项目名称:allReady,代码行数:11,代码来源:ItineraryAdminControllerTests.cs
示例19: AddRequestsSendsAddRequestsCommandWhenThereAreSelectedRequests
public async Task AddRequestsSendsAddRequestsCommandWhenThereAreSelectedRequests()
{
const int orgId = 1;
var itineraryId = It.IsAny<int>();
var selectedRequests = new List<string> { "request1", "request2" };
var mockMediator = new Mock<IMediator>();
mockMediator.Setup(x => x.SendAsync(It.IsAny<OrganizationIdQuery>())).ReturnsAsync(orgId);
mockMediator.Setup(x => x.SendAsync(It.IsAny<AddRequestsToItineraryCommand>())).ReturnsAsync(true);
var sut = new ItineraryController(mockMediator.Object, null);
sut.MakeUserAnOrgAdmin(orgId.ToString());
await sut.AddRequests(itineraryId, selectedRequests);
mockMediator.Verify(x => x.SendAsync(It.Is<AddRequestsToItineraryCommand>(y => y.RequestIdsToAdd.Equals(selectedRequests))), Times.Once);
}
开发者ID:dpaquette,项目名称:allReady,代码行数:18,代码来源:ItineraryAdminControllerTests.cs
示例20: 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
注:本文中的AllReady.Areas.Admin.Controllers.ItineraryController类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论