public void ScenarioOkay03Test_ReservationOutsideRange_AfterLatestTo()
        {
            var res = new Reservation
            {
                From  = DateTime.Today.AddDays(10),
                To    = DateTime.Today.AddDays(12),
                Auto  = PreparedCar,
                Kunde = PreparedKunde
            };

            ReservationManager.CheckCarAvailability(res, Target);
        }
        public void ScenarioOkay04Test_ReservationOutsideRange_BeforeFirstFrom()
        {
            var res = new Reservation
            {
                From  = DateTime.Today.AddDays(-2),
                To    = DateTime.Today,
                Auto  = PreparedCar,
                Kunde = PreparedKunde
            };

            ReservationManager.CheckCarAvailability(res, Target);
        }
        public void ScenarioOkay02Test_ModifyingOnlyReservation()
        {
            var reservationen = Target.GetAllForGivenAuto(3).ToList();

            Assert.Equal(1, reservationen.Count);

            var reservation = reservationen.First();

            reservation.To = new DateTime(2100, 1, 1);

            ReservationManager.CheckCarAvailability(reservation, Target);
        }
        public void ScenarioOkay05Test_ReservationInsideRange_BetweenOthers()
        {
            var res = new Reservation
            {
                From  = DateTime.Today.AddDays(4),
                To    = DateTime.Today.AddDays(6),
                Auto  = PreparedCar,
                Kunde = PreparedKunde
            };

            ReservationManager.CheckCarAvailability(res, Target);
        }
        public void ScenarioNotOkay05Test_AnyInnerOverlapWithReservation()
        {
            var res = new Reservation
            {
                From  = DateTime.Today.AddDays(1),
                To    = DateTime.Today.AddDays(2),
                Auto  = PreparedCar,
                Kunde = PreparedKunde
            };
            Action a = () => ReservationManager.CheckCarAvailability(res, Target);

            Assert.Throws <AutoUnavailableException>(a);
        }
        public void ScenarioNotOkay02Test_AnyFromBeforeReservationTo()
        {
            var res = new Reservation
            {
                From  = DateTime.Today.AddDays(5),
                To    = DateTime.Today.AddDays(8),
                Auto  = PreparedCar,
                Kunde = PreparedKunde
            };
            Action a = () => ReservationManager.CheckCarAvailability(res, Target);

            Assert.Throws <AutoUnavailableException>(a);
        }
        public void ScenarioOkay01Test_NoReservationsForCarYet()
        {
            var car = new StandardAuto
            {
                Brand     = "PaddyWaggon",
                DailyRate = 120
            };

            var autoManager = new AutoManager();

            autoManager.Create(car);

            var reservation = new Reservation
            {
                Auto    = autoManager.GetAll().OrderBy(c => c.Id).Last(),
                KundeId = 1,
                From    = DateTime.Today,
                To      = DateTime.Today.AddDays(2)
            };

            ReservationManager.CheckCarAvailability(reservation, Target);
        }