@@ -43,7 +43,7 @@ public async Task Post_update_product_price_and_catalog_and_basket_list_modified
4343 var itemToModify = basket . Items [ 2 ] ;
4444 var oldPrice = itemToModify . UnitPrice ;
4545 var newPrice = oldPrice + priceModification ;
46- var pRes = await catalogClient . PostAsync ( CatalogScenariosBase . Post . UpdateCatalogProduct , new StringContent ( ChangePrice ( itemToModify , newPrice ) , UTF8Encoding . UTF8 , "application/json" ) ) ;
46+ var pRes = await catalogClient . PostAsync ( CatalogScenariosBase . Post . UpdateCatalogProduct , new StringContent ( ChangePrice ( itemToModify , newPrice , originalCatalogProducts ) , UTF8Encoding . UTF8 , "application/json" ) ) ;
4747
4848 var modifiedCatalogProducts = await GetCatalogAsync ( catalogClient ) ;
4949
@@ -100,14 +100,11 @@ private async Task<PaginatedItemsViewModel<CatalogItem>> GetCatalogAsync(HttpCl
100100 return JsonConvert . DeserializeObject < PaginatedItemsViewModel < CatalogItem > > ( items ) ;
101101 }
102102
103- private string ChangePrice ( BasketItem itemToModify , decimal newPrice )
103+ private string ChangePrice ( BasketItem itemToModify , decimal newPrice , PaginatedItemsViewModel < CatalogItem > catalogProducts )
104104 {
105- var item = new CatalogItem ( )
106- {
107- Id = int . Parse ( itemToModify . ProductId ) ,
108- Price = newPrice
109- } ;
110- return JsonConvert . SerializeObject ( item ) ;
105+ var catalogProduct = catalogProducts . Data . Single ( pr => pr . Id == int . Parse ( itemToModify . ProductId ) ) ;
106+ catalogProduct . Price = newPrice ;
107+ return JsonConvert . SerializeObject ( catalogProduct ) ;
111108 }
112109
113110 private CustomerBasket ComposeBasket ( string customerId , IEnumerable < CatalogItem > items )
0 commit comments