Fix test after changes in Catalog Controller
This commit is contained in:
parent
395768d574
commit
f974d5ea86
@ -43,7 +43,7 @@ namespace FunctionalTests.Services
|
|||||||
var itemToModify = basket.Items[2];
|
var itemToModify = basket.Items[2];
|
||||||
var oldPrice = itemToModify.UnitPrice;
|
var oldPrice = itemToModify.UnitPrice;
|
||||||
var newPrice = oldPrice + priceModification;
|
var newPrice = oldPrice + priceModification;
|
||||||
var pRes = await catalogClient.PostAsync(CatalogScenariosBase.Post.UpdateCatalogProduct, new StringContent(ChangePrice(itemToModify, newPrice), UTF8Encoding.UTF8, "application/json"));
|
var pRes = await catalogClient.PostAsync(CatalogScenariosBase.Post.UpdateCatalogProduct, new StringContent(ChangePrice(itemToModify, newPrice, originalCatalogProducts), UTF8Encoding.UTF8, "application/json"));
|
||||||
|
|
||||||
var modifiedCatalogProducts = await GetCatalogAsync(catalogClient);
|
var modifiedCatalogProducts = await GetCatalogAsync(catalogClient);
|
||||||
|
|
||||||
@ -100,14 +100,11 @@ namespace FunctionalTests.Services
|
|||||||
return JsonConvert.DeserializeObject<PaginatedItemsViewModel<CatalogItem>>(items);
|
return JsonConvert.DeserializeObject<PaginatedItemsViewModel<CatalogItem>>(items);
|
||||||
}
|
}
|
||||||
|
|
||||||
private string ChangePrice(BasketItem itemToModify, decimal newPrice)
|
private string ChangePrice(BasketItem itemToModify, decimal newPrice, PaginatedItemsViewModel<CatalogItem> catalogProducts)
|
||||||
{
|
{
|
||||||
var item = new CatalogItem()
|
var catalogProduct = catalogProducts.Data.Single(pr => pr.Id == int.Parse(itemToModify.ProductId));
|
||||||
{
|
catalogProduct.Price = newPrice;
|
||||||
Id = int.Parse(itemToModify.ProductId),
|
return JsonConvert.SerializeObject(catalogProduct);
|
||||||
Price = newPrice
|
|
||||||
};
|
|
||||||
return JsonConvert.SerializeObject(item);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private CustomerBasket ComposeBasket(string customerId, IEnumerable<CatalogItem> items)
|
private CustomerBasket ComposeBasket(string customerId, IEnumerable<CatalogItem> items)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user