Fix tests compilation errors

This commit is contained in:
Miguel Veloso 2019-11-18 18:32:54 +00:00
parent 8734958e5e
commit 4b48468d6a
4 changed files with 7 additions and 7 deletions

View File

@ -33,7 +33,7 @@ namespace FunctionalTests.Services.Catalog
testServer.Host testServer.Host
.MigrateDbContext<CatalogContext>((context, services) => .MigrateDbContext<CatalogContext>((context, services) =>
{ {
var env = services.GetService<IHostingEnvironment>(); var env = services.GetService<IWebHostEnvironment>();
var settings = services.GetService<IOptions<CatalogSettings>>(); var settings = services.GetService<IOptions<CatalogSettings>>();
var logger = services.GetService<ILogger<CatalogContextSeed>>(); var logger = services.GetService<ILogger<CatalogContextSeed>>();

View File

@ -56,7 +56,7 @@ namespace FunctionalTests.Services
else else
{ {
//THEN the product price changes in the catalog //THEN the product price changes in the catalog
Assert.Equal(newPrice, modifiedCatalogProducts.Data.Single(it => it.Id == int.Parse(itemToModify.ProductId)).Price); Assert.Equal(newPrice, modifiedCatalogProducts.Data.Single(it => it.Id == itemToModify.ProductId).Price);
// AND the products in the basket reflects the changed priced and the original price // AND the products in the basket reflects the changed priced and the original price
Assert.Equal(newPrice, itemUpdated.UnitPrice); Assert.Equal(newPrice, itemUpdated.UnitPrice);
@ -65,7 +65,7 @@ namespace FunctionalTests.Services
} }
} }
private async Task<BasketItem> GetUpdatedBasketItem(decimal newPrice, string productId, string userId, HttpClient basketClient) private async Task<BasketItem> GetUpdatedBasketItem(decimal newPrice, int productId, string userId, HttpClient basketClient)
{ {
bool continueLoop = true; bool continueLoop = true;
var counter = 0; var counter = 0;
@ -102,7 +102,7 @@ namespace FunctionalTests.Services
private string ChangePrice(BasketItem itemToModify, decimal newPrice, PaginatedItemsViewModel<CatalogItem> catalogProducts) private string ChangePrice(BasketItem itemToModify, decimal newPrice, PaginatedItemsViewModel<CatalogItem> catalogProducts)
{ {
var catalogProduct = catalogProducts.Data.Single(pr => pr.Id == int.Parse(itemToModify.ProductId)); var catalogProduct = catalogProducts.Data.Single(pr => pr.Id == itemToModify.ProductId);
catalogProduct.Price = newPrice; catalogProduct.Price = newPrice;
return JsonConvert.SerializeObject(catalogProduct); return JsonConvert.SerializeObject(catalogProduct);
} }
@ -117,7 +117,7 @@ namespace FunctionalTests.Services
Id = Guid.NewGuid().ToString(), Id = Guid.NewGuid().ToString(),
UnitPrice = item.Price, UnitPrice = item.Price,
PictureUrl = item.PictureUri, PictureUrl = item.PictureUri,
ProductId = item.Id.ToString(), ProductId = item.Id,
OldUnitPrice = 0, OldUnitPrice = 0,
ProductName = item.Name, ProductName = item.Name,
Quantity = 1 Quantity = 1

View File

@ -104,7 +104,7 @@ namespace FunctionalTests.Services.Ordering
{ {
Id = "1", Id = "1",
ProductName = "ProductName", ProductName = "ProductName",
ProductId = "1", ProductId = 1,
UnitPrice = 10, UnitPrice = 10,
Quantity = 1 Quantity = 1
} }

View File

@ -33,7 +33,7 @@ namespace FunctionalTests.Services.Ordering
testServer.Host testServer.Host
.MigrateDbContext<OrderingContext>((context, services) => .MigrateDbContext<OrderingContext>((context, services) =>
{ {
var env = services.GetService<IHostingEnvironment>(); var env = services.GetService<IWebHostEnvironment>();
var settings = services.GetService<IOptions<OrderingSettings>>(); var settings = services.GetService<IOptions<OrderingSettings>>();
var logger = services.GetService<ILogger<OrderingContextSeed>>(); var logger = services.GetService<ILogger<OrderingContextSeed>>();