public void PutProductUpdatesRepository()
        {
            //// Arrange
            bool wasCalled = false;
            Guid productKey = Guid.NewGuid();
            ProductActual productActual = CreateFakeProduct(productKey, 20.0M);

            var MockProductService = new Mock<IProductService>();
            MockProductService.Setup(cs => cs.Save(productActual, It.IsAny<bool>())).Callback(() => wasCalled = true);

            MerchelloContext merchelloContext = GetMerchelloContext(MockProductService.Object);

            ProductApiController ctrl = new ProductApiController(merchelloContext, tempUmbracoContext);
            ctrl.Request = new HttpRequestMessage();
            ctrl.Request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration());

            //// Act
            HttpResponseMessage response = ctrl.PutProduct(productActual);

            //// Assert
            Assert.AreEqual(System.Net.HttpStatusCode.OK, response.StatusCode);

            Assert.True(wasCalled);
        }
        public void PutProductReturns500WhenRepositoryUpdateReturnsError()
        {
            //// Arrange
            Guid productKey = Guid.NewGuid();
            ProductActual productActual = CreateFakeProduct(productKey, 20.0M);

            var MockProductService = new Mock<IProductService>();
            MockProductService.Setup(cs => cs.Save(productActual, It.IsAny<bool>())).Throws<InvalidOperationException>();

            MerchelloContext merchelloContext = GetMerchelloContext(MockProductService.Object);

            ProductApiController ctrl = new ProductApiController(merchelloContext, tempUmbracoContext);
            ctrl.Request = new HttpRequestMessage();
            ctrl.Request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration());

            //// Act
            HttpResponseMessage response = ctrl.PutProduct(productActual);

            //// Assert
            Assert.AreEqual(System.Net.HttpStatusCode.NotFound, response.StatusCode);
        }