public void UpdateReservationTest()
        {
            TestEnvironmentHelper.InitializeTestData();

            Reservation reservation = new Reservation
            {
                AutoId  = Target.Autos[0].Id,
                KundeId = Target.Kunden[0].Id,
                Von     = DateTime.Today,
                Bis     = DateTime.Today.AddDays(10)
            };

            int reservationNr = Target.InsertReservation(reservation);

            Assert.AreNotEqual(0, reservationNr);

            Reservation org = Target.GetReservationByNr(reservationNr);
            Reservation mod = Target.GetReservationByNr(reservationNr);

            mod.Von = DateTime.Today.AddYears(1);
            mod.Bis = DateTime.Today.AddDays(10).AddYears(1);

            Target.UpdateReservation(mod, org);

            Reservation result = Target.GetReservationByNr(reservationNr);

            Assert.AreEqual(mod.ReservationNr, result.ReservationNr);
            Assert.AreEqual(mod.Auto.Id, result.Auto.Id);
            Assert.AreEqual(mod.Kunde.Id, result.Kunde.Id);
            Assert.AreEqual(mod.Von, result.Von);
            Assert.AreEqual(mod.Bis, result.Bis);
        }
        public void UpdateAutoTest()
        {
            TestEnvironmentHelper.InitializeTestData();

            var auto = new AutoDto {
                Marke = "Renault Clio", AutoKlasse = AutoKlasse.Standard, Tagestarif = 65
            };

            var autoId = Target.InsertAuto(auto);

            Assert.AreNotEqual(0, autoId);

            var org = Target.GetAutoById(autoId);
            var mod = Target.GetAutoById(autoId);

            mod.Marke = "Fiat 500";

            Target.UpdateAuto(mod, org);

            var result = Target.GetAutoById(autoId);

            Assert.AreEqual(mod.Id, result.Id);
            Assert.AreEqual(mod.Marke, result.Marke);
            Assert.AreEqual(mod.AutoKlasse, result.AutoKlasse);
            Assert.AreEqual(mod.Tagestarif, result.Tagestarif);
            Assert.AreEqual(mod.Basistarif, result.Basistarif);
        }
Esempio n. 3
0
        public void ReservationenTest()
        {
            TestEnvironmentHelper.InitializeTestData();
            var reservationen = Target.GetReservationen();

            Assert.IsNotNull(reservationen);
        }
Esempio n. 4
0
        public void GetReservationByIllegalNr()
        {
            TestEnvironmentHelper.InitializeTestData();
            var reservation = Target.GetReservation(-1);

            Assert.IsNull(reservation);
        }
        public void UpdateAutoTest()
        {
            TestEnvironmentHelper.InitializeTestData();

            Auto auto = new StandardAuto
            {
                Marke      = "Renault Clio",
                Tagestarif = 65
            };

            int autoId = Target.InsertAuto(auto);

            Assert.AreNotEqual(0, autoId);

            Auto org = Target.GetAutoById(autoId);
            Auto mod = Target.GetAutoById(autoId);

            mod.Marke = "Fiat 500";

            Target.UpdateAuto(mod, org);

            Auto result = Target.GetAutoById(autoId);

            Assert.AreEqual(mod.GetType(), result.GetType());
            Assert.AreEqual(mod.Id, result.Id);
            Assert.AreEqual(mod.Marke, result.Marke);
            Assert.AreEqual(mod.Tagestarif, result.Tagestarif);
        }
        public void UpdateKundeTest()
        {
            TestEnvironmentHelper.InitializeTestData();

            Kunde kunde = new Kunde
            {
                Nachname     = "Wand",
                Vorname      = "Andi",
                Geburtsdatum = new DateTime(1955, 4, 12)
            };

            int kundeId = Target.InsertKunde(kunde);

            Assert.AreNotEqual(0, kundeId);

            Kunde org = Target.GetKundeById(kundeId);
            Kunde mod = Target.GetKundeById(kundeId);

            mod.Nachname = "Stein";
            mod.Vorname  = "Sean";

            Target.UpdateKunde(mod, org);

            Kunde result = Target.GetKundeById(kundeId);

            Assert.AreEqual(mod.Id, result.Id);
            Assert.AreEqual(mod.Nachname, result.Nachname);
            Assert.AreEqual(mod.Vorname, result.Vorname);
            Assert.AreEqual(mod.Geburtsdatum, result.Geburtsdatum);
        }
