public void TestDeleteShoppingBasket()
        {
            ContextSeeder.Seed();
            var bo         = new ShoppingBasketBusinessObject();
            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);
        }
        public void TestListShoppingBasket()
        {
            ContextSeeder.Seed();
            var bo      = new ShoppingBasketBusinessObject();
            var resList = bo.List();

            Assert.IsTrue(resList.Success && resList.Result.Count == 1);
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
        public ActionResult <List <ShoppingBasketViewModel> > List()
        {
            var res = _bo.List();

            if (!res.Success)
            {
                return(StatusCode((int)HttpStatusCode.InternalServerError));
            }
            var list = new List <ShoppingBasketViewModel>();

            foreach (var item in res.Result)
            {
                list.Add(new ShoppingBasketViewModel {
                    Id = item.Id, ProfileId = item.ProfileId
                });
            }
            return(list);
        }
        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);
        }