public async Task GetDataMonitoring()
        {
            InventoryWeavingDocumentUploadService service = new InventoryWeavingDocumentUploadService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));

            var data     = _dataUtilDoc(service).GetItemVM();
            var response = service.GetDataMonitoring("", null, null, 7);
        }
        public async Task GetExistingModel()
        {
            InventoryWeavingDocumentUploadService service = new InventoryWeavingDocumentUploadService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));

            var data     = _dataUtilDoc(service).GetNewData();
            var response = await service.GetExistingModel(new int[1]);
        }
        public void Should_Success_CheckNota()
        {
            InventoryWeavingDocumentUploadService service = new InventoryWeavingDocumentUploadService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            //Models.GarmentCurrency model = await DataUtil.GetTestDataAsync();
            List <InventoryWeavingDocumentCsvViewModel> CSV = new List <InventoryWeavingDocumentCsvViewModel>
            {
                new InventoryWeavingDocumentCsvViewModel
                {
                    ReferenceNo         = "referencce",
                    Construction        = "CD",
                    Grade               = "a",
                    Piece               = "1",
                    MaterialName        = "CD",
                    WovenType           = "a",
                    Yarn1               = "yarn1",
                    Yarn2               = "yarn2",
                    YarnType1           = "yt1",
                    YarnType2           = "yt2",
                    YarnOrigin1         = "yo1",
                    YarnOrigin2         = "yo2",
                    Width               = "1",
                    Qty                 = "1",
                    QtyPiece            = "1",
                    Barcode             = "barcode",
                    ProductionOrderDate = DateTime.Now,
                    ProductionOrderNo   = "a",
                }
            };

            var Response = service.checkNota(CSV);
            //Assert.NotNull(Response);
        }
        public async Task Should_Success_MapToModelUpdate()
        {
            InventoryWeavingDocumentUploadService service = new InventoryWeavingDocumentUploadService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));

            var data     = _dataUtilDoc(service).UpdateData();
            var Response = await service.MapToModelUpdate(data);

            //Assert.NotNull(Response);
        }
        public async Task Should_Success_ReadById()
        {
            InventoryWeavingDocumentUploadService service = new InventoryWeavingDocumentUploadService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));

            var data = _dataUtilDoc(service).GetTestData();

            var Response = service.ReadById(data.Result.Id);

            Assert.NotNull(Response);
        }
        public async Task Create_Success_Upload()
        {
            InventoryWeavingDocumentUploadService service = new InventoryWeavingDocumentUploadService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));

            var data = _dataUtilDoc(service).GetNewData();

            var Response = service.UploadData(data, "test");

            Assert.NotNull(Response);
        }
        public void Should_Success_ReadInputWeaving()
        {
            InventoryWeavingDocumentUploadService service = new InventoryWeavingDocumentUploadService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));

            var data = _dataUtilDoc(service).GetTestData();

            var Response = service.ReadInputWeaving("", null, null, 1, 25, "{}", 7);

            Assert.NotNull(Response);
        }
        public void Should_Succes_Create()
        {
            InventoryWeavingDocumentUploadService service = new InventoryWeavingDocumentUploadService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));

            InventoryWeavingDocumentAdjService serviceAdj = new InventoryWeavingDocumentAdjService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));

            var data     = _dataUtilDoc(service).GetNewDataAdj();
            var Response = serviceAdj.Create(data);

            Assert.NotNull(Response);
        }
        public void Should_success_GenerateExcel()
        {
            InventoryWeavingDocumentUploadService service = new InventoryWeavingDocumentUploadService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));

            var dataDoc = _dataUtilDoc(service).GetTestData();
            //var Responses =  Utilservice.Create(data);

            // var Service = new ReportGreigeWeavingPerGradeService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            var Response = service.GenerateExcel("", null, null, 7);

            Assert.IsType <System.IO.MemoryStream>(Response);
        }
Exemplo n.º 10
0
        public async Task Should_success_GetStock()
        {
            ReportGreigeWeavingPerGradeService    service    = new ReportGreigeWeavingPerGradeService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            InventoryWeavingDocumentUploadService serviceDoc = new InventoryWeavingDocumentUploadService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            InventoryWeavingDocumentDataUtils     dataDoc1   = new InventoryWeavingDocumentDataUtils(serviceDoc);

            var Utilservice = new ReportExpenseGreigeWeavingService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            var data        = _dataUtil(service, dataDoc1).GetTestData();

            var dataDoc = _dataUtilDoc(serviceDoc).GetTestData();
            //var Responses =  Utilservice.Create(data);

            var Service  = new ReportExpenseGreigeWeavingService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            var Response = Utilservice.GetReportExpense("PRODUKSI", DateTime.UtcNow, DateTime.UtcNow, 25, 1, "{}", 7);

            Assert.NotNull(Response);
        }
