public async Task UpdateAsync_ExistingItem_UpdatesItem()
        {
            var currentTime = new DateTime(2018, 10, 1, 8, 42, 5);
            var id          = Guid.Parse("F7148339-E162-4657-B886-C29BF6A2D312");

            var(originalItem, receivedItem, changedItem) = CreateItems(id, currentTime);

            _itemObtainingService.ExistsAsync(id).Returns(true);
            _itemObtainingService.GetById(id).Returns(originalItem);
            _dateTimeWrapper.CurrentDateTime().Returns(currentTime, DateTime.MinValue);

            await _itemUpdatingService.UpdateAsync(receivedItem);

            await _itemRepository.Received(1).UpdateAsync(ArgExtended.IsItem(changedItem));
        }
        public async Task <IHttpActionResult> PutItemAsync(Guid id, [FromBody] Item item)
        {
            if (!IsIdValid(id) || !PutIsItemValid(id, item))
            {
                return(BadRequest(ModelState));
            }

            if (!await _itemObtainingService.ExistsAsync(id))
            {
                return(await PostItemAsync(new Item
                {
                    Text = item.Text
                }));
            }

            await _itemUpdatingService.UpdateAsync(item);

            return(StatusCode(HttpStatusCode.NoContent));
        }