public async Task GetCheckinReturnsHttpNotFoundWhenUnableToFindEventByEventId() { var sut = new EventApiController(Mock.Of <IMediator>()); var result = await sut.GetCheckin(It.IsAny <int>()); Assert.IsType <NotFoundResult>(result); }
public async Task GetCheckinReturnsTheCorrectView() { var mediator = new Mock <IMediator>(); mediator.Setup(x => x.SendAsync(It.IsAny <EventByEventIdQuery>())).ReturnsAsync(new Event { Campaign = new Campaign { ManagingOrganization = new Organization() } }); var sut = new EventApiController(mediator.Object); var result = await sut.GetCheckin(It.IsAny <int>()) as ViewResult; Assert.Equal("NoUserCheckin", result.ViewName); }
public void GetCheckinReturnsTheCorrectViewModel() { var mediator = new Mock <IMediator>(); mediator.Setup(x => x.Send(It.IsAny <EventByIdQuery>())).Returns(new Event { Campaign = new Campaign { ManagingOrganization = new Organization() } }); var sut = new EventApiController(mediator.Object); var result = (ViewResult)sut.GetCheckin(It.IsAny <int>()); Assert.IsType <Event>(result.ViewData.Model); }