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)); }
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)); }
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)); } } }