Exemplo n.º 1
0
        public ActionResult Create([FromBody] ShoppingBasketViewModel vm)
        {
            var shoppingBasket = vm.ToShoppingBasket();
            var res            = _bo.Create(shoppingBasket);

            return(StatusCode(res.Success ? (int)HttpStatusCode.OK : (int)HttpStatusCode.InternalServerError));
        }
Exemplo n.º 2
0
        public void TestCreateAndReadShoppingBasket()
        {
            ContextSeeder.Seed();
            var bo        = new ShoppingBasketBusinessObject();
            var pbo       = new ProfileBusinessObject();
            var pro       = pbo.List().Result.FirstOrDefault();
            var com       = new ShoppingBasket(pro.Id);
            var resCreate = bo.Create(com);
            var resGet    = bo.Read(com.Id);

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
        public void TestCreateAndReadShoppingBasket()
        {
            ContextSeeder.Seed();
            var sbo       = new ShoppingBasketBusinessObject();
            var ebo       = new EstablishmentBusinessObject();
            var resList   = ebo.List();
            var item      = resList.Result.FirstOrDefault();
            var sb        = new ShoppingBasket(item.Id);
            var resCreate = sbo.Create(sb);
            var resGet    = sbo.Read(sb.Id);

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
Exemplo n.º 4
0
        public void TestDailyLimitAsync()
        {
            ContextSeeder.Seed();

            var boProf   = new ProfileBusinessObject();
            var profList = boProf.List().Result.First();

            var bo   = new ShoppingBasketBusinessObject();
            var res1 = new ShoppingBasket(profList.Id);
            var res2 = new ShoppingBasket(profList.Id);
            var res3 = new ShoppingBasket(profList.Id);
            var res4 = new ShoppingBasket(profList.Id);

            bo.Create(res1);
            bo.Create(res2);
            bo.Create(res3);
            bo.Create(res4);

            var reserves = bo.DayLimitReserveItemsAsync(res4.Id);

            Assert.IsTrue(reserves.Result.Success && !reserves.Result.Result);
        }