예제 #1
0
        public async Task UpdateKundeTest()
        {
            var kunde = await _target.GetKundeById(1);

            kunde.Vorname = "Elfriede";
            await _target.UpdateKunde(kunde);

            var result = await _target.GetKundeById(1);

            Assert.Equal("Elfriede", result.Vorname);
        }
예제 #2
0
        public void UpdateKundeTest()
        {
            Kunde someDude = KundeManager.GetKundeById(1);

            someDude.Nachname = "DUDE!";
            KundeManager.UpdateKunde(someDude);

            someDude = KundeManager.GetKundeById(1);
            Assert.Equal("DUDE!", someDude.Nachname);
        }
        public void AddReservationTest()
        {
            KundeManager km          = new KundeManager();
            AutoManager  am          = new AutoManager();
            Kunde        k1          = km.GetKundeById(1);
            Auto         a1          = am.GetAutoById(1);
            Reservation  reservation = new Reservation {
                KundeId = k1.Id, AutoId = a1.Id, Von = new DateTime(2018, 12, 24), Bis = new DateTime(2018, 12, 27)
            };

            Target.AddReservation(reservation);
            Assert.Equal(5, Target.GetReservations().Count);
        }
예제 #4
0
        public void InsertAndDeleteKundeTest()
        {
            Kunde someDude = new Kunde
            {
                Nachname     = "DUDE!",
                Vorname      = "Bla",
                Geburtsdatum = DateTime.Today
            };

            Kunde neu = KundeManager.InsertKunde(someDude);

            Kunde sameDude = KundeManager.GetKundeById(neu.Id);

            Assert.Equal("DUDE!", someDude.Nachname);
            Assert.Equal("DUDE!", sameDude.Nachname);

            KundeManager.DeleteKunde(neu);
        }
예제 #5
0
        public KundeDto ReadKundeDto(int kundeId)
        {
            WriteActualMethod();

            try
            {
                return(DtoConverter.ConvertToDto(_kundenManager.GetKundeById(kundeId)));
            }

            catch (InvalidOperationException)
            {
                OutOfRangeFault fault = new OutOfRangeFault()
                {
                    Operation = "Read"
                };

                throw new FaultException <OutOfRangeFault>(fault);
            }
        }
예제 #6
0
        public override async Task <KundeDto> GetKundeById(GetKundeRequest request, ServerCallContext context)
        {
            KundeDto response = await kundeManager.GetKundeById(request.Id).ConvertToDto();

            return(response ?? throw new RpcException(new Status(StatusCode.NotFound, "ID is invalid.")));
        }
 public KundeDto GetKundeDtoById(int Id)
 {
     WriteActualMethod();
     return(KundeManager.GetKundeById(Id).ConvertToDto());
 }