예제 #1
0
 public void GetCheckinReturnsHttpNotFoundWhenUnableToFindEventByEventId()
 {
     var sut = new EventApiController(Mock.Of<IMediator>(), null);
     var result = sut.GetCheckin(It.IsAny<int>());
     Assert.IsType<NotFoundResult>(result);
 }
예제 #2
0
        public void GetCheckinReturnsTheCorrectView()
        {
            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, null);
            var result = (ViewResult)sut.GetCheckin(It.IsAny<int>());

            Assert.Equal("NoUserCheckin", result.ViewName);
        }
        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);
        }