public void TestCreateSameSerialNumberProductUnitAsync() { ContextSeeder.Seed(); var braBo = new BrandBusinessObject(); var bra = new Brand("Barraca do Tejo"); braBo.Create(bra); var catBo = new CategoryBusinessObject(); var cat = new Category("Non-Alcoholic Beverages"); catBo.Create(cat); var pmbo = new ProductModelBusinessObject(); var prodMod = new ProductModel("Vinho Branco", "506-1237-422", "", 4.24, 0.80, Measure.L, bra.Id, cat.Id); pmbo.Create(prodMod); var sbo = new ShoppingBasketBusinessObject(); var sbk = sbo.ListNotDeleted().Result.First(); var bo = new ProductUnitBusinessObject(); var item = bo.ListAsync().Result.Result.FirstOrDefault(); var ebo = new EstablishmentBusinessObject(); var est = ebo.ListNotDeleted().Result.First(); var prodUnit = new ProductUnit(item.SerialNumber, false, prodMod.Id, est.Id, sbk.Id); var resCreate = bo.CreateAsync(prodUnit).Result; Assert.IsTrue(!resCreate.Result); }
public void TestUpdateShoppingBasket() { ContextSeeder.Seed(); var bo = new ShoppingBasketBusinessObject(); var resList = bo.List(); var item = resList.Result.FirstOrDefault(); var pbo = new ProfileBusinessObject(); var pro = pbo.List().Result.FirstOrDefault(); item.ProfileId = pro.Id; var resUpdate = bo.Update(item); var resNotList = bo.ListNotDeleted().Result; Assert.IsTrue(resUpdate.Success && resNotList.First().ProfileId == pro.Id); }
public void TestCreateAndReadProductUnit() { ContextSeeder.Seed(); var pmbo = new ProductModelBusinessObject(); var prodMod = pmbo.ListNotDeleted().Result.First(); var ebo = new EstablishmentBusinessObject(); var est = ebo.ListNotDeleted().Result.First(); var sbo = new ShoppingBasketBusinessObject(); var sbk = sbo.ListNotDeleted().Result.First(); var bo = new ProductUnitBusinessObject(); var prodUnit = new ProductUnit("werkyt235", false, prodMod.Id, est.Id, sbk.Id); var resCreate = bo.Create(prodUnit); var resGet = bo.Read(prodUnit.Id); Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null); }
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); }