コード例 #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));
        }
コード例 #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));
        }
コード例 #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));
                }
            }
        }