Esempio n. 1
0
        public void GetOptions()
        {
            Guid ProductId = Guid.NewGuid();
            Guid OptionId1 = Guid.NewGuid();
            var  OptionId2 = Guid.NewGuid();

            var product = new ProductEntity()
            {
                Id            = ProductId,
                Name          = "Product With Options",
                Description   = "Product with options Description",
                Price         = 999.99M,
                DeliveryPrice = 9.8M
            };
            var productOption1 = new ProductOptionsEntity()
            {
                ProductId   = ProductId,
                Id          = OptionId1,
                Name        = "Option 1",
                Description = "Option 1 Description"
            };
            var productOption2 = new ProductOptionsEntity()
            {
                ProductId   = ProductId,
                Id          = OptionId2,
                Name        = "Option 2",
                Description = "Option 2 Description"
            };

            _productsService.CreateProduct(product);
            _productsOptionService.CreateOption(ProductId, productOption1);
            _productsOptionService.CreateOption(ProductId, productOption2);

            var productOptions = _productsOptionService.GetOptions(ProductId);

            Assert.True(2 == productOptions.Count, "Two options created successfully");

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

            Assert.True("Option 1" == productOption.Name, "Successfully retrieved option 1");
        }
Esempio n. 2
0
 public void CreateOption(Guid productId, ProductOptionsEntity option)
 {
     log.Info(String.Format("CreateOption Method called for Product Id : {0}", productId));
     _productOptionService.CreateOption(productId, option);
 }