Esempio n. 1
0
 public async Task ReadNotExistingChapterAsync()
 {
     Console.WriteLine(nameof(ReadNotExistingChapterAsync));
     string requestedIdentifier = Guid.NewGuid().ToString();
     try
     {
         BookChapter chapter = await _client.GetAsync(
           _urlService.BooksApi + requestedIdentifier.ToString());
         Console.WriteLine($"{chapter.Number} {chapter.Title}");
     }
     catch (HttpRequestException ex) when (ex.Message.Contains("404"))
     {
         Console.WriteLine($"book chapter with the identifier " +
           $"{requestedIdentifier} not found");
     }
     Console.WriteLine();
 }