コード例 #1
0
 public ContextDAL()
 {
     Products      = new ProductDataProvider(this);
     Coupons       = new CouponDataProvider(this);
     ShoppingCarts = new ShoppingCartDataProvider(this);
     _dbContext    = new ApplicationDbContext();
 }
コード例 #2
0
        public XDocument ReadXml()
        {
            var xDocument   = new XDocument();
            var xElement    = new XElement("Products");
            var xAttributes = ProductDataProvider.GetProducts()
                              .Select(m => new XElement("Product",
                                                        new XAttribute("Description", m.Name), new XAttribute("Price", m.Price)));

            xElement.Add(xAttributes);
            xDocument.Add(xElement);
            return(xDocument);
        }
コード例 #3
0
 public void Init()
 {
     _mockMapper         = new Mock <IMapper>();
     productDataProvider = new ProductDataProvider(_mockMapper.Object);
 }
コード例 #4
0
        public void CanUseGenericDataProviderForProduct()
        {
            var genericProductProvider = new GenericDataProvider<Product>(_session);

            var specificProductProvider = new ProductDataProvider(_session);

            int productId = 20;
            var productListByGeneric = genericProductProvider.GetById(productId);
            var productListBySpecific = specificProductProvider.GetProductById(productId);

            Assert.That(productListBySpecific, Is.EqualTo(productListByGeneric));
        }
コード例 #5
0
 public ProductController(ILogger <ProductController> logger)
 {
     _dataProvider = new ProductDataProvider();
     _logger       = logger;
 }