Esempio n. 7
0
        public void KundenTest()
        {
            TestEnvironmentHelper.InitializeTestData();
            var kunden = Target.GetKunden();

            Assert.IsNotNull(kunden);
        }
Esempio n. 8
0
        public void AutosTest()
        {
            TestEnvironmentHelper.InitializeTestData();
            var autos = Target.GetAutos();

            Assert.IsNotNull(autos);
        }
Esempio n. 9
0
        public void GetAutosTest()
        {
            TestEnvironmentHelper.InitializeTestData();
            var component = new AutoReservationBusinessComponent();
            var list      = component.GetAutos();

            Assert.AreEqual(3, list.Count);
        }
        public void ReservationenTest()
        {
            TestEnvironmentHelper.InitializeTestData();

            IList <ReservationDto> actual = Target.Reservationen;

            Assert.AreEqual(1, actual.Count);
        }
        public void AutosTest()
        {
            TestEnvironmentHelper.InitializeTestData();

            IList <AutoDto> actual = Target.Autos;

            Assert.AreEqual(3, actual.Count);
        }
Esempio n. 12
0
        public void GetKundeByIdTest()
        {
            TestEnvironmentHelper.InitializeTestData();
            var kundenId = Target.GetKunden()[0].Id;
            var kunde    = Target.getKunde(kundenId);

            Assert.AreEqual(kundenId, kunde.Id);
        }
Esempio n. 13
0
        public void DeleteAutoTest()
        {
            TestEnvironmentHelper.InitializeTestData();
            var auto = Target.GetAutos()[0];

            Target.DeleteAuto(auto);
            Assert.IsFalse(Target.GetAutos().Contains(auto));
        }
Esempio n. 14
0
        public void DeleteReservationTest()
        {
            TestEnvironmentHelper.InitializeTestData();
            var reservation = Target.GetReservationen()[0];

            Target.DeleteReservation(reservation);
            Assert.IsFalse(Target.GetReservationen().Contains(reservation));
        }
        public void KundenTest()
        {
            TestEnvironmentHelper.InitializeTestData();

            IList <KundeDto> actual = Target.Kunden;

            Assert.AreEqual(4, actual.Count);
        }
Esempio n. 16
0
        public void DeleteKundeTest()
        {
            TestEnvironmentHelper.InitializeTestData();
            var kunde = Target.GetKunden()[0];

            Target.DeleteKunde(kunde);
            Assert.IsFalse(Target.GetKunden().Contains(kunde));
        }
        public void GetReservationByIllegalNr()
        {
            TestEnvironmentHelper.InitializeTestData();

            ReservationDto actual = Target.GetReservationByNr(-1);

            Assert.IsNull(actual);
        }
Esempio n. 18
0
        public void GetReservationByNrTest()
        {
            TestEnvironmentHelper.InitializeTestData();
            var reservationsNr = Target.GetReservationen()[0].ReservationNr;
            var reservation    = Target.GetReservation(reservationsNr);

            Assert.AreEqual(reservationsNr, reservation.ReservationNr);
        }
Esempio n. 19
0
        public void GetAutoByIdTest()
        {
            TestEnvironmentHelper.InitializeTestData();
            var autoId = Target.GetAutos()[0].Id;
            var auto   = Target.GetAuto(autoId);

            Assert.AreEqual(autoId, auto.Id);
        }
Esempio n. 20
0
        public void GetAutoTest()
        {
            TestEnvironmentHelper.InitializeTestData();
            var component = new AutoReservationBusinessComponent();
            var id        = component.GetAutos()[0].Id;
            var auto      = component.GetAuto(id);

            Assert.IsNotNull(auto);
        }
