예제 #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);
        }
예제 #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>());
        }
예제 #3
0
 public void We_should_have_only_100_cars()
 {
     RepositoryOption.GetCar(100).HasValue.Should().BeFalse();
 }