Esempio n. 1
0
        public async Task ClubServiceTest()
        {
            ImportDataTest import = new ImportDataTest();

            import.InitContext();
            try
            {
                _context = import._context;
                IReservationRepository reservationRepository = new ReservationRepository(_context);
                cr = new ReservationService(reservationRepository);
                AircraftReservation ar = new AircraftReservation();
                ar.DateFrom   = DateTime.Now;
                ar.DateTo     = DateTime.Now.AddHours(1);
                ar.TailNumber = "4xCGC";
                ar.IdNumber   = "123456";
                _context.AircraftReservations.Add(ar);
                _context.SaveChanges();
                var reser = await cr.GetReservation();

                await cr.AddReservation(ar);

                ar.IdNumber = "098765";
                await cr.EditReservation(ar);

                reser = await cr.GetAircraftReservation(ar.TailNumber);

                var aa = await cr.AddReservation(ar);

                AircraftReservation ab = new AircraftReservation();
                ab.DateFrom   = ar.DateTo;
                ab.DateTo     = ab.DateFrom.AddHours(5);
                ab.TailNumber = ar.TailNumber;
                aa            = await cr.AddReservation(ab);

                reser = await cr.GetReservation();

                reser = await cr.GetPilotReservation(ar.IdNumber);

                await cr.DeleteReservation(ar.Id);

                reser = await cr.GetReservation();
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }
        }