public async Task UpdateAutoTest() { var auto = await _target.GetAutoById(3); auto.Marke = "Lada"; await _target.ModifyAuto(auto); var result = await _target.GetAutoById(3); Assert.Equal("Lada", result.Marke); }
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); }
public void UpdateAutoTest() { Auto myCar = AutoManager.GetAutoById(1); myCar.Marke = "Marke"; myCar.Tagestarif = 20; AutoManager.UpdateAuto(myCar); Auto sameCar = AutoManager.GetAutoById(1); Assert.Equal("Marke", myCar.Marke); Assert.Equal("Marke", sameCar.Marke); Assert.Equal(20, myCar.Tagestarif); Assert.Equal(20, sameCar.Tagestarif); }
public void InsertAndDeleteAutoTest() { Auto someCar = new LuxusklasseAuto { Marke = "DUDE!", Tagestarif = 10, Basistarif = 20 }; Auto neu = AutoManager.InsertAuto(someCar); Auto sameCar = AutoManager.GetAutoById(neu.Id); Assert.Equal("DUDE!", someCar.Marke); Assert.Equal("DUDE!", sameCar.Marke); AutoManager.DeleteAuto(neu); }
public AutoDto ReadAutoDto(int autoId) { WriteActualMethod(); try { return(DtoConverter.ConvertToDto(_autoManager.GetAutoById(autoId))); } catch (InvalidOperationException) { OutOfRangeFault fault = new OutOfRangeFault() { Operation = "Read" }; throw new FaultException <OutOfRangeFault>(fault); } }
public AutoDto GetAutoDtoById(int Id) { WriteActualMethod(); return(AutoManager.GetAutoById(Id).ConvertToDto()); }
public override async Task <AutoDto> GetAutoById(GetAutoRequest request, ServerCallContext context) { AutoDto response = await autoManager.GetAutoById(request.Id).ConvertToDto(); return(response ?? throw new RpcException(new Status(StatusCode.NotFound, "ID is invalid."))); }