public void UpdateReservationTest()
        {
            using (AutoReservationEntities context = new AutoReservationEntities())
            {
                TestEnvironmentHelper.InitializeTestData();

                AutoReservationBusinessComponent arbc = new AutoReservationBusinessComponent();

                var res = (from reservation in context.Reservationen select reservation).FirstOrDefault().ReservationsNr;

                Reservation reservationOriginal = arbc.GetReservation(res);
                Reservation reservationModified = arbc.GetReservation(res);

                reservationModified.Bis = new System.DateTime(2020, 1, 21);
                arbc.EditReservation(reservationOriginal, reservationModified);

                Assert.AreEqual(reservationOriginal.Bis, reservationModified.Bis, "UpdateReservationTest: Reservationen sind nicht gleich nach Update");
            }
        }
 public void DeleteReservationTest()
 {
     TestEnvironmentHelper.InitializeTestData();
     AutoReservationBusinessComponent autoReservation = new AutoReservationBusinessComponent();
     int count = autoReservation.GetReservationen().Count;
     Reservation delete = autoReservation.GetReservationen()[0];
     int nr = delete.ReservationNr;
     autoReservation.DeleteReservation(delete);
     Assert.AreEqual(count - 1, autoReservation.GetReservationen().Count);
     Assert.IsNull(autoReservation.GetReservation(nr));
 }
 public void GetReservationByIllegalNr()
 {
     TestEnvironmentHelper.InitializeTestData();
     AutoReservationBusinessComponent autoReservation = new AutoReservationBusinessComponent();
     Reservation reservationById = autoReservation.GetReservation(9999999);
     Assert.IsNull(reservationById);
 }
        public void UpdateReservationTest()
        {
            TestEnvironmentHelper.InitializeTestData();
            AutoReservationBusinessComponent autoReservation = new AutoReservationBusinessComponent();
            IList<Reservation> reservationen = autoReservation.GetReservationen();
            Reservation modified = reservationen[0];
            int reservationId = modified.ReservationNr;
            Reservation original = Reservation.CreateReservation(modified.ReservationNr, modified.AutoId, modified.KundeId, modified.Von, modified.Bis);
            DateTime modifiedDate = System.DateTime.Today;
            modified.Bis = modifiedDate;
            autoReservation.UpdateReservation(modified, original);

            Reservation reservationFetchedFromDb = autoReservation.GetReservation(reservationId);
            Assert.AreEqual(modified.Bis, reservationFetchedFromDb.Bis);
        }
 public void GetReservationByNrTest()
 {
     TestEnvironmentHelper.InitializeTestData();
     AutoReservationBusinessComponent autoReservation = new AutoReservationBusinessComponent();
     IList<Reservation> reservationen = autoReservation.GetReservationen();
     Reservation first = reservationen[0];
     int nr = first.ReservationNr;
     Reservation reservationById = autoReservation.GetReservation(nr);
     Assert.IsTrue(first.Equals(reservationById));
 }