public void TestUpdatetCompany() { 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.List(); 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 TestDeleteInterestPointCategory() { BoraNowSeeder.Seed(); var bo = new CompanyBusinessObject(); 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 TestListCompany() { ContextSeeder.Seed(); var bo = new CompanyBusinessObject(); var resList = bo.List(); Assert.IsTrue(resList.Success && resList.Result.Count == 1); }
public void TestUpdateCompany() { ContextSeeder.Seed(); var bo = new CompanyBusinessObject(); var resList = bo.List(); var item = resList.Result.FirstOrDefault(); item.Name = "Jerónimo Martins"; var resUpdate = bo.Update(item); var resNotList = bo.ListNotDeleted().Result; Assert.IsTrue(resUpdate.Success && resNotList.First().Name == "Jerónimo Martins"); }
public ActionResult <List <CompanyViewModel> > List() { var res = _bo.List(); if (!res.Success) { return(new ObjectResult(HttpStatusCode.InternalServerError)); } var list = new List <CompanyViewModel>(); foreach (var item in res.Result) { list.Add(CompanyViewModel.Parse(item)); } return(list); }
public void TestDeleteEstablishment() { var boReg = new RegionBusinessObject(); var boComp = new CompanyBusinessObject(); var reg1 = boReg.List().Result.First(); var com1 = boComp.List().Result.First(); var objEst = new EstablishmentBusinessObject(); var est = new Establishment("Rua da pitaia, numero 1234, Açores", "07:00", "20:00", "Domingo", reg1.Id, com1.Id); objEst.Create(est); var res = objEst.Delete(est); Assert.IsTrue(res.Success); }
public void TestCreateReadEstablishment() { ContextSeeder.Seed(); var boReg = new RegionBusinessObject(); var reg1 = boReg.List().Result.First(); var boComp = new CompanyBusinessObject(); var com1 = boComp.List().Result.First(); var bo = new EstablishmentBusinessObject(); var est = new Establishment("Avenida da liberdade, numero 1029, Lisboa", "09:00", "20:00", "Domingo", reg1.Id, com1.Id); var resCreate = bo.Create(est); var resGet = bo.Read(est.Id); Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null); }
public ActionResult <List <CompanyViewModel> > List() { var res = _bo.List(); if (!res.Success) { return(StatusCode((int)HttpStatusCode.InternalServerError)); } var list = new List <CompanyViewModel>(); foreach (var item in res.Result) { list.Add(new CompanyViewModel { Id = item.Id, Name = item.Name }); } return(list); }
public void TestUpdateEstablishment() { ContextSeeder.Seed(); var boReg = new RegionBusinessObject(); var reg1 = boReg.List().Result.First(); var boComp = new CompanyBusinessObject(); var com1 = boComp.List().Result.First(); var bo = new EstablishmentBusinessObject(); var resList = bo.List(); var item = resList.Result.FirstOrDefault(); item.Address = "Rua Augusta, n 1213, Lisboa"; var resUpdate = bo.Update(item); var resNotList = bo.List().Result.Where(x => !x.IsDeleted); Assert.IsTrue(resUpdate.Success && resNotList.First().Address == "Rua Augusta, n 1213, Lisboa"); }
public void TestUpdateShoppingBasket() { ContextSeeder.Seed(); var bo = new ShoppingBasketBusinessObject(); var ebo = new EstablishmentBusinessObject(); var rbo = new RegionBusinessObject(); var cbo = new CompanyBusinessObject(); var reg = rbo.List().Result.FirstOrDefault(); var com = cbo.List().Result.FirstOrDefault(); var est = new Establishment("rua das papoilas", "09h00", "20h00", "sundays and holidays", reg.Id, com.Id); ebo.Create(est); var resList = bo.List(); var item = resList.Result.FirstOrDefault(); item.EstablishmentId = est.Id; var resUpdate = bo.Update(item); var resNotList = bo.ListNotDeleted().Result; Assert.IsTrue(resUpdate.Success && resNotList.First().EstablishmentId == est.Id); }