예제 #1
0
        public void GetEventsByGeographyReturnsCorrectViewModel()
        {
            var mediator = new Mock <IMediator>();

            mediator.Setup(x => x.Send(It.IsAny <EventsByGeographyQuery>())).Returns(new List <Event>());

            var sut    = new EventApiController(mediator.Object);
            var result = sut.GetEventsByGeography(It.IsAny <double>(), It.IsAny <double>(), It.IsAny <int>());

            Assert.IsType <List <EventViewModel> >(result);
        }
예제 #2
0
        public void GetEventsByGeographySendsEventsByGeographyQueryWithCorrectLatitudeLongitudeAndMiles()
        {
            const double latitude  = 1;
            const double longitude = 2;
            const int    miles     = 100;

            var mediator = new Mock <IMediator>();

            mediator.Setup(x => x.Send(It.IsAny <EventsByGeographyQuery>())).Returns(new List <Event>());

            var sut = new EventApiController(mediator.Object);

            sut.GetEventsByGeography(latitude, longitude, miles);

            mediator.Verify(x => x.Send(It.Is <EventsByGeographyQuery>(y => y.Latitude == latitude && y.Longitude == longitude && y.Miles == miles)), Times.Once);
        }