public void TestUpdateRestaurantAsync() { ContextSeeders.Seed(); var mbo = new RestaurantBusinessObject(); var resList = mbo.List(); var item = resList.Result.FirstOrDefault(); var newRestaurant = new Restaurant("Bartolomeu", "Rua tulipa, numero 234, Ericeira", "11:00", "22:00", "Segunfa-feira", 20); item.Name = newRestaurant.Name; item.Address = newRestaurant.Address; item.OpenningHours = newRestaurant.OpenningHours; item.ClosingHours = newRestaurant.ClosingHours; item.ClosingDays = newRestaurant.ClosingDays; item.TableCount = newRestaurant.TableCount; var resUpdate = mbo.UpdateAsync(item).Result; resList = mbo.ListAsync().Result; Assert.IsTrue(resList.Success && resUpdate.Success && resList.Result.First().Name == newRestaurant.Name && resList.Result.First().Address == newRestaurant.Address && resList.Result.First().OpenningHours == newRestaurant.OpenningHours && resList.Result.First().ClosingHours == newRestaurant.ClosingHours && resList.Result.First().ClosingDays == newRestaurant.ClosingDays && resList.Result.First().TableCount == newRestaurant.TableCount); }
public void TestListRestaurantAsync() { RestaurantSeeder.Seed(); var bo = new RestaurantBusinessObject(); var resList = bo.ListAsync().Result; Assert.IsTrue(resList.Success && resList.Result.Count == 1); }
public void TestDeleteRestaurantAsync() { RestaurantSeeder.Seed(); var bo = new RestaurantBusinessObject(); var resList = bo.ListAsync().Result; var resDelete = bo.DeleteAsync(resList.Result.First().Id).Result; resList = bo.ListNonDeletedAsync().Result; Assert.IsTrue(resDelete.Success && resList.Success && resList.Result.Count == 0); }
public void TestUpdateRestaurantAsync() { RestaurantSeeder.Seed(); var bo = new RestaurantBusinessObject(); var resList = bo.ListAsync().Result; var item = resList.Result.FirstOrDefault(); item.Name = "another"; var resUpdate = bo.UpdateAsync(item).Result; resList = bo.ListNonDeletedAsync().Result; Assert.IsTrue(resList.Success && resUpdate.Success && resList.Result.First().Name == "another"); }
public void TestUpdateRestaurantAsync() { RestaurantSeeder.SeedCountries(); var bo = new RestaurantBusinessObject(); var resList = bo.ListAsync().Result; var item = resList.Result.FirstOrDefault(); item.OpeningHours = "9h00"; var resUpdate = bo.UpdateAsync(item).Result; resList = bo.ListUnDeletedAsync().Result; Assert.IsTrue(resList.Success && resUpdate.Success && resList.Result.First().OpeningHours == "9h00"); }
public void TestCreateAndListMenuAsync() { RestaurantSeeder.Seed(); var mbo = new MealBusinessObject(); var rbo = new RestaurantBusinessObject(); var mebo = new MenuBusinessObject(); var m = mbo.ListAsync().Result.Result.First(); var r = rbo.ListAsync().Result.Result.First(); var dr = new Menu(DateTime.Now, r.Id, m.Id); var resCreate = mebo.CreateAsync(dr).Result; var resGet = mebo.ReadAsync(dr.Id).Result; Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null); }
public void TestCreateAndListClientRecordAsync() { RestaurantSeeder.Seed(); var sbo = new ClientRecordBusinessObject(); var rbo = new RestaurantBusinessObject(); var pbo = new PersonBusinessObject(); var r = rbo.ListAsync().Result.Result.First(); var p = pbo.ListAsync().Result.Result.First(); var dr = new ClientRecord(p.Id, r.Id, DateTime.Now); var resCreate = sbo.CreateAsync(dr).Result; var resGet = sbo.ReadAsync(dr.Id).Result; Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null); }
public async Task <IActionResult> Index() { var listOperation = await _bo.ListAsync(); if (!listOperation.Success) { return(View("Error", new ErrorViewModel() { RequestId = listOperation.Exception.Message })); } var lst = new List <RestaurantViewModel>(); foreach (var item in listOperation.Result) { if (!item.IsDeleted) { lst.Add(RestaurantViewModel.Parse(item)); } } return(View(lst)); }