public ActionResult Index() { var pizzaBL = new PizzaBL(); var model = pizzaBL.GetPizzaStatistics(store.GetPizzas()); model.Orders = model.Orders.OrderByDescending(p => p.Total).Take(20).ToList(); return(View(model)); }
public void WhenGetTop3Pizzas_Success() { var pizzas = store.GetPizzas(); var pizzaBL = new PizzaBL(); var statistics = pizzaBL.GetPizzaStatistics(pizzas); var topPizzas = statistics.Orders.OrderByDescending(p => p.Total).Take(3).ToList(); var topPizzasRepository = ((FakePizzaStore)store).GetTop3Pizzas().ToList(); CollectionAssert.AreEqual(topPizzas[0].Pizza.Toppings, topPizzasRepository[0].Toppings); CollectionAssert.AreEqual(topPizzas[1].Pizza.Toppings, topPizzasRepository[1].Toppings); CollectionAssert.AreEqual(topPizzas[2].Pizza.Toppings, topPizzasRepository[2].Toppings); }