Ejemplo n.º 1
0
        public async Task Should_Success_Master_Unit()
        {
            var dbContext          = _dbContext(GetCurrentMethod());
            var Facade             = new GarmentUnitExpenditureNoteFacade(GetServiceProvider(), _dbContext(GetCurrentMethod()));
            var modelLocalSupplier = await dataUtil(Facade, GetCurrentMethod()).GetNewData();

            var responseLocalSupplier = await Facade.Create(modelLocalSupplier);

            DataTable dataTable = new DataTable();

            dataTable.Columns.Add("UnitName", typeof(String));
            dataTable.Columns.Add("UnitCode", typeof(double));
            dataTable.Rows.Add("UnitName", "1");

            Mock <ILocalDbCashFlowDbContext> mockDbContext = new Mock <ILocalDbCashFlowDbContext>();

            mockDbContext.Setup(s => s.ExecuteReaderOnlyQuery(It.IsAny <string>()))
            .Returns(dataTable.CreateDataReader());
            mockDbContext.Setup(s => s.ExecuteReader(It.IsAny <string>(), It.IsAny <List <SqlParameter> >()))
            .Returns(dataTable.CreateDataReader());

            var reportService = new GarmentReportCMTFacade(GetServiceProvider(), _dbContext(GetCurrentMethod()), mockDbContext.Object);
            var dateTo        = DateTime.UtcNow.AddDays(1);
            var dateFrom      = dateTo.AddDays(-30);
            var results       = reportService.Read(1, 25, "", "UnitName", "");



            Assert.NotNull(results);
        }
Ejemplo n.º 2
0
        public async Task Should_Success_Update_Data_Type_Transfer_null_Summary()
        {
            var dbContext    = _dbContext(GetCurrentMethod());
            var facade       = new GarmentUnitExpenditureNoteFacade(GetServiceProvider(), dbContext);
            var dataUtil     = this.dataUtil(facade, GetCurrentMethod());
            var dataTransfer = await dataUtil.GetTestDataWithStorageReqeust();

            var newData2 = new GarmentUnitExpenditureNote
            {
                Id    = dataTransfer.Id,
                Items = new List <GarmentUnitExpenditureNoteItem>
                {
                    new GarmentUnitExpenditureNoteItem
                    {
                        Id = dataTransfer.Items.First().Id
                    }
                }
            };

            foreach (var item in dataTransfer.Items)
            {
                item.Quantity = 1;
            }

            var ResponseUpdate2 = await facade.Update((int)dataTransfer.Id, dataTransfer);

            Assert.NotEqual(ResponseUpdate2, 0);
        }
        private GarmentUnitReceiptNoteDataUtil dataUtil(GarmentUnitReceiptNoteFacade facade, string testName)
        {
            var garmentPurchaseRequestFacade   = new GarmentPurchaseRequestFacade(GetServiceProvider(), _dbContext(testName));
            var garmentPurchaseRequestDataUtil = new GarmentPurchaseRequestDataUtil(garmentPurchaseRequestFacade);

            var garmentInternalPurchaseOrderFacade   = new GarmentInternalPurchaseOrderFacade(_dbContext(testName));
            var garmentInternalPurchaseOrderDataUtil = new GarmentInternalPurchaseOrderDataUtil(garmentInternalPurchaseOrderFacade, garmentPurchaseRequestDataUtil);

            var garmentExternalPurchaseOrderFacade   = new GarmentExternalPurchaseOrderFacade(GetServiceProvider(), _dbContext(testName));
            var garmentExternalPurchaseOrderDataUtil = new GarmentExternalPurchaseOrderDataUtil(garmentExternalPurchaseOrderFacade, garmentInternalPurchaseOrderDataUtil);

            var garmentDeliveryOrderFacade   = new GarmentDeliveryOrderFacade(GetServiceProvider(), _dbContext(testName));
            var garmentDeliveryOrderDataUtil = new GarmentDeliveryOrderDataUtil(garmentDeliveryOrderFacade, garmentExternalPurchaseOrderDataUtil);

            var garmentUnitReceiptNoteFacade   = new GarmentUnitReceiptNoteFacade(GetServiceProvider(), _dbContext(testName));
            var garmentUnitReceiptNoteDatautil = new GarmentUnitReceiptNoteDataUtil(garmentUnitReceiptNoteFacade, garmentDeliveryOrderDataUtil, null);

            var garmentUnitDeliveryOrderFacade   = new GarmentUnitDeliveryOrderFacade(_dbContext(testName), GetServiceProvider());
            var garmentUnitDeliveryOrderDatautil = new GarmentUnitDeliveryOrderDataUtil(garmentUnitDeliveryOrderFacade, garmentUnitReceiptNoteDatautil);

            var garmentUENFacade = new GarmentUnitExpenditureNoteFacade(GetServiceProvider(), _dbContext(testName));
            var dataUtilUEN      = new GarmentUnitExpenditureNoteDataUtil(garmentUENFacade, garmentUnitDeliveryOrderDatautil);

            return(new GarmentUnitReceiptNoteDataUtil(facade, garmentDeliveryOrderDataUtil, dataUtilUEN));
        }
