public void TestUpdateInterestpointCategoryAsync() { BoraNowSeeder.Seed(); var cbo = new CompanyBusinessObject(); var resList = cbo.List(); var item = resList.Result.FirstOrDefault(); var pbo = new ProfileBusinessObject(); var profile = new Profile("II", "AA"); pbo.Create(profile); var company = new Company("B", "C", "1263", "2434", profile.Id); item.Name = company.Name; item.Representative = company.Representative; item.PhoneNumber = company.PhoneNumber; item.VatNumber = company.VatNumber; item.ProfileId = company.ProfileId; var resUpdate = cbo.Update(item); resList = cbo.ListAsync().Result; Assert.IsTrue(resUpdate.Success && resList.Success && resList.Result.First().Name == company.Name && resList.Result.First().Representative == company.Representative && resList.Result.First().PhoneNumber == company.PhoneNumber && resList.Result.First().VatNumber == company.VatNumber && resList.Result.First().ProfileId == company.ProfileId); }
public void TestListCompanyAsync() { ContextSeeder.Seed(); var bo = new CompanyBusinessObject(); var resList = bo.ListAsync().Result; Assert.IsTrue(resList.Success && resList.Result.Count == 1); }
public void TestDeleteEstablishmentAsync() { ContextSeeder.Seed(); var bo = new CompanyBusinessObject(); var resList = bo.ListAsync().Result; var resDelete = bo.DeleteAsync(resList.Result.First().Id).Result; resList = bo.ListNotDeletedAsync().Result; Assert.IsTrue(resDelete.Success && resList.Success && resList.Result.Count == 0); }
public void TestDeleteInterestPointCategoryAsync() { BoraNowSeeder.Seed(); var bo = new CompanyBusinessObject(); var resList = bo.List(); var resDelete = bo.DeleteAsync(resList.Result.First().Id).Result; resList = bo.ListAsync().Result; Assert.IsTrue(resDelete.Success && resList.Success && resList.Result.First().IsDeleted); }
public async Task <IActionResult> Index() { var listOperation = await _bo.ListAsync(); if (!listOperation.Success) { return(OperationErrorBackToIndex(listOperation.Exception)); } var cListOperation = await _cbo.ListAsync(); if (!cListOperation.Success) { return(OperationErrorBackToIndex(cListOperation.Exception)); } var list = new List <InterestPointViewModel>(); foreach (var item in listOperation.Result) { if (!item.IsDeleted) { list.Add(InterestPointViewModel.Parse(item)); } } var cList = new List <CompanyViewModel>(); foreach (var item in cListOperation.Result) { if (!item.IsDeleted) { cList.Add(CompanyViewModel.Parse(item)); } } ViewData["Title"] = "Interest Points"; ViewData["BreadCrumbs"] = GetCrumbs(); ViewData["DeleteHref"] = GetDeleteRef(); ViewBag.Companies = cList; return(View(list)); }
public void TestUpdateCompanyAsync() { ContextSeeder.Seed(); var bo = new CompanyBusinessObject(); var resList = bo.ListAsync().Result; var item = resList.Result.FirstOrDefault(); item.Name = "Jerónimo Martins"; var resUpdate = bo.UpdateAsync(item).Result; resList = bo.ListNotDeletedAsync().Result; Assert.IsTrue(resList.Success && resUpdate.Success && resList.Result.First().Name == "Jerónimo Martins"); }
public async Task <IActionResult> Index() { var listOperation = await _bo.ListAsync(); if (!listOperation.Success) { return(OperationErrorBackToIndex(listOperation.Exception)); } var pListOperation = await _pbo.ListAsync(); if (!pListOperation.Success) { return(OperationErrorBackToIndex(pListOperation.Exception)); } var lst = new List <CompanyViewModel>(); foreach (var item in listOperation.Result) { if (!item.IsDeleted) { lst.Add(CompanyViewModel.Parse(item)); } } var pList = new List <ProfileViewModel>(); foreach (var item in pListOperation.Result) { if (!item.IsDeleted) { pList.Add(ProfileViewModel.Parse(item)); } } ViewBag.PRofile = pList; ViewData["Title"] = "Companies"; ViewData["BreadCrumbs"] = GetCrumbs(); ViewData["DeleteHref"] = GetDeleteRef(); return(View(lst)); }
public void TestUpdateShoppingBasketAsync() { ContextSeeder.Seed(); var bo = new ShoppingBasketBusinessObject(); var ebo = new EstablishmentBusinessObject(); var rbo = new RegionBusinessObject(); var cbo = new CompanyBusinessObject(); var reg = rbo.ListAsync().Result.Result.FirstOrDefault(); var com = cbo.ListAsync().Result.Result.FirstOrDefault(); var est = new Establishment("rua das papoilas", "09h00", "20h00", "sundays and holidays", reg.Id, com.Id); ebo.Create(est); var resList = bo.ListAsync(); var item = resList.Result.Result.FirstOrDefault(); item.EstablishmentId = est.Id; var resUpdate = bo.UpdateAsync(item).Result; var resNotList = bo.ListNotDeletedAsync().Result.Result; Assert.IsTrue(resUpdate.Success && resNotList.First().EstablishmentId == est.Id); }