public void Set_Product_New_Name()
        {
            ProductEntity newProduct = _fixture.Create <ProductEntity>();

            string newName = newProduct.Name;

            _product.SetName(newName);

            Assert.AreEqual(_product.Name, newName);
        }
        public async Task <ActionResult> Put([FromBody] ResponseProduct response)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            try
            {
                ProductEntity product = await _service.Get(response.id);

                if (product == null)
                {
                    return(BadRequest());
                }

                product.SetName(new ProductName(response.name));
                product.SetPrice(new Price(response.price));
                product.SetStock(new Stock(response.stock));

                var result = await _service.Put(product);

                if (result == null)
                {
                    return(BadRequest());
                }
                else
                {
                    return(Ok(result));
                }
            }
            catch (ArgumentException e)
            {
                return(StatusCode((int)HttpStatusCode.InternalServerError, e.Message));
            }
        }