public void TestUpdateMenu() { ContextSeeders.Seed(); var mbo = new MenuBusinessObject(); var resList = mbo.List(); var item = resList.Result.FirstOrDefault(); var rbo = new RestaurantBusinessObject(); var mealbo = new MealBusinessObject(); var restaurant = new Restaurant("a", "b", "c", "d", "f", 6); var meal = new Meal("a", "b", "c"); rbo.Create(restaurant); mealbo.Create(meal); var newMenu = new Menu(DateTime.Now, restaurant.Id, meal.Id); item.Date = newMenu.Date; item.RestaurantId = newMenu.RestaurantId; item.MealId = newMenu.MealId; var resUpdate = mbo.Update(item); resList = mbo.List(); Assert.IsTrue(resList.Success && resUpdate.Success && resList.Result.First().Date == newMenu.Date && resList.Result.First().RestaurantId == newMenu.RestaurantId && resList.Result.First().MealId == newMenu.MealId); }
public void TestDeleteMenu() { ContextSeeders.Seed(); var bo = new MenuBusinessObject(); var resList = bo.List(); var resDelete = bo.Delete(resList.Result.First().Id); resList = bo.List(); Assert.IsTrue(resDelete.Success && resList.Success && resList.Result.First().IsDeleted); }
public void TestListMenu() { RestaurantSeeder.Seed(); var bo = new MenuBusinessObject(); var resList = bo.List(); Assert.IsTrue(resList.Success && resList.Result.Count > 0); }
public void TestListMenu() { ContextSeeders.Seed(); var bo = new MenuBusinessObject(); var resList = bo.List(); Assert.IsTrue(resList.Success && resList.Result.Count == 1); }
public void TestDeleteMenu() { RestaurantSeeder.Seed(); var bo = new MenuBusinessObject(); var resList = bo.List(); var total = resList.Result.Count; var resDelete = bo.Delete(resList.Result.First().Id); resList = bo.ListNonDeleted(); Assert.IsTrue(resDelete.Success && resList.Success && resList.Result.Count == total - 1); }
public void TestUpdateMenu() { RestaurantSeeder.Seed(); var bo = new MenuBusinessObject(); var resList = bo.List(); var item = resList.Result.FirstOrDefault(); var now = DateTime.Now; item.Date = now; var resUpdate = bo.Update(item); resList = bo.ListNonDeleted(); Assert.IsTrue(resList.Success && resUpdate.Success && resList.Result.First().Date == now); }
public void TestUpdateServing() { RestaurantSeeder.Seed(); var bo = new ServingBusinessObject(); var mbo = new MenuBusinessObject(); var resList = bo.List(); var item = resList.Result.FirstOrDefault(); var newMenuId = mbo.List().Result.First(x => x.Id != item.MenuId).Id; item.MenuId = newMenuId; var resUpdate = bo.Update(item); resList = bo.ListNonDeleted(); Assert.IsTrue(resList.Success && resUpdate.Success && resList.Result.First().MenuId == newMenuId); }
public ActionResult <List <MenuViewModel> > List() { var res = _bo.List(); if (!res.Success) { return(new ObjectResult(HttpStatusCode.InternalServerError)); } var list = new List <MenuViewModel>(); foreach (var item in res.Result) { list.Add(MenuViewModel.Parse(item)); } return(list); }
public void TestCreateAndListServing() { RestaurantSeeder.Seed(); var cbo = new CourseBusinessObject(); var dbo = new DishBusinessObject(); var mbo = new MenuBusinessObject(); var sbo = new ServingBusinessObject(); var c = cbo.List().Result.First(); var d = dbo.List().Result.First(); var m = mbo.List().Result.First(); var dr = new Serving(m.Id, d.Id, c.Id); var resCreate = sbo.Create(dr); var resGet = sbo.Read(dr.Id); Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null); }