public async Task UpdateKundeTest()
        {
            // arrange
            String nachName   = "Test Nachname";
            int    primaryKey = 1;
            Kunde  kunde      = _target.GetByPrimaryKey(primaryKey).Result;

            // act
            kunde.Nachname = nachName;
            await _target.UpdateEntity(kunde);

            // assert
            Kunde changedKunde = _target.GetByPrimaryKey(primaryKey).Result;

            Assert.True(changedKunde.Nachname == nachName);
        }
Exemplo n.º 2
0
        public override async Task <Empty> UpdateKunde(KundeDto request, ServerCallContext context)
        {
            try
            {
                var entity = request.ConvertToEntity();
                await _manager.UpdateEntity(entity);

                return(new Empty());
            }
            catch (Exception e)
            {
                if (e is OptimisticConcurrencyException <Kunde> specificException)
                {
                    throw new RpcException(new Status(StatusCode.Aborted, e.Message), specificException.MergedEntity.ToString());
                }
                throw new RpcException(new Status(StatusCode.Internal, "Internal error occured."));
            }
        }