Inspired by dotnet show (#386)

* Changed the order of the projects, Web first to infer as startup.

* Added encapsulated JSON serialization - and moved to System.Text.Json

* Refactored a few minor updates out

Co-authored-by: Eric Fleming <eric-fleming18@hotmail.com>
This commit is contained in:
David Pine
2020-06-11 14:47:05 -05:00
committed by GitHub
parent 70a919e145
commit 0af21d22f5
8 changed files with 105 additions and 13 deletions

View File

@@ -25,7 +25,7 @@ namespace Microsoft.eShopWeb.FunctionalTests.Web.Controllers
var response = await Client.GetAsync("/api/catalog/list");
response.EnsureSuccessStatusCode();
var stringResponse = await response.Content.ReadAsStringAsync();
var model = JsonSerializer.Deserialize<CatalogIndexViewModel>(stringResponse, _jsonOptions);
var model = stringResponse.FromJson<CatalogIndexViewModel>();
Assert.Equal(10, model.CatalogItems.Count());
}
@@ -36,7 +36,7 @@ namespace Microsoft.eShopWeb.FunctionalTests.Web.Controllers
var response = await Client.GetAsync("/api/catalog/list?page=1");
response.EnsureSuccessStatusCode();
var stringResponse = await response.Content.ReadAsStringAsync();
var model = JsonSerializer.Deserialize<CatalogIndexViewModel>(stringResponse, _jsonOptions);
var model = stringResponse.FromJson<CatalogIndexViewModel>();
Assert.Equal(2, model.CatalogItems.Count());
}