Example #1
0
        public void DeleteBookingReturns201()
        {
            BookingPayload payload = new BookingPayload();

            payload.SetFirstname("Mary");
            payload.SetLastname("White");
            payload.SetTotalPrice(200);
            payload.SetDepositPaid(true);
            payload.SetBookingDates(new BookingDatesPayload(new DateTime(2017, 3, 31), new DateTime(2017, 4, 3)));
            payload.SetAdditionalNeeds("None");

            var    response        = Booking.PostBooking(payload);
            string responsePayload = response.Content.ReadAsStringAsync().Result;
            BookingResponsePayload bookingResponse = JsonConvert.DeserializeObject <BookingResponsePayload>(responsePayload);

            AuthPayload authPayload = new AuthPayload();

            authPayload.SetUsername("admin");
            authPayload.SetPassword("password123");

            AuthResponsePayload authResponse = Auth.PostAuth(authPayload);

            var deleteResponse = Booking.DeleteBooking(bookingResponse.bookingid, authResponse.token);

            Assert.IsTrue(deleteResponse.StatusCode == HttpStatusCode.Created, "Http Status Code is not 201");
        }
Example #2
0
        public void PostBookingReturns200()
        {
            BookingPayload payload = new BookingPayload();

            payload.SetFirstname("Mary");
            payload.SetLastname("White");
            payload.SetTotalPrice(200);
            payload.SetDepositPaid(true);
            payload.SetBookingDates(new BookingDatesPayload(new DateTime(2017, 3, 31), new DateTime(2017, 4, 3)));
            payload.SetAdditionalNeeds("None");

            var response = Booking.PostBooking(payload);

            Assert.IsTrue(response.IsSuccessStatusCode, "Status Code is not 200");
        }