public void UpdateShoppingListItem_ReturnUpdatedShoppingListItem()
        {
            var random           = new Random();
            var shoppingListItem = new ShoppingListItem {
                Name = Guid.NewGuid().ToString(), Quantity = (uint)random.Next(int.MaxValue)
            };
            var updatedItem = new UpdateShoppingListItem()
            {
                Quantity = (uint)random.Next(int.MaxValue)
            };

            CheckoutClient.OfficeShoppingService.AddShoppingListItem(testGuid, shoppingListItem);

            var response = CheckoutClient.OfficeShoppingService.UpdateShoppingListItem(testGuid, shoppingListItem.Name, updatedItem);

            response.Should().NotBeNull();
            response.HttpStatusCode.Should().Be(HttpStatusCode.OK);
            response.Model.Name.Should().Be(shoppingListItem.Name);
            response.Model.Quantity.Should().Be(updatedItem.Quantity);
        }
예제 #2
0
        public async Task <ActionResult> UpdateItem(UpdateShoppingListItem command)
        {
            await _mediator.Send(command);

            return(Ok());
        }
        public HttpResponse <ShoppingListItem> UpdateShoppingListItem(Guid id, string name, UpdateShoppingListItem update)
        {
            var updateShoppingListItemUri = string.Format(ApiUrls.ShoppingListItemResourceUri, id, name);

            return(new ApiHttpClient().PutRequest <ShoppingListItem>(updateShoppingListItemUri, AppSettings.PublicKey, update));
        }