public void DeleteAutoTest()
 {
     TestEnvironmentHelper.InitializeTestData();
     AutoReservationBusinessComponent autoReservation = new AutoReservationBusinessComponent();
     int count = autoReservation.GetAutos().Count;
     Auto delete = autoReservation.GetAutos()[0];
     int id = delete.Id;
     autoReservation.DeleteAuto(delete);
     Assert.AreEqual(count - 1, autoReservation.GetAutos().Count);
     Assert.IsNull(autoReservation.GetAuto(id));
 }
 public void AutoTest()
 {
     TestEnvironmentHelper.InitializeTestData();
     AutoReservationBusinessComponent autoReservation = new AutoReservationBusinessComponent();
     IList<Auto> autos = autoReservation.GetAutos();
     Assert.AreEqual(3, autos.Count);
 }
 public void GetAutoByIdTest()
 {
     TestEnvironmentHelper.InitializeTestData();
     AutoReservationBusinessComponent autoReservation = new AutoReservationBusinessComponent();
     IList<Auto> autos = autoReservation.GetAutos();
     Auto first = autos[0];
     int id = first.Id;
     Auto autoById = autoReservation.GetAuto(id);
     Assert.IsTrue(first.Equals(autoById));
 }
        public void UpdateAutoTest()
        {
            string modifiedBrand = "Test Marke";
            TestEnvironmentHelper.InitializeTestData();
            AutoReservationBusinessComponent autoReservation = new AutoReservationBusinessComponent();
            IList<Auto> autos = autoReservation.GetAutos();
            var standartAuto = from a in autos
                               where a.Marke == "Fiat Punto"
                               select a;

            Auto fiat = standartAuto.FirstOrDefault();
            Auto original = StandardAuto.CreateStandardAuto(fiat.Id, fiat.Marke, fiat.Tagestarif);

            Auto modified = autos[0];
            int modifiedAutoId = modified.Id;
            modified.Marke = modifiedBrand;
            autoReservation.UpdateAuto(modified, original);

            Auto fetchedFromDb = autoReservation.GetAuto(modifiedAutoId);
            Assert.AreEqual(modified.Marke, fetchedFromDb.Marke);
        }
 public void InsertAutoTest()
 {
     TestEnvironmentHelper.InitializeTestData();
     AutoReservationBusinessComponent autoReservation = new AutoReservationBusinessComponent();
     Auto auto = new StandardAuto();
     int count = autoReservation.GetAutos().Count;
     int id = 99999;
     auto.Id = id;
     auto.Marke = "Marke";
     autoReservation.InsertAuto(auto);
     Assert.AreEqual(count + 1, autoReservation.GetAutos().Count);
 }