Exemplo n.º 1
0
        private async Task TestClient8(HttpClientGen8 httpClientGen8, string title, string author)
        {
            var postResponse = await httpClientGen8.PostAsync <BookPostRequest, BookResponse>(
                new Uri("/api/books", UriKind.Relative),
                new BookPostRequest
            {
                Title  = title,
                Author = author
            });

            await httpClientGen8.PutAsync(
                new Uri($"/api/books/{postResponse.Id}", UriKind.Relative),
                new BookPutRequest
            {
                Id     = postResponse.Id,
                Title  = $"{title} - updated",
                Author = $"{author} - updated"
            });

            var getResponse = await httpClientGen8.GetAsync <BookResponse>(new Uri($"/api/books/{postResponse.Id}", UriKind.Relative));

            var getListResponse = await httpClientGen8.GetAsync <IEnumerable <BookResponse> >(new Uri("/api/books", UriKind.Relative));

            var deleteResponse = await httpClientGen8.DeleteAsync <BookResponse>(new Uri($"/api/books/{postResponse.Id}", UriKind.Relative));
        }
Exemplo n.º 2
0
 public Startup(
     HttpClientGen1 httpClientGen1, HttpClientGen2 httpClientGen2, HttpClientGen3 httpClientGen3, HttpClientGen4 httpClientGen4,
     HttpClientGen5 httpClientGen5, HttpClientGen6 httpClientGen6, HttpClientGen7 httpClientGen7, HttpClientGen8 httpClientGen8)
 {
     _httpClientGen1 = httpClientGen1;
     _httpClientGen2 = httpClientGen2;
     _httpClientGen3 = httpClientGen3;
     _httpClientGen4 = httpClientGen4;
     _httpClientGen5 = httpClientGen5;
     _httpClientGen6 = httpClientGen6;
     _httpClientGen7 = httpClientGen7;
     _httpClientGen8 = httpClientGen8;
 }