Ejemplo n.º 1
0
        public void getBezorgdagenPerWinkelTest()
        {
            var supermarkt = Repo.GetWinkel("AH");
            var snackbar   = Repo.GetWinkel("Artisjok");

            Assert.IsTrue(Repo.GetStandaardBezorgdagenPerWinkel(supermarkt).ToArray()[0].Dag.Equals(DayOfWeek.Monday));
            Assert.IsTrue(Repo.GetStandaardBezorgdagenPerWinkel(supermarkt).ToArray()[1].Dag.Equals(DayOfWeek.Wednesday));
            Assert.IsTrue(Repo.GetStandaardBezorgdagenPerWinkel(snackbar).ToArray()[0].Dag.Equals(DayOfWeek.Friday));
        }
Ejemplo n.º 2
0
        public void GetProductenPerWinkelTest()
        {
            Winkel snackbar = new Winkel("snackbar");

            Repo.AddWinkel(snackbar);
            Product kroket = new Product("kroket", 180, snackbar);

            Repo.AddProduct(kroket);
            Assert.IsFalse(Repo.GetProducten(Repo.GetWinkel("appie")).Contains <Product>(kroket));
            Assert.IsTrue(Repo.GetProducten(Repo.GetWinkel("snackbar")).Contains <Product>(kroket));
        }
Ejemplo n.º 3
0
        public ActionResult GetProductenPerWinkel(string winkelnaam)
        {
            List <Product> producten = new List <Product>();
            Winkel         winkel;

            try
            {
                winkel    = Repo.GetWinkel(winkelnaam);
                producten = Repo.GetProducten(winkel).ToList();
                return(Json(producten));
            }

            catch (Exception e)
            {
                if (e is InvalidOperationException)
                {
                    return(NotFound());
                }
                else
                {
                    return(StatusCode(StatusCodes.Status500InternalServerError));
                }
            }
        }