Ejemplo n.º 4
0
        public async Task Should_Success_Delete_Data()
        {
            var facade = new GarmentUnitExpenditureNoteFacade(GetServiceProvider(), _dbContext(GetCurrentMethod()));
            var data   = await dataUtil(facade, GetCurrentMethod()).GetTestData();

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

            Assert.NotEqual(Response, 0);
        }
Ejemplo n.º 5
0
        public async Task Should_Error_Delete_Data_Invalid_Id()
        {
            var facade = new GarmentUnitExpenditureNoteFacade(GetServiceProvider(), _dbContext(GetCurrentMethod()));
            var data   = await dataUtil(facade, GetCurrentMethod()).GetTestData();

            Exception e = await Assert.ThrowsAsync <Exception>(async() => await facade.Delete(0));

            Assert.NotNull(e.Message);
        }
Ejemplo n.º 6
0
        public async Task Should_Success_Create_Data_Type_Transfer()
        {
            var facade = new GarmentUnitExpenditureNoteFacade(GetServiceProvider(), _dbContext(GetCurrentMethod()));
            var data   = await dataUtil(facade, GetCurrentMethod()).GetNewDataTypeTransfer();

            var Response = await facade.Create(data);

            Assert.NotEqual(Response, 0);
        }
Ejemplo n.º 7
0
        public async Task Should_Success_Get_All_Data_For_Preparing()
        {
            var facade = new GarmentUnitExpenditureNoteFacade(GetServiceProvider(), _dbContext(GetCurrentMethod()));
            var data   = await dataUtil(facade, GetCurrentMethod()).GetTestDataForPreparing();

            var Response = facade.ReadForGPreparing();

            Assert.NotEqual(Response.Data.Count, 0);
        }
Ejemplo n.º 8
0
        public async Task Should_Success_Create_Data_Null_Summary()
        {
            var facade = new GarmentUnitExpenditureNoteFacade(GetServiceProvider(), _dbContext(GetCurrentMethod()));
            var data   = await dataUtil(facade, GetCurrentMethod()).GetNewDataWithStorage();

            var Response = await facade.Create(data);

            Assert.NotEqual(0, Response);
        }
Ejemplo n.º 9
0
        public async Task Should_Success_Get_UEN_Data_By_Id()
        {
            var facade = new GarmentUnitExpenditureNoteFacade(GetServiceProvider(), _dbContext(GetCurrentMethod()));
            var data   = await dataUtil(facade, GetCurrentMethod()).GetTestDataAcc();

            var Response = facade.ReadByUENId((int)data.Id);

            Assert.NotEqual(0, Response.Id);
        }
Ejemplo n.º 10
0
        public async Task Should_Success_Get_All_Data()
        {
            var facade = new GarmentUnitExpenditureNoteFacade(GetServiceProvider(), _dbContext(GetCurrentMethod()));
            var data   = await dataUtil(facade, GetCurrentMethod()).GetTestData();

            var Response = facade.Read();

            Assert.NotEmpty(Response.Data);
        }
        public async Task Should_Error_Get_Data_By_Id()
        {
            var facade = new GarmentUnitExpenditureNoteFacade(GetServiceProvider(), _dbContext(GetCurrentMethod()));
            var data   = await dataUtil(facade, GetCurrentMethod()).GetTestDataAcc();

            var Response = facade.GetROAsalById((int)data.Id);

            Assert.NotEqual(0, Response.DetailExpenditureId);
        }
