示例#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);
        }
示例#2
0
        public void TestListProductUnitAsync()
        {
            ContextSeeder.Seed();
            var bo      = new ProductUnitBusinessObject();
            var resList = bo.ListAsync().Result;

            Assert.IsTrue(resList.Success && resList.Result.Count == 1);
        }
示例#3
0
        public void TestUpdateProductUnitAsync()
        {
            ContextSeeder.Seed();
            var bo      = new ProductUnitBusinessObject();
            var resList = bo.ListAsync().Result;
            var item    = resList.Result.FirstOrDefault();

            item.IsReserved = true;
            var resUpdate = bo.UpdateAsync(item).Result;

            resList = bo.ListNotDeletedAsync().Result;
            Assert.IsTrue(resList.Success && resUpdate.Success && resList.Result.First().IsReserved == true);
        }