private async Task <CarApiResponse> AddCar(AddCarRequest car)
        {
            var result = await CarsApiClient.AddCar(car);

            var responseString = await result.Content.ReadAsStringAsync();

            return(JsonConvert.DeserializeObject <CarApiResponse>(responseString));
        }
예제 #2
0
        protected override async Task ArrangeAsync()
        {
            await base.ArrangeAsync();

            var carToAdd = Fixture.Create <AddCarRequest>();

            carToAdd.Year = new Random().Next(1908, DateTime.Now.Year);

            var result = await CarsApiClient.AddCar(carToAdd);

            var responseString = await result.Content.ReadAsStringAsync();

            dynamic response =
                JsonConvert.DeserializeObject <ExpandoObject>(responseString, new ExpandoObjectConverter());

            _carToUpdate      = Fixture.Create <UpdateCarRequest>();
            _carToUpdate.Year = new Random().Next(1908, DateTime.Now.Year);

            _carIdToUpdate = (int)response.id;
        }
        protected override async Task ActAsync()
        {
            await base.ActAsync();

            _carAddedResult = await CarsApiClient.AddCar(_carToAdd);
        }