public AutoDto InsertAuto(AutoDto autoDto)
        {
            WriteActualMethod();
            Auto auto = DtoConverter.ConvertToEntity(autoDto);

            return DtoConverter.ConvertToDto(autoReservationBusinessComponent.InsertAuto(auto));
        }
        public AutoDto InsertAuto(AutoDto autoDto)
        {
            WriteActualMethod();

            Auto auto = autoDto.ConvertToEntity();

            return autoReservationBusinessComponent.Insert(auto).ConvertToDto();
        }
Exemple #3
0
 public ReservationDto(int id, AutoDto auto, KundeDto kunde, DateTime von, DateTime bis)
 {
     ReservationsNr = id;
     Auto           = auto;
     Kunde          = kunde;
     Von            = von;
     Bis            = bis;
 }
        public AutoDto UpdateAuto(AutoDto modified, AutoDto original)
        {
            WriteActualMethod();

            Auto modAuto = modified.ConvertToEntity();
            Auto origAuto = original.ConvertToEntity();

            return autoReservationBusinessComponent.Update(modAuto, origAuto).ConvertToDto();
        }
        }                    //default ctor for property injection

        public AutoDto(AutoDto car)
        {
            BaseRate   = car.BaseRate;
            Id         = car.Id;
            Brand      = car.Brand;
            DailyRate  = car.DailyRate;
            AutoClass  = car.AutoClass;
            RowVersion = car.RowVersion;
        }
 public AutoDto UpdateAuto(AutoDto modifiedDto, AutoDto originalDto)
 {
     WriteActualMethod();
     Auto modified = DtoConverter.ConvertToEntity(modifiedDto);
     Auto original = DtoConverter.ConvertToEntity(originalDto);
     try
     {
         return DtoConverter.ConvertToDto(autoReservationBusinessComponent.UpdateAuto(modified, original));
     }
     catch (LocalOptimisticConcurrencyException<Auto> e)
     {
         throw new FaultException<AutoDto>(modifiedDto);
     }
 }
 public void Test_DeleteAuto()
 {
     var countOld = Target.Autos().Count;
     var auto = new AutoDto();
     auto.Marke = "Yolo";
     auto.Tagestarif = 5;
     auto.Basistarif = 10;
     auto.AutoKlasse = AutoKlasse.Luxusklasse;
     Target.InsertAuto(auto);
     var newAuto = Target.Autos()[countOld];
     countOld = Target.Autos().Count;
     Target.DeleteAuto(newAuto);
     var countNew = Target.Autos().Count;
     Assert.AreEqual(countNew, countOld - 1);
 }
 public void Test_DeleteAuto()
 {
     AutoDto myAuto = new AutoDto
     {
         Id = 1,
         Marke = "Fiat Punto",
         Tagestarif = 50,
         Basistarif = 0,
         AutoKlasse = AutoKlasse.Standard
     };
     int before = Target.Autos.Count();
     Target.DeleteAuto(myAuto);
     int after = Target.Autos.Count();
     Assert.AreNotEqual(before, after);
 }
Exemple #9
0
        public override bool Equals(object obj)
        {
            // If parameter is null return false.
            if (obj == null)
            {
                return(false);
            }

            // If parameter cannot be cast to AutoDto return false.
            AutoDto other = obj as AutoDto;

            if ((System.Object)other == null)
            {
                return(false);
            }

            return(this.Id == other.Id &&
                   this.Marke == other.Marke &&
                   this.AutoKlasse == other.AutoKlasse &&
                   this.Basistarif == other.Basistarif &&
                   this.Tagestarif == other.Tagestarif);
        }
        public void GetAutoByIdTest()
        {
            TestEnvironmentHelper.InitializeTestData();
            AutoReservationBusinessComponent target = new AutoReservationBusinessComponent();

            AutoDto auto = new AutoDto
            {
                Marke = "Opel Astra",
                AutoKlasse = AutoKlasse.Standard,
                Tagestarif = 45
            };

            int autoId = target.InsertAuto(auto);
            Assert.AreNotEqual(0, autoId);

            AutoDto actual = target.GetAutoById(autoId);

            Assert.IsNotNull(actual);
            Assert.AreEqual(autoId, actual.Id);
            Assert.AreEqual(auto.Marke, actual.Marke);
            Assert.AreEqual(auto.AutoKlasse, actual.AutoKlasse);
            Assert.AreEqual(auto.Tagestarif, actual.Tagestarif);
            Assert.AreEqual(auto.Basistarif, actual.Basistarif);
        }
        public void Test_InsertAuto()
        {
            AutoDto newAuto = new AutoDto
            {
                AutoKlasse = AutoKlasse.Standard,
                Marke = "Skoda",
                Tagestarif = 70
            };

            int countBefore = Target.Autos.Count();
            Target.InsertAuto(newAuto);
            int countAfter = Target.Autos.Count();

            Assert.AreEqual(countBefore + 1, countAfter);
        }
 public System.Threading.Tasks.Task removeCarAsync(AutoReservation.Common.DataTransferObjects.AutoDto autoDto)
 {
     return(base.Channel.removeCarAsync(autoDto));
 }
        public void InsertAutoTest()
        {
            TestEnvironmentHelper.InitializeTestData();
            AutoReservationBusinessComponent target = new AutoReservationBusinessComponent();

            AutoDto auto = new AutoDto
            {
                Marke = "Seat Ibiza",
                AutoKlasse = AutoKlasse.Standard,
                Tagestarif = 40
            };

            int autoId = target.InsertAuto(auto);
            Assert.AreNotEqual(0, autoId);

            AutoDto result = target.GetAutoById(autoId);
            Assert.AreEqual(autoId, result.Id);
            Assert.AreEqual(auto.Marke, result.Marke);
            Assert.AreEqual(auto.AutoKlasse, result.AutoKlasse);
            Assert.AreEqual(auto.Tagestarif, result.Tagestarif);
            Assert.AreEqual(auto.Basistarif, result.Basistarif);
        }
