public void UpdateKundeOptimisticConcurrencyTest()
        {
            KundeManager kundeManager = new KundeManager();
            Kunde        kunde        = new Kunde {
                Id = 4, Nachname = "Später", Vorname = "Peter", Geburtsdatum = new DateTime(1976, 03, 27)
            };

            kundeManager.Update(kunde);
        }
 public void UpdateKundeTest()
 {
     Kunde kunde = target.FindKundeById(1);
     string nameBefore = kunde.Nachname;
     kunde.Nachname = "Chabis";
     target.Update(kunde);
     kunde = target.FindKundeById(1);
     Assert.AreNotEqual(nameBefore, kunde.Nachname);
 }
        public void UpdateKundeTest()
        {
            KundeManager kundeManager = new KundeManager();
            Kunde        kunde        = kundeManager.Kunde(2);

            kunde.Vorname  = "Sergej";
            kunde.Nachname = "Fährlich";
            Kunde updatedKunde = kundeManager.Update(kunde);

            Assert.AreEqual("Sergej", updatedKunde.Vorname);
            Assert.AreEqual("Fährlich", updatedKunde.Nachname);
            updatedKunde.Vorname  = "Herr";
            updatedKunde.Nachname = "Döpfel";
            Kunde updated2Kunde = kundeManager.Update(updatedKunde);

            Assert.AreEqual("Herr", updated2Kunde.Vorname);
            Assert.AreEqual("Döpfel", updated2Kunde.Nachname);
        }
        public async Task UpdateKundeTest()
        {
            var kunde = await _target.GetById(1);

            kunde.Vorname = "Wilma";
            await _target.Update(kunde);

            var result = await _target.GetById(1);

            Assert.Equal("Wilma", result.Vorname);
        }
Example #5
0
        public async Task UpdateKundeTest()
        {
            // arrange
            Kunde kunde = await _target.Get(1);

            kunde.Nachname     = "Tanner";
            kunde.Vorname      = "Julia";
            kunde.Geburtsdatum = new DateTime(1996, 10, 04);

            // act
            await _target.Update(kunde);

            // assert
            kunde = await _target.Get(1);

            Assert.Equal(1, kunde.Id);
            Assert.Equal("Tanner", kunde.Nachname);
            Assert.Equal("Julia", kunde.Vorname);
            Assert.Equal(new DateTime(1996, 10, 04), kunde.Geburtsdatum);
        }
Example #6
0
        public async Task UpdateKundeTest()
        {
            Kunde customer = await _target.Get(1);

            customer.Vorname = "Hansruedi";

            await _target.Update(customer);

            customer = await _target.Get(1);

            Xunit.Assert.Equal("Hansruedi", customer.Vorname);
        }
 public void UpdateKunde(KundeDto kunde)
 {
     try
     {
         KundeManager.Update(kunde.ConvertToEntity());
     }
     catch (DbUpdateConcurrencyException)
     {
         var fault = new GenericFault("Update Concurrency Exception");
         throw new FaultException <GenericFault>(fault);
     }
 }
 public void UpdateKunde(KundeDto kundeToBeUpdated)
 {
     WriteActualMethod();
     try { kundeManager.Update(kundeToBeUpdated.ConvertToEntity()); }
     catch (OptimisticConcurrencyException <Kunde> )
     {
         OptimisticConcurrencyFault ocf = new OptimisticConcurrencyFault
         {
             Operation   = "Update",
             ProblemType = "Optimstic Cocurrency Error during updating on Kunde!"
         };
         throw new FaultException <OptimisticConcurrencyFault>(ocf);
     }
 }
Example #9
0
        public override async Task <KundeDto> Update(KundeDto request, ServerCallContext context)
        {
            try
            {
                KundeManager manager = new KundeManager();
                Kunde        kunde   = await manager.Update(request.ConvertToEntity());

                KundeDto result = kunde.ConvertToDto();
                return(result);
            }
            catch (OptimisticConcurrencyException <Auto> e)
            {
                throw new RpcException(new Status(StatusCode.Aborted, e.Message));
            }
        }
 public override async Task <Empty> Update(KundeDto request, ServerCallContext context)
 {
     try
     {
         await ClientManager.Update(request.ConvertToEntity());
     }
     catch (OptimisticConcurrencyException <Kunde> exception)
     {
         throw new RpcException(
                   new Status(StatusCode.Aborted, "Concurrency Exception."),
                   exception.ToString()
                   );
     }
     return(new Empty());
 }
Example #11
0
        public void UpdateKunde(KundeDto kunde)
        {
            WriteActualMethod();
            var kundeEntity = DtoConverter.ConvertToEntity(kunde);

            try
            {
                kundeManager.Update(kundeEntity);
            }
            catch (OptimisticConcurrencyException <Kunde> )
            {
                throw new FaultException <DataManipulationFault>(new DataManipulationFault {
                    Message = "Der Kunde wird momentan bearbeitet."
                });
            }
        }
 public void UpdateKunde(KundeDto kunde)
 {
     WriteActualMethod();
     try
     {
         _kundeManager.Update(kunde.ConvertToEntity());
     }
     catch (OptimisticConcurrencyException <Kunde> e)
     {
         throw new FaultException <OptimisticConcurrencyFault <KundeDto> >(
                   new OptimisticConcurrencyFault <KundeDto>()
                   )
               {
               };
     }
 }
        public void UpdateKunde(KundeDto kunde)
        {
            WriteActualMethod();
            IAutoReservationResultCallback cb = _createCallbackChannel();

            try
            {
                cb.SendKunde(kundeManager.Update(kunde.ConvertToEntity()).ConvertToDto());
            }
            catch (Exception ex)
            {
                cb.SendFault(new CommunicationFault {
                    Exception = ex.Message
                });
            }
        }
        public void UpdateKunde(KundeDto customer)
        {
            WriteActualMethod();

            try
            {
                _kundeManager.Update(customer.ConvertToEntity());
            }
            catch (OptimisticConcurrencyException <Kunde> ex)
            {
                throw new FaultException <AutoReservationFault>(new AutoReservationFault
                {
                    ErrorCode    = AutoReservationFault.DataHasBeenModifiedInMeantime,
                    ErrorMessage = $"Database Entity-State: {ex.MergedEntity.ConvertToDto()}"
                });
            }
        }
Example #15
0
        public override async Task <Empty> Update(KundeDto request, ServerCallContext context)
        {
            KundeManager manager = new KundeManager();
            Kunde        kunde   = request.ConvertToEntity();

            try
            {
                await manager.Update(kunde);
            }
            catch (OptimisticConcurrencyException <Kunde> exception) //TODO error handling evtl. noch nicht korrekt
            {
                throw new RpcException(new Status(
                                           StatusCode.Aborted,
                                           "Conccurency Exception."
                                           ), exception.ToString());
            }
            return(new Empty());
        }