public async Task UpdateAutoTest()
        {
            Auto car = await _target.Get(1);

            car.Tagestarif = 60;

            await _target.Update(car);

            car = await _target.Get(1);

            Xunit.Assert.Equal(60, car.Tagestarif);
        }
        public async Task UpdateAutoTest()
        {
            // arrange
            Auto auto = await _target.Get(2);

            auto.Marke      = "VW Polo";
            auto.Tagestarif = 135;

            // act
            await _target.Update(auto);

            // assert
            auto = await _target.Get(2);

            Assert.True(auto is MittelklasseAuto);
            Assert.Equal(2, auto.Id);
            Assert.Equal("VW Polo", auto.Marke);
            Assert.Equal(135, auto.Tagestarif);
        }
Esempio n. 3
0
        public override async Task <AutoDto> Get(AutoRequest request, ServerCallContext context)
        {
            AutoManager manager = new AutoManager();
            Auto        car     = await manager.Get(request.Id);

            if (car == null)
            {
                throw new RpcException(new Status(
                                           StatusCode.OutOfRange, "Id couldn't be found."
                                           ));
            }
            return(car.ConvertToDto());
        }
Esempio n. 4
0
        public override async Task <AutoDto> Get(AutoRequest request, ServerCallContext context)
        {
            Auto result = await CarManager.Get(request.Id);

            if (result == null)
            {
                throw new RpcException(
                          new Status(StatusCode.OutOfRange,
                                     "Car not found"
                                     ));
            }
            return(result.ConvertToDto());
        }
 public AutoDto GetAuto(int id)
 {
     WriteActualMethod();
     return(_autoManager.Get(id).ConvertToDto());
 }