Exemple #1
0
        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 TestUpdateReservedQueue()
        {
            ContextSeeder.Seed();
            var regBo = new RegionBusinessObject();
            var reg   = new Region("Algordos");

            regBo.Create(reg);
            var compBo = new CompanyBusinessObject();
            var comp   = new Company("", 1234567890);

            compBo.Create(comp);
            var estBo = new EstablishmentBusinessObject();
            var est   = new Establishment("anywhere", "sempre", "nunca", "8º dia da semana", reg.Id, comp.Id);

            estBo.Create(est);
            var bo       = new ReservedQueueBusinessObject();
            var stoQList = bo.List();
            var item     = stoQList.Result.FirstOrDefault();

            item.EstablishmentId = est.Id;
            var stoQUpdate  = bo.Update(item);
            var stoQNotList = bo.ListNotDeleted().Result;

            Assert.IsTrue(stoQUpdate.Success && stoQNotList.First().EstablishmentId == est.Id);
        }
        public void TestListCompany()
        {
            ContextSeeder.Seed();
            var bo      = new CompanyBusinessObject();
            var resList = bo.List();

            Assert.IsTrue(resList.Success && resList.Result.Count == 1);
        }
Exemple #4
0
        public void TestListEstablishmentAsync()
        {
            ContextSeeder.Seed();
            var bo       = new EstablishmentBusinessObject();
            var restList = bo.ListAsync().Result;

            Assert.IsTrue(restList.Success && restList.Result.Count == 1);
        }
        public void TestListStoreQueuesAsync()
        {
            ContextSeeder.Seed();
            var bo      = new StoreQueueBusinessObject();
            var resList = bo.ListAsync().Result;

            Assert.IsTrue(resList.Success && resList.Result.Count == 1);
        }
        public void TestListReservedQueues()
        {
            ContextSeeder.Seed();
            var bo      = new ReservedQueueBusinessObject();
            var resList = bo.List();

            Assert.IsTrue(resList.Success && resList.Result.Count == 1);
        }
Exemple #7
0
        public void TestListEssentialGoods()
        {
            ContextSeeder.Seed();
            var bo      = new EssentialGoodBusinessObject();
            var resList = bo.List();

            Assert.IsTrue(resList.Success && resList.Result.Count == 1);
        }
        public void TestListShoppingBasketAsync()
        {
            ContextSeeder.Seed();
            var bo      = new ShoppingBasketBusinessObject();
            var resList = bo.ListAsync().Result;

            Assert.IsTrue(resList.Success && resList.Result.Count == 1);
        }
        public void TestListStoreQueue()
        {
            ContextSeeder.Seed();
            var bo             = new StoreQueueBusinessObject();
            var storeQueueList = bo.List();

            Assert.IsTrue(storeQueueList.Success && storeQueueList.Result.Count == 1);
        }
        public void TestListProductModelAsync()
        {
            ContextSeeder.Seed();
            var bo      = new ProductModelBusinessObject();
            var resList = bo.ListAsync().Result;

            Assert.IsTrue(resList.Success && resList.Result.Count == 1);
        }
        public void TestDeleteStoreQueue()
        {
            ContextSeeder.Seed();
            var bo          = new StoreQueueBusinessObject();
            var stoQList    = bo.List();
            var stoQDelete  = bo.Delete(stoQList.Result.First().Id);
            var stoQNotList = bo.List().Result.Where(x => !x.IsDeleted).ToList();

            Assert.IsTrue(stoQDelete.Success && stoQNotList.Count == 0);
        }