Ejemplo n.º 12
0
        public async Task Should_Success_Get_Monitoring_Out()
        {
            var dbContext = _dbContext(GetCurrentMethod());
            var facade    = new GarmentUnitExpenditureNoteFacade(GetServiceProvider(), _dbContext(GetCurrentMethod()));
            var data      = await dataUtil(facade, GetCurrentMethod()).GetTestDataWithStorage();

            var Response = facade.GetReportOut(null, null, "", 1, 25, "{}", 7);

            Assert.NotNull(Response.Item1);
        }
Ejemplo n.º 13
0
        public async Task Should_Success_Get_Excel_Monitoring_Out()
        {
            var dbContext = _dbContext(GetCurrentMethod());
            var facade    = new GarmentUnitExpenditureNoteFacade(GetServiceProvider(), _dbContext(GetCurrentMethod()));
            var data      = await dataUtil(facade, GetCurrentMethod()).GetTestDataWithStorage();

            var Response = facade.GenerateExcelMonOut(null, null, "", 7);

            Assert.IsType <MemoryStream>(Response);
        }
Ejemplo n.º 14
0
        public async Task Should_Error_Create_Data_Null_Items()
        {
            var facade = new GarmentUnitExpenditureNoteFacade(GetServiceProvider(), _dbContext(GetCurrentMethod()));
            var data   = await dataUtil(facade, GetCurrentMethod()).GetNewData();

            data.Items = null;
            Exception e = await Assert.ThrowsAsync <Exception>(async() => await facade.Create(data));

            Assert.NotNull(e.Message);
        }
Ejemplo n.º 15
0
        public async Task Should_Error_Get_Data_By_Id()
        {
            var dbString = GetCurrentMethod() + "Task Should_Error_Get_Data_By_Id";
            var facade   = new GarmentUnitExpenditureNoteFacade(GetServiceProvider(), _dbContext(dbString));
            var data     = await dataUtil(facade, dbString).GetTestDataAcc();

            //var Response = facade.GetROAsalById((int)data.Id);

            Assert.Throws <System.InvalidOperationException> (() => facade.GetROAsalById((int)data.Id));
            //   Assert.NotEqual(0, Response.DetailExpenditureId);
        }
Ejemplo n.º 16
0
        public async Task Should_Success_Create_Data_one_Item()
        {
            var facade = new GarmentUnitExpenditureNoteFacade(GetServiceProvider(), _dbContext(GetCurrentMethod()));
            var data   = await dataUtil(facade, GetCurrentMethod()).GetNewData();

            //List<GarmentUnitExpenditureNoteItem> items = new List<GarmentUnitExpenditureNoteItem>();
            //items.Add(data.Items.First());
            //data.Items = items;
            data.Items.First().IsSave = false;
            var Response = await facade.Create(data);

            Assert.NotEqual(Response, 0);
        }
Ejemplo n.º 17
0
        public async Task Should_Error_Update_Data_Null_Items()
        {
            var dbContext = _dbContext(GetCurrentMethod());
            var facade    = new GarmentUnitExpenditureNoteFacade(GetServiceProvider(), dbContext);

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

            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);
        }
Ejemplo n.º 18
0
        public async void Should_Success_Patch_One()
        {
            GarmentUnitExpenditureNoteFacade facade = new GarmentUnitExpenditureNoteFacade(GetServiceProvider(), _dbContext(GetCurrentMethod()));
            var dataUtil = this.dataUtil(facade, GetCurrentMethod());
            var model    = await dataUtil.GetTestData();

            JsonPatchDocument <GarmentUnitExpenditureNote> jsonPatch = new JsonPatchDocument <GarmentUnitExpenditureNote>();

            jsonPatch.Replace(m => m.IsPreparing, true);

            var Response = await facade.PatchOne(model.Id, jsonPatch);

            Assert.NotEqual(0, Response);
        }
