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();
        }
Пример #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();
        }
Пример #5
0
        }                    //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);
     }
 }
Пример #7
0
 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);
 }
Пример #8
0
 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);
 }
Пример #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);
        }
Пример #11
0
        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);
        }
Пример #12
0
 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);
        }
Пример #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);
        }
Пример #15
0
 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);
        }
Пример #18
0
 public void modifyCar(AutoReservation.Common.DataTransferObjects.AutoDto autoDto)
 {
     base.Channel.modifyCar(autoDto);
 }
Пример #19
0
 public System.Threading.Tasks.Task <bool> isCarAvailableAsync(AutoReservation.Common.DataTransferObjects.ReservationDto reservation, AutoReservation.Common.DataTransferObjects.AutoDto auto)
 {
     return(base.Channel.isCarAvailableAsync(reservation, auto));
 }
Пример #20
0
 public bool isCarAvailable(AutoReservation.Common.DataTransferObjects.ReservationDto reservation, AutoReservation.Common.DataTransferObjects.AutoDto auto)
 {
     return(base.Channel.isCarAvailable(reservation, auto));
 }
Пример #21
0
        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.");
            }
        }
Пример #22
0
 public void UpdateAuto(AutoDto original, AutoDto modified )
 {
     WriteActualMethod();
     component.UpdateAuto(original.ConvertToEntity(), modified.ConvertToEntity());
 }
Пример #23
0
 public void DeleteAuto(AutoDto selectedAuto)
 {
     WriteActualMethod();
     BusinessComponent.DeleteAuto(selectedAuto.ConvertToEntity());
 }
Пример #24
0
 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());
     }
 }
Пример #26
0
        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);
 }
Пример #30
0
 public void removeCar(AutoReservation.Common.DataTransferObjects.AutoDto autoDto)
 {
     base.Channel.removeCar(autoDto);
 }
Пример #31
0
 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);
        }
Пример #33
0
 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);
     }
 }
Пример #37
0
 protected override void Load()
 {
     Autos.Clear();
     autosOriginal.Clear();
     foreach (var auto in Service.GetAutos())
     {
         Autos.Add(auto);
         autosOriginal.Add(auto.Clone());
     }
     SelectedAuto = Autos.FirstOrDefault();
 }
Пример #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);
 }