public Option <Reservation> RentVehicke(int userId, int vehicleId) { var user = RepositoryOption.GetUser(userId); var car = RepositoryOption.GetCar(vehicleId); var oldReservation = RepositoryOption.GetReservationsByUser(userId); if (user.HasValue && car.HasValue && !oldReservation.HasValue) { var reservation = new Reservation() { Id = 1, UserId = userId, VehicleId = vehicleId }; Repository._reservations.Add(reservation); return(reservation.Some()); } return(Optional.Option.None <Reservation>()); }
public void We_should_have_only_100_cars() { RepositoryOption.GetCar(100).HasValue.Should().BeFalse(); }