Ejemplo n.º 19
0
        public async void Should_Error_Patch_One()
        {
            GarmentUnitExpenditureNoteFacade facade = new GarmentUnitExpenditureNoteFacade(GetServiceProvider(), _dbContext(GetCurrentMethod()));
            var dataUtil = this.dataUtil(facade, GetCurrentMethod());
            var model    = await dataUtil.GetTestData();

            JsonPatchDocument <GarmentUnitExpenditureNote> jsonPatch = new JsonPatchDocument <GarmentUnitExpenditureNote>();

            jsonPatch.Replace(m => m.Id, 0);

            var Response = await Assert.ThrowsAnyAsync <Exception>(async() => await facade.PatchOne(model.Id, jsonPatch));

            Assert.NotNull(Response.Message);
        }
Ejemplo n.º 20
0
        public async Task Should_Error_Create_Data_DOCurrency()
        {
            var dbContext = _dbContext(GetCurrentMethod());
            var facade    = new GarmentUnitExpenditureNoteFacade(GetServiceProvider(), dbContext);
            var data      = await dataUtil(facade, GetCurrentMethod()).GetNewDataTypeTransfer();

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

            Exception e = await Assert.ThrowsAsync <Exception>(async() => await facade.Create(data));

            Assert.NotNull(e.Message);
        }
Ejemplo n.º 21
0
        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);
        }
Ejemplo n.º 22
0
        public async Task Should_Success_GetXLS_Flow_Detail_NUll_Result()
        {
            var dbContext          = _dbContext(GetCurrentMethod());
            var Facade             = new GarmentUnitExpenditureNoteFacade(GetServiceProvider(), _dbContext(GetCurrentMethod()));
            var modelLocalSupplier = await dataUtil(Facade, GetCurrentMethod()).GetNewData();

            var responseLocalSupplier = await Facade.Create(modelLocalSupplier);

            var reportService = new GarmentFlowDetailMaterialReportFacade(GetServiceProvider(), _dbContext(GetCurrentMethod()));
            var dateTo        = DateTime.UtcNow.AddDays(1);
            var dateFrom      = dateTo.AddDays(-30);
            var results       = reportService.GenerateExcel("BB", "", "", "", "", dateFrom, dateTo, 0);



            Assert.NotNull(results);
        }
        public async Task Should_Success_Update_Data_For_DeliveryReturn()
        {
            var dbContext = _dbContext(GetCurrentMethod());
            var facade    = new GarmentUnitExpenditureNoteFacade(GetServiceProvider(), dbContext);
            var dataUtil  = this.dataUtil(facade, GetCurrentMethod());
            var data      = await dataUtil.GetTestData();

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

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

            var ResponseUpdate = await facade.UpdateReturQuantity((int)newData.Id, 1);

            Assert.NotEqual(ResponseUpdate, 0);
        }
Ejemplo n.º 24
0
        public async Task Should_Success_GetReport_CMT_Report()
        {
            var dbContext          = _dbContext(GetCurrentMethod());
            var Facade             = new GarmentUnitExpenditureNoteFacade(GetServiceProvider(), _dbContext(GetCurrentMethod()));
            var modelLocalSupplier = await dataUtil(Facade, GetCurrentMethod()).GetNewDataForPreparing();

            var responseLocalSupplier = await Facade.Create(modelLocalSupplier);

            //long nowTicks = DateTimeOffset.Now.Ticks;
            //string nowTicksA = $"{nowTicks}a";
            //string RONo = $"RO{nowTicksA}";
            string    RO        = modelLocalSupplier.Items.FirstOrDefault().RONo;
            DataTable dataTable = new DataTable();

            dataTable.Columns.Add("Invoice", typeof(String));
            dataTable.Columns.Add("ExpenditureGoodId", typeof(String));
            dataTable.Columns.Add("RO", typeof(String));
            dataTable.Columns.Add("Article", typeof(String));
            dataTable.Columns.Add("qtyBJ", typeof(double));
            dataTable.Rows.Add("", "", RO, "", 0);

            Mock <ILocalDbCashFlowDbContext> mockDbContext = new Mock <ILocalDbCashFlowDbContext>();

            mockDbContext.Setup(s => s.ExecuteReaderOnlyQuery(It.IsAny <string>()))
            .Returns(dataTable.CreateDataReader());
            mockDbContext.Setup(s => s.ExecuteReader(It.IsAny <string>(), It.IsAny <List <SqlParameter> >()))
            .Returns(dataTable.CreateDataReader());

            var reportService = new GarmentReportCMTFacade(GetServiceProvider(), _dbContext(GetCurrentMethod()), mockDbContext.Object);
            var dateTo        = DateTime.UtcNow.AddDays(1);
            var dateFrom      = dateTo.AddDays(-30);
            var results       = reportService.GetReport(dateFrom, dateTo, 0, 1, 25, "", 0);



            Assert.NotNull(results.Item1);
        }
