public async Task Should_Success_Update_Data_Type_Transfer()
        {
            var dbContext    = _dbContext(GetCurrentMethod());
            var facade       = new GarmentUnitExpenditureNoteFacade(GetServiceProvider(), dbContext);
            var dataUtil     = this.dataUtil(facade, GetCurrentMethod());
            var dataTransfer = await dataUtil.GetTestDataAcc();

            var newData = dbContext.GarmentUnitExpenditureNotes
                          .AsNoTracking()
                          .Include(x => x.Items)
                          .Single(m => m.Id == dataTransfer.Id);

            newData.Items.First().IsSave   = true;
            var ResponseUpdateTypeTransfer = await facade.Update((int)newData.Id, newData);

            Assert.NotEqual(ResponseUpdateTypeTransfer, 0);
        }
Beispiel #2
0
        public async Task Should_Error_Update_Data_Type_DOCurrency()
        {
            var dbContext    = _dbContext(GetCurrentMethod());
            var facade       = new GarmentUnitExpenditureNoteFacade(GetServiceProvider(), dbContext);
            var dataUtil     = this.dataUtil(facade, GetCurrentMethod());
            var dataTransfer = await dataUtil.GetTestDataAcc();

            var newData = dbContext.GarmentUnitExpenditureNotes
                          .AsNoTracking()
                          .Include(x => x.Items)
                          .Single(m => m.Id == dataTransfer.Id);

            foreach (var garmentUnitExpenditureNoteItem in newData.Items)
            {
                var garmentUnitDeliveryOrderItem = dbContext.GarmentUnitDeliveryOrderItems.FirstOrDefault(s => s.Id == garmentUnitExpenditureNoteItem.UnitDOItemId);
                garmentUnitDeliveryOrderItem.DOCurrencyRate = 0;
            }

            newData.Items.First().IsSave = true;

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

            Assert.NotNull(e.Message);
        }