Exemple #12
0
        public void TestCreateAndReadRegionAsync()
        {
            ContextSeeder.Seed();
            var bo        = new RegionBusinessObject();
            var reg       = new Region("Lisboa");
            var resCreate = bo.CreateAsync(reg).Result;
            var resGet    = bo.ReadAsync(reg.Id).Result;

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
        public void TestCreateSameVatNumberCompanyAsync()
        {
            ContextSeeder.Seed();
            var bo        = new CompanyBusinessObject();
            var item      = bo.ListNotDeletedAsync().Result.Result.First();
            var est       = new Company("Ilhas", item.VatNumber);
            var resCreate = bo.CreateAsync(est).Result;

            Assert.IsTrue(resCreate.Success);
        }
Exemple #14
0
        public void TestCreateAndReadCategoryAsync()
        {
            ContextSeeder.Seed();
            var bo        = new CategoryBusinessObject();
            var reg       = new Category("Alcoholic Beverages");
            var resCreate = bo.CreateAsync(reg).Result;
            var resGet    = bo.ReadAsync(reg.Id).Result;

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
        public void TestCreateAndReadCompany()
        {
            ContextSeeder.Seed();
            var bo        = new CompanyBusinessObject();
            var com       = new Company("Sonae", 12345);
            var resCreate = bo.Create(com);
            var resGet    = bo.Read(com.Id);

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
Exemple #16
0
        public void TestCreateSameNameCategoryAsync()
        {
            ContextSeeder.Seed();
            var bo        = new CategoryBusinessObject();
            var item      = bo.ListAsync().Result.Result.FirstOrDefault();
            var reg       = new Category(item.Name);
            var resCreate = bo.CreateAsync(reg).Result;

            Assert.IsTrue(!resCreate.Result);
        }
Exemple #17
0
        public void TestCreateSamePhoneNumberProfileAsync()
        {
            ContextSeeder.Seed();
            var bo        = new ProfileBusinessObject();
            var item      = bo.ListAsync().Result.Result.First();
            var reg       = new Profile(123456089, "Manuel", "Macabres", item.PhoneNumber, DateTime.UtcNow);
            var resCreate = bo.CreateAsync(reg).Result;

            Assert.IsTrue(resCreate.Success && resCreate.Message == "Phone number already exists");
        }
Exemple #18
0
        public void TestCreateSameVatNumberProfile()
        {
            ContextSeeder.Seed();
            var bo        = new ProfileBusinessObject();
            var item      = bo.List().Result.First();
            var reg       = new Profile(item.VatNumber, "Manuel", "Macabres", 919191918, DateTime.UtcNow);
            var resCreate = bo.Create(reg);

            Assert.IsTrue(resCreate.Success && resCreate.Message == "Vat number already exists");
        }
        public void TestCreateAndReadBrandAsync()
        {
            ContextSeeder.Seed();
            var bo        = new BrandBusinessObject();
            var reg       = new Brand("Dona Ermelinda");
            var resCreate = bo.CreateAsync(reg).Result;
            var resGet    = bo.ReadAsync(reg.Id).Result;

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
        public void TestCreateSameNameBrand()
        {
            ContextSeeder.Seed();
            var bo        = new BrandBusinessObject();
            var item      = bo.List().Result.FirstOrDefault();
            var reg       = new Brand(item.Name);
            var resCreate = bo.Create(reg);

            Assert.IsTrue(!resCreate.Result);
        }
        public void TestCreateAndReadCompanyAsync()
        {
            ContextSeeder.Seed();
            var bo        = new CompanyBusinessObject();
            var reg       = new Company("Sonae", 1823445);
            var resCreate = bo.CreateAsync(reg).Result;
            var resGet    = bo.ReadAsync(reg.Id).Result;

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
        public void TestDeleteStoreQueueAsync()
        {
            ContextSeeder.Seed();
            var bo         = new StoreQueueBusinessObject();
            var stoQList   = bo.ListAsync().Result;
            var stoQDelete = bo.DeleteAsync(stoQList.Result.First().Id).Result;

            stoQList = bo.ListNotDeletedAsync().Result;
            Assert.IsTrue(stoQDelete.Success && stoQList.Success && stoQList.Result.Count == 0);
        }
Exemple #23
0
        public void TestCreateAndReadEssentialGoods()
        {
            ContextSeeder.Seed();
            var bo        = new EssentialGoodBusinessObject();
            var reg       = new EssentialGood("Lisboa");
            var resCreate = bo.Create(reg);
            var resGet    = bo.Read(reg.Id);

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
Exemple #24
0
        public void TestDeleteEstablishmentAsync()
        {
            ContextSeeder.Seed();
            var bo        = new EstablishmentBusinessObject();
            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 TestCreateSameNameRegionAsync()
        {
            ContextSeeder.Seed();
            var bo        = new RegionBusinessObject();
            var item      = bo.ListAsync().Result.Result.FirstOrDefault();
            var reg       = new Region(item.Name);
            var resCreate = bo.CreateAsync(reg).Result;

            Assert.IsTrue(resCreate.Success);
        }
        public void TestDeleteProductModel()
        {
            ContextSeeder.Seed();
            var bo         = new ProductModelBusinessObject();
            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);
        }
Exemple #27
0
        public void TestCreateAndReadProfileAsync()
        {
            ContextSeeder.Seed();
            var bo        = new ProfileBusinessObject();
            var reg       = new Profile(123459789, "Manuel", "Macabres", 939191919, DateTime.UtcNow);
            var resCreate = bo.CreateAsync(reg).Result;

            var resGet = bo.ReadAsync(reg.Id).Result;

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
Exemple #28
0
        public void TestCreateAndReadShoppingBasketAsync()
        {
            ContextSeeder.Seed();
            var bo        = new ShoppingBasketBusinessObject();
            var pbo       = new ProfileBusinessObject();
            var pro       = pbo.ListAsync().Result.Result.FirstOrDefault();
            var sb        = new ShoppingBasket(pro.Id);
            var resCreate = bo.CreateAsync(sb).Result;
            var resGet    = bo.ReadAsync(sb.Id).Result;

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
        public void TestCreateAndReadStoreQueuesAsync()
        {
            ContextSeeder.Seed();
            var ebo       = new EstablishmentBusinessObject();
            var sbo       = new StoreQueueBusinessObject();
            var est       = ebo.List().Result.First();
            var reg       = new StoreQueue(2, est.Id);
            var resCreate = sbo.CreateAsync(reg).Result;
            var resGet    = sbo.ReadAsync(reg.Id).Result;

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
        public void TestDeleteCompany()
        {
            ContextSeeder.Seed();
            var bo  = new CompanyBusinessObject();
            var com = new Company("Sonae", 12345);

            bo.Create(com);

            var result = bo.Delete(com.Id);

            Assert.IsTrue(result.Success);
        }