Esempio n. 21
0
        public void UpdateKundeTest()
        {
            TestEnvironmentHelper.InitializeTestData();
            var original = Target.GetKunden()[0];
            var modified = (KundeDto)original.Clone();

            Target.UpdateKunde(modified, original);
            Assert.AreEqual(modified, Target.GetKunden()[0]);
        }
Esempio n. 22
0
        public void UpdateReservationTest()
        {
            TestEnvironmentHelper.InitializeTestData();
            var original = Target.GetReservationen()[0];
            var modified = (ReservationDto)original.Clone();

            Target.UpdateReservation(modified, original);
            Assert.AreEqual(modified, Target.GetReservationen()[0]);
        }
Esempio n. 23
0
        public void DeleteAutoTest()
        {
            TestEnvironmentHelper.InitializeTestData();
            var component = new AutoReservationBusinessComponent();
            var auto      = component.GetAutos()[0];

            component.DeleteAuto(auto);
            Assert.IsFalse(component.GetAutos().Contains(auto));
        }
Esempio n. 24
0
        public void UpdateAutoTest()
        {
            TestEnvironmentHelper.InitializeTestData();
            var original = Target.GetAutos()[0];
            var modified = (AutoDto)original.Clone();

            modified.Marke = "Test Marke";
            Target.UpdateAuto(modified, original);
            Assert.AreEqual(modified, Target.GetAutos()[0]);
        }
Esempio n. 25
0
        public void UpdateAutoTest()
        {
            TestEnvironmentHelper.InitializeTestData();
            var component = new AutoReservationBusinessComponent();
            var oldAuto   = component.GetAutos()[0];
            var newAuto   = (Auto)oldAuto.Copy();

            newAuto.Marke = "Test Marke";
            Assert.AreNotEqual(newAuto, component.GetAutos()[0]);
            component.UpdateAuto(newAuto, oldAuto);
            Assert.AreEqual(newAuto, component.GetAutos()[0]);
        }
        public void DeleteKundeTest()
        {
            TestEnvironmentHelper.InitializeTestData();

            KundeDto actual = Target.Kunden[0];

            Target.DeleteKunde(actual);

            KundeDto result = Target.GetKundeById(actual.Id);

            Assert.IsNull(result);
        }
        public void DeleteAutoTest()
        {
            TestEnvironmentHelper.InitializeTestData();

            AutoDto actual = Target.Autos[0];

            Target.DeleteAuto(actual);

            AutoDto result = Target.GetAutoById(actual.Id);

            Assert.IsNull(result);
        }
Esempio n. 28
0
        public void InsertAutoTest()
        {
            TestEnvironmentHelper.InitializeTestData();
            var auto = new AutoDto {
                Marke = "Test Marke", AutoKlasse = AutoKlasse.Mittelklasse, Tagestarif = 13, Id = Target.GetAutos()[Target.GetAutos().Count - 1].Id + 1
            };

            Target.CreateAuto(auto);
            var autoResult = Target.GetAutos()[Target.GetAutos().Count - 1];

            Assert.AreEqual(auto, autoResult);
        }
        public void DeleteReservationTest()
        {
            TestEnvironmentHelper.InitializeTestData();

            ReservationDto actual = Target.Reservationen[0];

            Target.DeleteReservation(actual);

            ReservationDto result = Target.GetReservationByNr(actual.ReservationNr);

            Assert.IsNull(result);
        }
Esempio n. 30
0
        public void UpdateKundeTest()
        {
            TestEnvironmentHelper.InitializeTestData();
            var component = new AutoReservationBusinessComponent();
            var oldKunde  = component.GetKunden()[0];
            var newKunde  = (Kunde)oldKunde.Copy();

            newKunde.Vorname = "Peter";
            Assert.AreNotEqual(newKunde, component.GetKunden()[0]);
            component.UpdateKunde(newKunde, oldKunde);
            Assert.AreEqual(newKunde, component.GetKunden()[0]);
        }