예제 #1
0
        public async Task GetCheckinReturnsHttpNotFoundWhenUnableToFindEventByEventId()
        {
            var sut    = new EventApiController(Mock.Of <IMediator>());
            var result = await sut.GetCheckin(It.IsAny <int>());

            Assert.IsType <NotFoundResult>(result);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }