/// <summary>
        /// Method to add booking to db.
        /// </summary>
        /// <param name="booking">Booking object to add.</param>
        /// <returns>If new booking created- a booking id, else- throws an exception.</returns>
        public int AddBooking(Booking booking)
        {
            if (booking.StartTime < DateTime.Today.Date)
            {
                InvalidDateException fault = new InvalidDateException();
                fault.Message     = "Error with chosen date.";
                fault.Description = "Date from has to be today or later, please try again.";
                throw new FaultException <InvalidDateException>(fault);
            }
            else if (booking.EndTime < booking.StartTime || booking.EndTime < DateTime.Today.Date)
            {
                InvalidDateException fault = new InvalidDateException();
                fault.Message     = "Error with chosen date.";
                fault.Description = "Date to has to be either the same as today or later, please try again.";
                throw new FaultException <InvalidDateException>(fault);
            }
            else
            {
                List <Car> availableCars = ListAvailableCars(booking.StartTime, booking.EndTime);
                bool       available     = availableCars.Any(c => c.Id == booking.CarId);

                if (!available)
                {
                    throw new InvalidOperationException("Something went wrong, couldn't book car.");
                }
                repos.Add(booking);
                repos.SaveChanges();
                return(booking.Id);
            }
        }
        public void InvalidDateExceptionConstructorBuildsCorrectMessage()
        {
            // Arrange
            var invalidDate = "i-am-not-a-date";
            var expectedMessage = string.Format("The date '{0}' is not a valid date, please supply a valid date.", invalidDate);
            var exception = new InvalidDateException(invalidDate);

            // Assert
            Assert.AreEqual(expectedMessage, exception.Message, true);
        }