public void TestDeleteMeal() { RestaurantSeeder.SeedCountries(); var bo = new MealBusinessObject(); var resList = bo.List(); var resDelete = bo.Delete(resList.Result.First().Id); var resNotList = bo.List().Result.Where(x => !x.IsDeleted).ToList(); Assert.IsTrue(resDelete.Success && resNotList.Count == 0); }
public void TestDeleteMeal() { ContextSeeders.Seed(); var bo = new MealBusinessObject(); 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 TestUpdateMeal() { RestaurantSeeder.SeedCountries(); var bo = new MealBusinessObject(); var resList = bo.List(); var item = resList.Result.FirstOrDefault(); item.StartingHours = "20h00"; var resUpdate = bo.Update(item); var resNotList = bo.List().Result.Where(x => !x.IsDeleted); Assert.IsTrue(resUpdate.Success && resNotList.First().StartingHours == "20h00"); }
public void TestListMeal() { RestaurantSeeder.Seed(); var bo = new MealBusinessObject(); var resList = bo.List(); Assert.IsTrue(resList.Success && resList.Result.Count > 0); }
public void TestListMeal() { ContextSeeders.Seed(); var bo = new MealBusinessObject(); var resList = bo.List(); Assert.IsTrue(resList.Success && resList.Result.Count == 1); }
public void TestDeleteMeal() { RestaurantSeeder.Seed(); var bo = new MealBusinessObject(); 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 TestUpdateMeal() { ContextSeeders.Seed(); var mbo = new MealBusinessObject(); var resList = mbo.List(); var item = resList.Result.FirstOrDefault(); var newMeal = new Meal("lasagna", "8pm", "10pm"); item.Name = newMeal.Name; item.StartingHours = newMeal.StartingHours; item.EndingHours = newMeal.EndingHours; var resUpdate = mbo.Update(item); resList = mbo.List(); Assert.IsTrue(resList.Success && resUpdate.Success && resList.Result.First().Name == newMeal.Name && resList.Result.First().StartingHours == newMeal.StartingHours && resList.Result.First().EndingHours == newMeal.EndingHours); }
public void TestUpdateMeal() { RestaurantSeeder.Seed(); var bo = new MealBusinessObject(); var resList = bo.List(); var item = resList.Result.FirstOrDefault(); item.Name = "another"; var resUpdate = bo.Update(item); resList = bo.ListNonDeleted(); Assert.IsTrue(resList.Success && resUpdate.Success && resList.Result.First().Name == "another"); }
public ActionResult <List <MealViewModel> > List() { var res = _bo.List(); if (!res.Success) { return(new ObjectResult(HttpStatusCode.InternalServerError)); } var list = new List <MealViewModel>(); foreach (var item in res.Result) { list.Add(MealViewModel.Parse(item)); } return(list); }
public void TestCreateAndListMenu() { RestaurantSeeder.Seed(); var mbo = new MealBusinessObject(); var rbo = new RestaurantBusinessObject(); var mebo = new MenuBusinessObject(); var m = mbo.List().Result.First(); var r = rbo.List().Result.First(); var dr = new Menu(DateTime.Now, r.Id, m.Id); var resCreate = mebo.Create(dr); var resGet = mebo.Read(dr.Id); Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null); }