本文整理汇总了C#中AllReady.Controllers.EventApiController.SetDefaultHttpContext方法的典型用法代码示例。如果您正苦于以下问题:C# EventApiController.SetDefaultHttpContext方法的具体用法?C# EventApiController.SetDefaultHttpContext怎么用?C# EventApiController.SetDefaultHttpContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AllReady.Controllers.EventApiController
的用法示例。
在下文中一共展示了EventApiController.SetDefaultHttpContext方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UnregisterEventSendsUnregisterEventWithCorrectEventSignupId
public async Task UnregisterEventSendsUnregisterEventWithCorrectEventSignupId()
{
const int eventId = 1;
const int eventSignupId = 1;
var mediator = new Mock<IMediator>();
mediator.Setup(x => x.Send(It.IsAny<EventSignupByEventIdAndUserIdQuery>()))
.Returns(new EventSignup { Id = eventSignupId, Event = new Event(), User = new ApplicationUser() });
var controller = new EventApiController(mediator.Object, null);
controller.SetDefaultHttpContext();
await controller.UnregisterEvent(eventId);
mediator.Verify(x => x.SendAsync(It.Is<UnregisterEvent>(y => y.EventSignupId == eventSignupId)));
}
示例2: UnregisterEventReturnsHttpNotFoundWhenUnableToGetEventSignupByEventSignupIdAndUserId
public async Task UnregisterEventReturnsHttpNotFoundWhenUnableToGetEventSignupByEventSignupIdAndUserId()
{
var controller = new EventApiController(Mock.Of<IMediator>(), null);
controller.SetDefaultHttpContext();
var result = await controller.UnregisterEvent(It.IsAny<int>());
Assert.IsType<NotFoundResult>(result);
}