Exemple #1
0
        public async Task Should_Success_Update_Data()
        {
            GarmentPurchaseRequestFacade facade = new GarmentPurchaseRequestFacade(_dbContext(GetCurrentMethod()));
            var model = await dataUtil(facade, GetCurrentMethod()).GetTestData();

            var item = model.Items.First();

            model.Items.Add(new GarmentPurchaseRequestItem
            {
                PO_SerialNumber = item.PO_SerialNumber,
                ProductId       = item.ProductId,
                ProductCode     = item.ProductCode,
                ProductName     = item.ProductName,
                Quantity        = item.Quantity,
                BudgetPrice     = item.BudgetPrice,
                UomId           = item.UomId,
                UomUnit         = item.UomUnit,
                CategoryId      = item.CategoryId,
                CategoryName    = item.CategoryName,
                ProductRemark   = item.ProductRemark,
                Status          = item.Status,
            });

            var Response = await facade.Update((int)model.Id, model, USERNAME);

            Assert.NotEqual(Response, 0);
        }
Exemple #2
0
        public async Task Should_Success_Update_Data()
        {
            GarmentPurchaseRequestFacade facade = new GarmentPurchaseRequestFacade(ServiceProvider, _dbContext(GetCurrentMethod()));
            var dataUtil = this.dataUtil(facade, GetCurrentMethod());
            var model    = await dataUtil.GetTestData();

            GarmentPurchaseRequest newModel = dataUtil.CopyData(model);

            newModel.Items = new List <GarmentPurchaseRequestItem>();
            foreach (var item in model.Items)
            {
                newModel.Items.Add(dataUtil.CopyDataItem(item));
            }
            var firstItem = newModel.Items.First();

            firstItem.Id = 0;
            firstItem.PO_SerialNumber = null;

            var Response = await facade.Update((int)newModel.Id, newModel, USERNAME);

            Assert.NotEqual(Response, 0);
        }
Exemple #3
0
        public async Task Should_Error_Update_Data()
        {
            GarmentPurchaseRequestFacade facade = new GarmentPurchaseRequestFacade(ServiceProvider, _dbContext(GetCurrentMethod()));
            var model = await dataUtil(facade, GetCurrentMethod()).GetTestData();

            Exception errorInvalidId = await Assert.ThrowsAsync <Exception>(async() => await facade.Update(0, model, USERNAME));

            Assert.NotNull(errorInvalidId.Message);

            GarmentPurchaseRequest newModel = new GarmentPurchaseRequest();
            Exception errorNullItems        = await Assert.ThrowsAsync <Exception>(async() => await facade.Update((int)model.Id, newModel, USERNAME));

            Assert.NotNull(errorNullItems.Message);
        }