예제 #1
0
        void getUserRoutes()
        {
            Console.WriteLine();
            Console.WriteLine("GET USER ROUTES...");


            try
            {
                service.login("user1", "user1");
                Station st = service.findStationById("st2");
                Scooter sc = st.chooseScooterToRent();
                User    us = service.userLogged();
                // public Rental(DateTime startDate, Station originStation, Scooter scooter, User user)
                Rental rental = new Rental(DateTime.Now.AddMinutes(-200), st, sc, us);
                service.rentScooter(rental);
                st     = service.findStationById("st3");
                rental = us.lastRental();
                decimal price = service.returnScooter(rental, st);
                service.logout();
            }
            catch (Exception e)
            {
                printError(e);
            }

            try
            {
                service.login("user1", "user1");
                User us = service.userLogged();

                List <Rental> lR = service.getRentalsByDate(us, DateTime.Now.AddMinutes(-900), DateTime.Now);

                foreach (Rental r in lR)
                {
                    Console.WriteLine(rentalToString(r));
                }
            }
            catch (Exception e)
            {
                printError(e);
            }
        }