public List <ProductSum> GetWarehouseProductSum() { var result = new List <ProductSum>(); var productList = productRepository.GetItemsList(); var productSocets = socetProductRepository.GetItemsList(); foreach (var product in productList) { var productCount = productSocets.Count(x => x.ProductId.Id.ToString() == product.Id.ToString()); var productSum = new ProductSum(product.Id.ToString(), product.Name, product.Ean, productCount); result.Add(productSum); } return(result); }
public void TestCase1() { var list = new List <object> { 5, 2, new List <object> { 7, -1 }, 3, new List <object> { 6, new List <object> { -13, 8 }, 4 } }; var results = ProductSum.ProductSum1(list); Assert.That(results, Is.EqualTo(12)); }
public HomeController(IRepository repo, ProductSum psum) { repository = repo; productSum = psum; }