public ContextDAL() { Products = new ProductDataProvider(this); Coupons = new CouponDataProvider(this); ShoppingCarts = new ShoppingCartDataProvider(this); _dbContext = new ApplicationDbContext(); }
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); }
public void Init() { _mockMapper = new Mock <IMapper>(); productDataProvider = new ProductDataProvider(_mockMapper.Object); }
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)); }
public ProductController(ILogger <ProductController> logger) { _dataProvider = new ProductDataProvider(); _logger = logger; }