Example #1
0
        public async Task BookCar_GivenANewBooking_WhenBookSpecificCar_ThenSpecificCarShouldBeBooked(string email, string password, DateTime startDate, DateTime endDate)
        {
            // Given
            var resultAllCars = await carController.GetCars("");

            var expectedCar            = resultAllCars.ToList().First();
            var authenticationResponse = await userController.UserLogin(
                new AuthenticationRequest()
            {
                Email    = email,
                Password = password
            }
                );

            var expectedBooking = CreateBooking(expectedCar.Id, authenticationResponse.UserId, startDate, endDate);

            // When
            var booking = await carController.BookCar(expectedBooking);

            var car = booking.Car;

            // Then
            car.Id.Should().Be(expectedBooking.CarId.ToString(), "because I booked this car!");
        }