public void TestUpdateProductOptionService()
 {
     //Arrange
     _helper._mockProductOptionsTable.Clear();
     _helper._mockProductOptionsTable.Add(_testProductOption);
     _testProductOptionModel.Description = "manchester united!";
     _testProductOptionModel.Name        = "JOSE Mourinho!";
     //Act
     _testService.UpdateOption(_testProductOptionModel.Id, _testProductOptionModel);
     //Assert
     Assert.AreEqual(_helper._mockProductOptionsTable.Find(p => p.Id == _testProductOption.Id).Description, "manchester united!");
     Assert.AreEqual(_helper._mockProductOptionsTable.Find(p => p.Id == _testProductOption.Id).Name, "JOSE Mourinho!");
 }
示例#2
0
        public void UpdateOption()
        {
            Guid ProductId = Guid.NewGuid();
            Guid OptionId1 = Guid.NewGuid();

            var product = new ProductEntity()
            {
                Id            = ProductId,
                Name          = "Product With Options",
                Description   = "Product with options Description",
                Price         = 999.99M,
                DeliveryPrice = 9.8M
            };
            var productOptionOriginal = new ProductOptionsEntity()
            {
                ProductId   = ProductId,
                Id          = OptionId1,
                Name        = "Option Original",
                Description = "Option original Description"
            };
            var productOptionUpdate = new ProductOptionsEntity()
            {
                ProductId   = ProductId,
                Id          = OptionId1,
                Name        = "Option_updated",
                Description = "Option 1 updated Description"
            };

            _productsService.CreateProduct(product);
            _productsOptionService.CreateOption(ProductId, productOptionOriginal);

            var productOptions = _productsOptionService.GetOptions(ProductId);

            Assert.True(1 == productOptions.Count, "One option created successfully");

            _productsOptionService.UpdateOption(OptionId1, productOptionUpdate);

            var productOption = _productsOptionService.GetOption(ProductId, OptionId1);

            Assert.True("Option_updated" == productOption.Name, "Option name updated successfully");
        }
 public async Task UpdateOption(Guid optionId, [FromBody] ProductOptionModel option)
 {
     await _productOptionservice.UpdateOption(optionId, option);
 }
示例#4
0
 public void UpdateOption(Guid id, ProductOptionsEntity option)
 {
     log.Info(String.Format("UpdateOption Method called for Product Id : {0}", id));
     _productOptionService.UpdateOption(id, option);
 }