Ejemplo n.º 25
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);
        }
 public GarmentUnitExpenditureNoteDataUtil(GarmentUnitExpenditureNoteFacade facade, GarmentUnitDeliveryOrderDataUtil garmentUnitDeliveryOrderDataUtil)
 {
     this.facade = facade;
     this.garmentUnitDeliveryOrderDataUtil = garmentUnitDeliveryOrderDataUtil;
 }
Ejemplo n.º 27
0
        public async Task Should_Success_Validate_Data()
        {
            GarmentUnitExpenditureNoteViewModel viewModel = new GarmentUnitExpenditureNoteViewModel {
            };

            Assert.True(viewModel.Validate(null).Count() > 0);

            GarmentUnitExpenditureNoteViewModel viewModelCheckExpenditureDate = new GarmentUnitExpenditureNoteViewModel
            {
                ExpenditureDate = DateTimeOffset.Now
            };

            Assert.True(viewModelCheckExpenditureDate.Validate(null).Count() > 0);

            GarmentUnitExpenditureNoteViewModel viewModelCheckUnitDeliveryOrder = new GarmentUnitExpenditureNoteViewModel
            {
                ExpenditureDate = DateTimeOffset.Now,
                UnitDONo        = "UnitDONO123",
            };

            Assert.True(viewModelCheckUnitDeliveryOrder.Validate(null).Count() > 0);

            GarmentUnitExpenditureNoteViewModel viewModelCheckItemsCount = new GarmentUnitExpenditureNoteViewModel {
                UnitDOId = 1
            };

            Assert.True(viewModelCheckItemsCount.Validate(null).Count() > 0);

            Mock <IGarmentUnitDeliveryOrderFacade> garmentUnitDeliveryOrderFacadeMock = new Mock <IGarmentUnitDeliveryOrderFacade>();

            Mock <IGarmentUnitExpenditureNoteFacade> garmentUnitExpenditureNoteFacadeMock = new Mock <IGarmentUnitExpenditureNoteFacade>();

            garmentUnitDeliveryOrderFacadeMock.Setup(s => s.ReadById(It.IsAny <int>()))
            .Returns(new GarmentUnitDeliveryOrder {
                Id = 1,

                Items = new List <GarmentUnitDeliveryOrderItem>
                {
                    new GarmentUnitDeliveryOrderItem
                    {
                        Id       = 1,
                        Quantity = 4
                    },
                }
            });

            var facade = new GarmentUnitExpenditureNoteFacade(GetServiceProvider(), _dbContext(GetCurrentMethod()));
            Mock <IServiceProvider> serviceProvider = new Mock <IServiceProvider>();

            serviceProvider.
            Setup(x => x.GetService(typeof(IGarmentUnitDeliveryOrderFacade)))
            .Returns(garmentUnitDeliveryOrderFacadeMock.Object);
            serviceProvider.Setup(x => x.GetService(typeof(PurchasingDbContext)))
            .Returns(_dbContext(GetCurrentMethod()));
            var data = await dataUtil(facade, GetCurrentMethod()).GetTestData();

            var item = data.Items.First();
            var garmentUnitExpenditureNote = new GarmentUnitExpenditureNoteViewModel
            {
                UnitDOId = 1,
                Items    = new List <GarmentUnitExpenditureNoteItemViewModel>
                {
                    new GarmentUnitExpenditureNoteItemViewModel
                    {
                        Id           = item.Id,
                        UnitDOItemId = 1,
                        Quantity     = 10,
                        IsSave       = true,
                    },

                    new GarmentUnitExpenditureNoteItemViewModel
                    {
                        Id           = item.Id,
                        UnitDOItemId = 1,
                        Quantity     = 100,
                        IsSave       = true,
                    },

                    new GarmentUnitExpenditureNoteItemViewModel
                    {
                        Id           = item.Id,
                        UnitDOItemId = 1,
                        Quantity     = 0,
                        IsSave       = true
                    },
                }
            };

            Mock <IGarmentUnitExpenditureNoteFacade> garmentUnitExpenditreMock = new Mock <IGarmentUnitExpenditureNoteFacade>();

            garmentUnitExpenditreMock.Setup(s => s.ReadById(1))
            .Returns(garmentUnitExpenditureNote);
            garmentUnitExpenditreMock.Setup(s => s.ReadById(It.IsAny <int>()))
            .Returns(garmentUnitExpenditureNote);

            serviceProvider.
            Setup(x => x.GetService(typeof(IGarmentUnitExpenditureNoteFacade)))
            .Returns(garmentUnitExpenditreMock.Object);
            System.ComponentModel.DataAnnotations.ValidationContext garmentUnitDeliveryOrderValidate = new System.ComponentModel.DataAnnotations.ValidationContext(garmentUnitExpenditureNote, serviceProvider.Object, null);
            Assert.True(garmentUnitExpenditureNote.Validate(garmentUnitDeliveryOrderValidate).Count() > 0);
        }
