Esempio n. 1
0
        public void We_should_have_different_data()
        {
            var firstPerson  = RepositoryOption.GetUser(2).ValueOrDefault();
            var secondPerson = RepositoryOption.GetUser(3).ValueOrDefault();

            firstPerson.Name.Should().NotBe(secondPerson.Name);
        }
Esempio n. 2
0
        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>());
        }