public async void Should_Success_Update_Data()
        {
            var dbContext = _dbContext(GetCurrentMethod());
            var facade    = new GarmentUnitReceiptNoteFacade(GetServiceProvider(), dbContext);

            var dataUtil = this.dataUtil(facade, GetCurrentMethod());
            var data     = await dataUtil.GetTestDataWithStorage();

            dataUtil.SetDataWithStorage(data);
            var ResponseUpdateStorage = await facade.Update((int)data.Id, data);

            Assert.NotEqual(ResponseUpdateStorage, 0);

            // Create Storage based on UnitId that contain longTick on create DataUtil
            dataUtil.SetDataWithStorage(data, data.UnitId);
            var ResponseRestoreStorage = await facade.Update((int)data.Id, data);

            Assert.NotEqual(ResponseRestoreStorage, 0);

            data.IsStorage = false;
            var ResponseDeleteStorage = await facade.Update((int)data.Id, data);

            Assert.NotEqual(ResponseDeleteStorage, 0);

            dataUtil.SetDataWithStorage(data);
            var ResponseAddStorage = await facade.Update((int)data.Id, data);

            Assert.NotEqual(ResponseAddStorage, 0);
        }
        public async Task Should_Success_Update_Data()
        {
            var dbContext = _dbContext(GetCurrentMethod());
            var facade    = new GarmentUnitReceiptNoteFacade(GetServiceProvider(), dbContext);

            var dataUtil = this.dataUtil(facade, GetCurrentMethod());
            var data     = await dataUtil.GetTestDataWithStorage();

            dbContext.Entry(data).State = EntityState.Detached;
            foreach (var item in data.Items)
            {
                dbContext.Entry(item).State = EntityState.Detached;
            }

            dataUtil.SetDataWithStorage(data);
            var ResponseUpdateStorage = await facade.Update((int)data.Id, data);

            Assert.NotEqual(ResponseUpdateStorage, 0);

            //// Create Storage based on UnitId that contain longTick on create DataUtil
            //dataUtil.SetDataWithStorage(data, data.UnitId);
            //var ResponseRestoreStorage = await facade.Update((int)data.Id, data);
            //Assert.NotEqual(ResponseRestoreStorage, 0);

            //data.IsStorage = false;
            //var ResponseDeleteStorage = await facade.Update((int)data.Id, data);
            //Assert.NotEqual(ResponseDeleteStorage, 0);

            //dataUtil.SetDataWithStorage(data);
            //var ResponseAddStorage = await facade.Update((int)data.Id, data);
            //Assert.NotEqual(ResponseAddStorage, 0);
        }
        public async Task Should_Error_Update_Data()
        {
            var dbContext = _dbContext(GetCurrentMethod());
            var facade    = new GarmentUnitReceiptNoteFacade(GetServiceProvider(), dbContext);

            Exception e = await Assert.ThrowsAsync <Exception>(async() => await facade.Update(0, new GarmentUnitReceiptNote()));

            Assert.NotNull(e.Message);
        }
Exemple #4
0
        public async void Should_Error_Update_Data_Null_Items()
        {
            var dbContext = _dbContext(GetCurrentMethod());
            var facade    = new GarmentUnitReceiptNoteFacade(GetServiceProvider(), dbContext);

            var data = await dataUtil(facade, GetCurrentMethod()).GetTestDataWithStorage();

            dbContext.Entry(data).State = EntityState.Detached;
            data.Items = null;

            Exception e = await Assert.ThrowsAsync <Exception>(async() => await facade.Update((int)data.Id, data));

            Assert.NotNull(e.Message);
        }
Exemple #5
0
        public async void Should_Success_Update_Data()
        {
            var dbContext = _dbContext(GetCurrentMethod());
            var facade    = new GarmentUnitReceiptNoteFacade(GetServiceProvider(), dbContext);

            var data = await dataUtil(facade, GetCurrentMethod()).GetTestDataWithStorage();

            dbContext.Entry(data).State = EntityState.Detached;
            foreach (var item in data.Items)
            {
                dbContext.Entry(item).State = EntityState.Detached;
            }

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

            Assert.NotEqual(Response, 0);
        }