public void TestListShoppingBasketAsync()
        {
            ContextSeeder.Seed();
            var bo      = new ShoppingBasketBusinessObject();
            var resList = bo.ListAsync().Result;

            Assert.IsTrue(resList.Success && resList.Result.Count == 1);
        }
        public void TestDeleteEstablishmentAsync()
        {
            ContextSeeder.Seed();
            var bo        = new ShoppingBasketBusinessObject();
            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);
        }
Exemplo n.º 3
0
        public void TestUpdateShoppingBasketAsync()
        {
            ContextSeeder.Seed();
            var bo      = new ShoppingBasketBusinessObject();
            var resList = bo.ListAsync().Result;
            var item    = resList.Result.FirstOrDefault();
            var pbo     = new ProfileBusinessObject();
            var pro     = pbo.List().Result.FirstOrDefault();

            item.ProfileId = pro.Id;
            var resUpdate = bo.UpdateAsync(item).Result;

            resList = bo.ListNotDeletedAsync().Result;
            Assert.IsTrue(resList.Success && resUpdate.Success && resList.Result.First().ProfileId == pro.Id);
        }
        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);
        }