public async Task <ActionResult> Index() { var orders = await helper.GetOutstandingOrders(); var Top5Lines = helper.TakeTopNProductsFromOrders(orders, 5); return(View(Top5Lines)); }
public async Task TestGetTopNProductsInOutstandingOrders() { //arrange IRepository repository = new MockedRepository(); ChannelEngineHelper controller = new ChannelEngineHelper(repository); var orders = await controller.GetOutstandingOrders(); //act var topNProducts = controller.TakeTopNProductsFromOrders(orders, 5); Assert.IsTrue(topNProducts.Count == 4); Assert.IsTrue(topNProducts[0].Name == "T-shirt met lange mouw BASIC petrol: M"); }
static async Task Main() { var helper = new ChannelEngineHelper(); var orders = await helper.GetOutstandingOrders(); Console.WriteLine("Found {0} orders in progress", orders.Count); Console.WriteLine(); var top5Lines = helper.TakeTopNProductsFromOrders(orders, 5); Console.WriteLine("Products in outstanding orders:"); foreach (var line in top5Lines) { Console.WriteLine("Product: {0} \t{1} \t {2} \t{3}", line.Name, line.Gtin, line.MerchantProductNumber, line.Quantity); } Console.ReadKey(); Console.WriteLine("Setting quantity for top product to 25..."); string result = await helper.UpdateStockForProduct(top5Lines[0].MerchantProductNumber, 25); Console.WriteLine(result); Console.WriteLine("... all done. Press any key to end this program."); }