public void ShouldReturnNotFoundOnFlightNumberNotFound(int number)
        {
            MockFlightProvider.Setup(m => m.GetFlight(It.IsAny <int>())).Returns((Flight)null);

            var result = GetTestSubject().Get(number) as NotFoundResult;

            result.Should().NotBe(null);
        }
        public void ShouldReturnBadRequestOnInvalidFilter()
        {
            MockFlightProvider.Setup(m => m.GetFilteredFlights(It.IsAny <FlightFilter>())).Returns(new List <Flight>());

            var result = GetTestSubject().Post(new FlightFilter()) as BadRequestErrorMessageResult;

            result.Should().NotBe(null);
        }
        public void ShouldReturnOneFlight()
        {
            MockFlightProvider.Setup(m => m.GetFlight(It.IsAny <int>())).Returns(FlightTestData.Flight(3));

            var result = GetTestSubject().Get(3) as OkNegotiatedContentResult <Flight>;

            result.Content.Should().BeEquivalentTo(FlightTestData.Flight(3));
        }
        public void ShouldReturnNotFoundOnFilter()
        {
            MockFlightProvider.Setup(m => m.GetFilteredFlights(It.IsAny <FlightFilter>())).Returns(new List <Flight>());

            var result = GetTestSubject().Post(new FlightFilter {
                FilterType = FilterType.Airfield, Airfield = "Test"
            }) as NotFoundResult;

            result.Should().NotBe(null);
        }
        public void ShouldReturnListOfFlightsOnFilter()
        {
            MockFlightProvider.Setup(m => m.GetFilteredFlights(It.IsAny <FlightFilter>())).Returns(FlightTestData.FilteredFlights());

            var result = GetTestSubject().Post(new FlightFilter {
                FilterType = FilterType.Number, FlightStart = 1, FlightEnd = 3
            }) as OkNegotiatedContentResult <List <Flight> >;

            GetContent <List <Flight> >(result).Count.Should().Be(3);
        }
Пример #6
0
        public void ShouldReturnListofFlights()
        {
            MockFlightProvider.Setup(m => m.GetFlightsByPage(1)).Returns(Task.FromResult(FlightsByPage.Page()));

            var fc = GetTestSubject();

            var result = fc.Get(1).Result as OkNegotiatedContentResult <List <Flight> >;

            GetContent(result).Count.Should().Be(10);
        }
Пример #7
0
        public void ShouldReturnOkResult()
        {
            MockFlightProvider.Setup(m => m.GetFlightsByPage(1)).Returns(Task.FromResult(FlightsByPage.Page()));

            var fc = GetTestSubject();

            var result = fc.Get(1).Result as OkNegotiatedContentResult <List <Flight> >;

            result.Should().NotBe(null);
        }
Пример #8
0
        public void ShouldReturnNotFoundOnPageNumberNotFound()
        {
            MockFlightProvider.Setup(m => m.GetFlightsByPage(It.IsAny <int>())).Returns(Task.FromResult((List <Flight>)null));

            var fc = GetTestSubject();

            var result = fc.Get(2).Result as NotFoundResult;

            result.Should().NotBe(null);
        }
Пример #9
0
        public void ShouldReturnOneFlight()
        {
            MockFlightProvider.Setup(m => m.GetFilteredFlights(It.IsAny <FlightFilter>())).Returns(Task.FromResult(FlightsByPage.Flight(new FlightFilter())));

            var fc = GetTestSubject();

            var result = fc.Get(new FlightFilter()).Result as OkNegotiatedContentResult <List <Flight> >;

            GetContent(result).Count.Should().Be(1);
        }
Пример #10
0
        public void ShouldReturnNotFoundOnFilter()
        {
            MockFlightProvider.Setup(m => m.GetFlightsByPage(1)).Returns(Task.FromResult((List <Flight>)null));

            var fc = GetTestSubject();

            var result = fc.Get(new FlightFilter()).Result as NotFoundResult;

            result.Should().NotBe(null);
        }