Exemple #14
0
        public void Test_InsertAuto()
        {
            int newid = Target.Autos().Count + 1;
            AutoDto auto = new AutoDto();
            auto.Marke = "VW Golf";
            auto.Tagestarif = 9000;
            auto.Basistarif = 300;
            auto.AutoKlasse = AutoKlasse.Luxusklasse;
            Target.InsertAuto(auto);

            AutoDto inserted = Target.GetAuto(newid);

            Assert.AreEqual("VW Golf", inserted.Marke);
            Assert.AreEqual(9000, inserted.Tagestarif);
            Assert.AreEqual(300, inserted.Basistarif);
            Assert.AreEqual(AutoKlasse.Luxusklasse, inserted.AutoKlasse);
        }
 public void InsertAuto(AutoDto auto)
 {
     WriteActualMethod();
     BusinessComponent.InsertAuto(auto.ConvertToEntity());
 }
 public void UpdateAuto(AutoDto originalDto, AutoDto modifiedDto )
 {
     try
     {
         WriteActualMethod();
         busService.UpdateAuto(DtoConverter.ConvertToEntity(modifiedDto), DtoConverter.ConvertToEntity(originalDto));
     }
     catch (LocalOptimisticConcurrencyException<Auto> ex)
     {
         throw new FaultException<AutoDto>(ex.MergedEntity.ConvertToDto(), ex.Message);
     }
 }
        public void Test_InsertAuto()
        {
            AutoDto newAuto = new AutoDto()
            {
                Basistarif = 5000, Marke = "Audi R8", Tagestarif = 500, AutoKlasse = AutoKlasse.Luxusklasse
            };
            AutoDto temp = Target.InsertAuto(newAuto);

            AutoDto auto = Target.FindAuto(temp.Id);
            Assert.AreEqual("Audi R8", auto.Marke);
            Assert.AreEqual(AutoKlasse.Luxusklasse, auto.AutoKlasse);
            Assert.AreEqual(500, auto.Tagestarif);
            Assert.AreEqual(5000, auto.Basistarif);
        }
 public void modifyCar(AutoReservation.Common.DataTransferObjects.AutoDto autoDto)
 {
     base.Channel.modifyCar(autoDto);
 }
 public System.Threading.Tasks.Task <bool> isCarAvailableAsync(AutoReservation.Common.DataTransferObjects.ReservationDto reservation, AutoReservation.Common.DataTransferObjects.AutoDto auto)
 {
     return(base.Channel.isCarAvailableAsync(reservation, auto));
 }
 public bool isCarAvailable(AutoReservation.Common.DataTransferObjects.ReservationDto reservation, AutoReservation.Common.DataTransferObjects.AutoDto auto)
 {
     return(base.Channel.isCarAvailable(reservation, auto));
 }
        public void UpdateAuto(AutoDto auto, AutoDto original)
        {
            WriteActualMethod();
            Auto autoEntity = auto.ConvertToEntity();
            Auto originalEntity = original.ConvertToEntity();

            try
            {
                BusinessComponent.UpdateAuto(autoEntity, originalEntity);
            }
            catch (LocalOptimisticConcurrencyException<Auto> ex)
            {
                Auto failed = ex.MergedEntity;
                throw new FaultException<AutoDto>(failed.ConvertToDto(), "Entity changed before update.");
            }
        }
 public void UpdateAuto(AutoDto original, AutoDto modified )
 {
     WriteActualMethod();
     component.UpdateAuto(original.ConvertToEntity(), modified.ConvertToEntity());
 }
 public void DeleteAuto(AutoDto selectedAuto)
 {
     WriteActualMethod();
     BusinessComponent.DeleteAuto(selectedAuto.ConvertToEntity());
 }
 public void InsertAuto(AutoDto auto)
 {
     WriteActualMethod();
     component.AddAuto(auto.ConvertToEntity());
 }
 public void UpdateAuto(AutoDto modified, AutoDto original)
 {
     WriteActualMethod();
     try
     {
         _businessComponent.UpdateAuto(modified.ConvertToEntity(), original.ConvertToEntity());
     }
     catch (LocalOptimisticConcurrencyException<Auto> e)
     {
         throw new FaultException<AutoDto>(e.MergedEntity.ConvertToDto());
     }
 }
        public void Test_InsertReservation()
        {
            KundeDto roman = new KundeDto
            {
                Vorname = "Roman",
                Nachname = "Blum",
                Geburtsdatum = new DateTime(1993, 1, 23)
            };
            AutoDto yourRide = new AutoDto
            {
                Marke = "Mercedes G65 AMG",
                AutoKlasse = AutoKlasse.Luxusklasse,
                Tagestarif = 300,
                Basistarif = 1000
            };
            Target.InsertKunde(roman);
            Target.InsertAuto(yourRide);

            ReservationDto reservation = new ReservationDto
            {
                Auto = Target.GetAutos().Last(),
                Kunde = Target.GetKunden().Last(),
                Von = DateTime.Now,
                Bis = new DateTime(2065, 1, 23)
            };
            Target.InsertReservation(reservation);

            ReservationDto inserted = Target.GetReservationen().Last();
            Assert.IsTrue(inserted.Kunde.Vorname == "Roman");
            Assert.IsTrue(inserted.Kunde.Nachname == "Blum");
            Assert.IsTrue(inserted.Auto.Marke == "Mercedes G65 AMG");
        }
        public void UpdateAutoTest()
        {
            TestEnvironmentHelper.InitializeTestData();
            AutoReservationBusinessComponent target = new AutoReservationBusinessComponent();

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

            int autoId = target.InsertAuto(auto);
            Assert.AreNotEqual(0, autoId);

            AutoDto org = target.GetAutoById(autoId);
            AutoDto mod = target.GetAutoById(autoId);

            mod.Marke = "Fiat 500";

            target.UpdateAuto(mod, org);

            AutoDto 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);
        }
 public void DeleteAuto(AutoDto auto)
 {
     WriteActualMethod();
     autoReservation.DeleteAuto(auto.ConvertToEntity());
 }
 public void InsertAutoTest()
 {
     TestEnvironmentHelper.InitializeTestData();
     AutoDto auto = new AutoDto();
     int count = Target.Autos().Count;
     int id = 99999;
     auto.Id = id;
     auto.Marke = "Marke";
     Target.InsertAuto(auto);
     Assert.AreEqual(count + 1, Target.Autos().Count);
 }
 public void removeCar(AutoReservation.Common.DataTransferObjects.AutoDto autoDto)
 {
     base.Channel.removeCar(autoDto);
 }
 public void DeleteAuto(AutoDto auto)
 {
     WriteActualMethod();
     component.DeleteAuto(auto.ConvertToEntity());
 }
        public void Test_InsertAuto()
        {
            AutoDto a = new AutoDto() { AutoKlasse = 0, Basistarif = 2, Id = 111, Marke = "BMW" };

            int n = Target.Autos().Count;
            Target.InsertAuto(a);

            Assert.IsTrue(n + 1 == Target.Autos().Count);
        }
 public void Test_InsertAuto()
 {
     AutoDto myRide = new AutoDto
     {
         Marke = "Mercedes S63 AMG",
         AutoKlasse = AutoKlasse.Luxusklasse,
         Tagestarif = 300,
         Basistarif = 1000
     };
     Assert.IsTrue(Target.GetAutos().Count() == 3);
     Target.InsertAuto(myRide);
     Assert.IsTrue(Target.GetAutos().Count() == 4);
 }
 public void AddAuto(AutoDto auto)
 {
     WriteActualMethod();
     _businessComponent.AddAuto(auto.ConvertToEntity());
 }
 public void UpdateAuto(AutoDto modifiedAuto, AutoDto originalAuto)
 {
     WriteActualMethod();
     autoReservation.UpdateAuto(modifiedAuto.ConvertToEntity(), originalAuto.ConvertToEntity());
 }
 public virtual void UpdateAuto(AutoDto original, AutoDto modified)
 {
     WriteActualMethod();
     try
     {
         _businessComponent.UpdateAuto(original.ConvertToEntity(), modified.ConvertToEntity());
     }
     catch (LocalOptimisticConcurrencyException<Auto> e)
     {
         var fault = new LocalOptimisticConcurrencyFault()
         {
             Message = e.Message
         };
         throw new FaultException<LocalOptimisticConcurrencyFault>(fault);
     }
 }
 protected override void Load()
 {
     Autos.Clear();
     autosOriginal.Clear();
     foreach (var auto in Service.GetAutos())
     {
         Autos.Add(auto);
         autosOriginal.Add(auto.Clone());
     }
     SelectedAuto = Autos.FirstOrDefault();
 }
Exemple #38
0
 public void InsertAutoTest()
 {
     List<AutoDto> autos = Target.GetAllAuto();
     AutoDto auto = new AutoDto();
     auto.Id = 4;
     auto.Marke = "Jeep";
     auto.AutoKlasse = 0;
     auto.Tagestarif = 150;
     auto.Basistarif = 50;
     Target.AddAuto(auto);
     Assert.AreEqual(Target.GetAllAuto().Count, autos.Count + 1);
 }