public void GetProductsShouldGetAllProducts() { using (var context = new Entity.StoreDBContext(options)) { IStoreRepository _repo = new StoreRepoDB(context, new StoreMapper()); var products = _repo.GetProducts(); Assert.Equal(3, products.Count); } }
public void GetProductsShouldGetAllProducts() { using (var ctx = new StoreContext(options)) { StoreRepoDB repo = new StoreRepoDB(ctx); for (int i = 0; i < 5; i++) { Product testProduct = new Product(); testProduct.ProductName = $"Test{i}"; testProduct.ProductPrice = i; ctx.Products.Add(testProduct); } ctx.SaveChanges(); } using (var assertCtx = new StoreContext(options)) { StoreRepoDB repo = new StoreRepoDB(assertCtx); var products = repo.GetProducts(product => true); Assert.NotNull(products); Assert.Equal(5, products.Count); } }
public List <Product> GetProducts() { return(repo.GetProducts(product => true)); }