Ejemplo n.º 28
0
        public async Task Should_Success_Create_Data_External()
        {
            var facade = new GarmentUnitExpenditureNoteFacade(GetServiceProvider(), _dbContext(GetCurrentMethod()));
            var data   = await dataUtil(facade, GetCurrentMethod()).GetNewData();

            data.ExpenditureType = "EXTERNAL";
            var Response = await facade.Create(data);

            Assert.NotEqual(Response, 0);

            // var datas = await dataUtil(facade, GetCurrentMethod()).GetTestData();
            //var Response = facade.ReadById((int)data.Id);

            //var dbContext = _dbContext(GetCurrentMethod());
            //var newData = dbContext.GarmentUnitExpenditureNotes
            //    .AsNoTracking()
            //    .Include(x => x.Items)
            //    .Single(m => m.Id == data.Id);

            //List<GarmentUnitExpenditureNoteItem> items = new List<GarmentUnitExpenditureNoteItem>();
            //foreach (var item in newData.Items)
            //{
            //    var i = new GarmentUnitExpenditureNoteItem
            //    {
            //        IsSave = true,
            //        DODetailId = item.DODetailId,

            //        EPOItemId = item.EPOItemId,

            //        URNItemId = item.URNItemId,
            //        UnitDOItemId = item.Id,
            //        PRItemId = item.PRItemId,

            //        FabricType = item.FabricType,
            //        POItemId = item.POItemId,
            //        POSerialNumber = item.POSerialNumber,

            //        ProductId = item.ProductId,
            //        ProductCode = item.ProductCode,
            //        ProductName = item.ProductName,
            //        ProductRemark = item.ProductRemark,
            //        Quantity = 5,

            //        RONo = item.RONo,

            //        UomId = item.UomId,
            //        UomUnit = item.UomUnit,

            //        PricePerDealUnit = item.PricePerDealUnit,
            //        DOCurrencyRate = item.DOCurrencyRate,
            //        Conversion = 1,
            //    };
            //    items.Add(i);
            //}

            //var data2 = new GarmentUnitExpenditureNote
            //{
            //    UnitSenderId = newData.UnitSenderId,
            //    UnitSenderCode = newData.UnitSenderCode,
            //    UnitSenderName = newData.UnitSenderName,

            //    UnitRequestId = newData.UnitRequestId,
            //    UnitRequestCode = newData.UnitRequestCode,
            //    UnitRequestName = newData.UnitRequestName,

            //    UnitDOId = newData.UnitDOId,
            //    UnitDONo = newData.UnitDONo,

            //    StorageId = newData.StorageId,
            //    StorageCode = newData.StorageCode,
            //    StorageName = newData.StorageName,

            //    StorageRequestId = newData.StorageRequestId,
            //    StorageRequestCode = newData.StorageRequestCode,
            //    StorageRequestName = newData.StorageRequestName,

            //    ExpenditureType = "EXTERNAL",
            //    ExpenditureTo = "EXTERNAL",
            //    UENNo = "UENNO12345",

            //    ExpenditureDate = DateTimeOffset.Now,

            //    IsPreparing = false,
            //    Items = items

            //};

            //var Response2 = await facade.Create(data2);

            //Assert.NotEqual(Response2, 0);
        }