예제 #1
0
        public async Task TestGetBookingFail()
        {
            BookingJson booking = new BookingJson();
            var         result  = await booking.GetBookingsAsync(ConnString, "John", "Doe", DateTime.MinValue, "Hobart", "", null);

            Assert.IsTrue(result.Count == 0);
        }
예제 #2
0
        public async Task TestGetBookingPass()
        {
            BookingJson booking = new BookingJson();
            var         result  = await booking.GetBookingsAsync(ConnString, "John", "Doe", DateTime.MinValue, "Melbourne", "", null);

            Assert.IsNotNull(result);
        }
예제 #3
0
 public async Task TestFlightBookingFail()
 {
     BookingJson booking = new BookingJson();
     var         result  = await booking.BookFlightAsync(ConnString, new BookingJson()
     {
         ArrCity    = "Brisbane",
         DepartCity = null,
         BookDate   = new DateTime(2018, 05, 21),
         FlightNo   = "VA234",
         FirstName  = "Roger",
         LastName   = "Smith"
     });
 }
예제 #4
0
        public async Task <JsonResult> BookFlightAsync(BookingJson bookDetail)
        {
            try
            {
                BookingJson booking = new BookingJson();
                var         result  = await booking.BookFlightAsync(ConnectionString, bookDetail);

                return(Json(result));
            }
            catch
            {
                return(Json(null));
            }
        }
예제 #5
0
        public async Task <JsonResult> SearchBooking(string fname, string lname, DateTime date, string arrcity, string depcity, string flightno)
        {
            try
            {
                BookingJson bookingJsonObj = new BookingJson();
                var         result         = await bookingJsonObj.GetBookingsAsync(ConnectionString, fname, lname, date, arrcity, depcity, flightno);

                return(Json(result));
            }
            catch
            {
                return(Json(null));
            }
        }
예제 #6
0
        public async Task TestFlightBookingPass()
        {
            BookingJson booking = new BookingJson();
            var         result  = await booking.BookFlightAsync(ConnString, new BookingJson()
            {
                ArrCity    = "Brisbane",
                DepartCity = "Perth",
                BookDate   = new System.DateTime(2018, 5, 28),
                FlightNo   = "VA234",
                FirstName  = "Roger",
                LastName   = "Smith"
            });

            Assert.IsTrue(result);
        }