Exemplo n.º 11
0
        public void Should_success_GenerateExcel()
        {
            ReportGreigeWeavingPerGradeService    service    = new ReportGreigeWeavingPerGradeService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            InventoryWeavingDocumentUploadService serviceDoc = new InventoryWeavingDocumentUploadService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            InventoryWeavingDocumentDataUtils     dataDoc1   = new InventoryWeavingDocumentDataUtils(serviceDoc);

            var Utilservice = new ReportRecapStockGreigePerTypeService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            var data        = _dataUtil(service, dataDoc1).GetTestData();

            var dataDoc = _dataUtilDoc(serviceDoc).GetTestData();
            //var Responses =  Utilservice.Create(data);

            var Service  = new ReportGreigeWeavingPerGradeService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            var Response = Utilservice.GenerateExcel(DateTime.UtcNow, 7);

            Assert.IsType <System.IO.MemoryStream>(Response);
        }
        public void Should_Succes_GetMaterialItemList_NotNull_Material()
        {
            InventoryWeavingDocumentUploadService serviceDoc = new InventoryWeavingDocumentUploadService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            ReportGreigeWeavingPerGradeService    service    = new ReportGreigeWeavingPerGradeService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            InventoryWeavingDocumentAdjService    serviceAdj = new InventoryWeavingDocumentAdjService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            InventoryWeavingDocumentDataUtils     dataDoc1   = new InventoryWeavingDocumentDataUtils(serviceDoc);


            var data = _dataUtil(service, dataDoc1).GetTestData();

            //var dataDoc = _dataUtilDoc(serviceDoc).GetNewDataAdj();
            //var dataAdj = serviceAdj.Create(dataDoc);

            var Response = serviceAdj.GetMaterialItemList("Name");

            Assert.NotNull(Response);
        }
        public async void Should_Error_UploadValidate()
        {
            InventoryWeavingDocumentUploadService service = new InventoryWeavingDocumentUploadService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            //Models.GarmentCurrency model = await DataUtil.GetTestDataAsync();
            List <InventoryWeavingDocumentCsvViewModel> CSV = new List <InventoryWeavingDocumentCsvViewModel>
            {
                new InventoryWeavingDocumentCsvViewModel
                {
                    ReferenceNo  = "",
                    Construction = "",
                    Grade        = "",
                    Piece        = "",
                    MaterialName = "",
                    WovenType    = "",
                    Yarn1        = "",
                    Yarn2        = "",
                    YarnType1    = "",
                    YarnType2    = "",
                    YarnOrigin1  = "",
                    YarnOrigin2  = "",
                    Width        = "",
                    Qty          = "",
                    QtyPiece     = "",
                    Barcode      = "",
                    //ProductionOrderDate = DateTime.Now,
                    ProductionOrderNo = "",
                }
            };

            List <KeyValuePair <string, StringValues> > body     = new List <KeyValuePair <string, StringValues> >();
            KeyValuePair <string, StringValues>         keyValue = new KeyValuePair <string, StringValues>("date", "2020-01-10");

            body.Add(keyValue);

            var Response = service.UploadValidate(ref CSV, body);

            Assert.NotNull(Response);
        }
Exemplo n.º 14
0
 private InventoryWeavingDocumentDataUtils _dataUtilDoc(InventoryWeavingDocumentUploadService service)
 {
     GetServiceProvider();
     return(new InventoryWeavingDocumentDataUtils(service));
 }
Exemplo n.º 15
0
 public InventoryWeavingDocumentDataUtils(InventoryWeavingDocumentUploadService service)
 {
     Service = service;
 }
 public async Task Update_Error()
 {
     InventoryWeavingDocumentUploadService service = new InventoryWeavingDocumentUploadService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
     await Assert.ThrowsAnyAsync <Exception>(() => service.UpdateAsync(0, null));
 }
        public async Task Update_Success()
        {
            var serviceProvider = GetServiceProvider();

            var stockServiceMock = new Mock <IInventoryWeavingMovementService>();

            stockServiceMock.Setup(s => s.UpdateAsync(It.IsAny <InventoryWeavingMovement>()))
            .ReturnsAsync(1);

            serviceProvider
            .Setup(x => x.GetService(typeof(IInventoryWeavingMovementService)))
            .Returns(stockServiceMock.Object);

            serviceProvider
            .Setup(x => x.GetService(typeof(IHttpService)))
            .Returns(new HttpTestService());

            InventoryWeavingDocumentUploadService service = new InventoryWeavingDocumentUploadService(serviceProvider.Object, _dbContext(GetCurrentMethod()));

            var dataUtil = _dataUtilDoc(service);
            var oldData  = dataUtil.GetNewData();

            oldData.Items.Add(new InventoryWeavingDocumentItem
            {
                ProductOrderName           = "product2",
                ReferenceNo                = "referencce2",
                Construction               = "CD2",
                Grade                      = "A2",
                Piece                      = "12",
                MaterialName               = "CD2",
                WovenType                  = "",
                Yarn1                      = "yarn12",
                Yarn2                      = "yarn22",
                YarnType1                  = "yt12",
                YarnType2                  = "yt22",
                YarnOrigin1                = "yo12",
                YarnOrigin2                = "yo22",
                Width                      = "12",
                UomUnit                    = "MTR2",
                UomId                      = 2,
                Quantity                   = 2,
                QuantityPiece              = 2,
                ProductRemark              = "",
                Barcode                    = "barcode",
                ProductionOrderDate        = DateTime.Now,
                InventoryWeavingDocumentId = 1,
            });

            await service.Create(oldData);

            var newData = dataUtil.CopyData(oldData);

            //newData.ExpenditureDate = newData.ExpenditureDate.AddDays(-1);
            newData.Remark = "New" + newData.Remark;
            //newData.LocalSalesNoteNo = "New" + newData.LocalSalesNoteNo;
            var firsItem = newData.Items.First();

            firsItem.Quantity++;
            var lastItem = newData.Items.Last();

            lastItem.Id = 0;

            var result = await service.UpdateAsync(newData.Id, newData);

            Assert.NotEqual(0, result);
        }