示例#1
0
        private void CreateCurrentProjectPrices()
        {
            CurrentProductPrice currentProductPrice = new CurrentProductPrice();
            ProductPrice        productPrice        = new ProductPrice()
            {
                ProductId = 2, CreatedOn = DateTime.UtcNow, Price = 120000, CurrentProductPrice = currentProductPrice
            };

            _productPriceService.SetProductPrice(productPrice);

            CurrentProductPrice currentProductPrice2 = new CurrentProductPrice();
            ProductPrice        productPrice2        = new ProductPrice()
            {
                ProductId = 2, CreatedOn = DateTime.UtcNow, Price = 150000, CurrentProductPrice = currentProductPrice2
            };

            _productPriceService.SetProductPrice(productPrice2);

            CurrentProductPrice currentProductPrice3 = new CurrentProductPrice();
            ProductPrice        productPrice3        = new ProductPrice()
            {
                ProductId = 1, CreatedOn = DateTime.UtcNow, Price = 15000, CurrentProductPrice = currentProductPrice3
            };

            _productPriceService.SetProductPrice(productPrice3);
        }
示例#2
0
        private ProductPrice GetProductPriceByHelper(Expression <Func <CurrentProductPrice, bool> > selector)
        {
            ProductPrice productPrice = null;
            Expression <Func <CurrentProductPrice, object> > includeProperties = x => x.ProductPrice;
            //Expression<Func<CurrentProductPrice, bool>> selector = p => p.ProductPrice.ProductId == productId;

            CurrentProductPrice currentProductPrice = _repository.GetSingle <CurrentProductPrice>(selector, includeProperties);

            if (currentProductPrice != null && currentProductPrice.ProductPriceId > 0)
            {
                productPrice = currentProductPrice.ProductPrice;
            }

            return(productPrice);
        }
示例#3
0
        public void SetProductPrice_Should_SetPriceOfProduct()
        {
            CreateCurrentProjectPrices();

            CurrentProductPrice         newCurrentProductPrice3 = _repository.GetSingle <CurrentProductPrice>(3);
            IList <CurrentProductPrice> currentProductPrices    = _repository.GetAll <CurrentProductPrice>().ToList();
            IList <ProductPrice>        newProductPrices        = _repository.GetAll <ProductPrice>().ToList();

            Assert.NotNull(currentProductPrices);
            Assert.NotNull(newCurrentProductPrice3);
            Assert.NotNull(newProductPrices);
            Assert.Equal(2, currentProductPrices.Count);
            Assert.Equal(3, newCurrentProductPrice3.ProductPriceId);
            Assert.Equal(3, newProductPrices.Count);
        }