Esempio n. 1
0
        public async Task <GarmentDeliveryOrder> GetTestData()
        {
            var data = GetNewData();
            await facade.Create(data, "Unit Test");

            return(data);
        }
Esempio n. 2
0
        public async Task Should_Success_Get_Report_AccuracyDelivery_Excel()
        {
            GarmentDeliveryOrderFacade facade = new GarmentDeliveryOrderFacade(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            var data = await dataUtil(facade, GetCurrentMethod()).GetNewData3();

            await facade.Create(data, USERNAME);

            var data2 = await dataUtil(facade, GetCurrentMethod()).GetNewData3();

            data2.DODate = DateTimeOffset.Now.AddDays(10);
            foreach (var item in data2.Items)
            {
                foreach (var detail in item.Details)
                {
                    detail.ProductCode = "SUB";
                }
            }
            await facade.Create(data2, USERNAME);

            var data3 = await dataUtil(facade, GetCurrentMethod()).GetNewData3();

            data3.DODate = DateTimeOffset.Now.AddDays(10);
            foreach (var item in data3.Items)
            {
                foreach (var detail in item.Details)
                {
                    detail.ProductCode = "SUB";
                }
            }
            await facade.Create(data3, USERNAME);

            var data4 = await dataUtil(facade, GetCurrentMethod()).GetNewData3();

            data4.DODate = DateTimeOffset.Now.AddDays(10);
            foreach (var item in data4.Items)
            {
                foreach (var detail in item.Details)
                {
                    detail.ProductCode = "LBL";
                }
            }
            await facade.Create(data4, USERNAME);

            var Facade   = new GarmentDeliveryOrderFacade(ServiceProvider, _dbContext(GetCurrentMethod()));
            var Response = Facade.GenerateExcelDeliveryHeader(null, null, 7);

            Assert.IsType(typeof(System.IO.MemoryStream), Response);

            long   nowTicks  = DateTimeOffset.Now.Ticks;
            string nowTicksA = $"{nowTicks}a";
            var    Response1 = Facade.GenerateExcelDeliveryDetail($"BuyerCode{nowTicksA}", null, null, 7);

            Assert.IsType(typeof(System.IO.MemoryStream), Response1);
        }
Esempio n. 3
0
        public async Task Should_Success_Get_by_PO()
        {
            var facadeDO = new GarmentDeliveryOrderFacade(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            GarmentDeliveryOrder dataDO = await dataUtilDO(facadeDO, GetCurrentMethod()).GetNewData();

            foreach (var i in dataDO.Items)
            {
                foreach (var d in i.Details)
                {
                    d.POSerialNumber = "PONO123";
                    d.RONo           = "RONO123";
                }
            }

            await facadeDO.Create(dataDO, USERNAME);

            var facade = new GarmentBeacukaiFacade(_dbContext(GetCurrentMethod()), GetServiceProvider().Object);

            GarmentBeacukai data = await dataUtil(facade, GetCurrentMethod()).GetNewData(USERNAME, dataDO);

            data.CustomsType = "BC 23";
            var Responses = await facade.Create(data, USERNAME);

            //var facadeReport = new GarmentBeacukaiFacade(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));

            var Response = facade.ReadBCByPOSerialNumbers("PONO123,PONO123");

            Assert.NotNull(Response);
        }
Esempio n. 4
0
        public async Task Should_Error_Create_Data()
        {
            GarmentDeliveryOrderFacade facade = new GarmentDeliveryOrderFacade(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            var       model = dataUtil(facade, GetCurrentMethod()).GetNewData();
            Exception e     = await Assert.ThrowsAsync <Exception>(async() => await facade.Create(null, USERNAME));

            Assert.NotNull(e.Message);
        }
Esempio n. 5
0
        public async void Should_Success_Create_Data_2()
        {
            GarmentDeliveryOrderFacade facade = new GarmentDeliveryOrderFacade(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            var model    = dataUtil(facade, GetCurrentMethod()).GetNewData2();
            var Response = await facade.Create(model, USERNAME);

            Assert.NotEqual(Response, 0);
        }
        public async void Should_Success_Get_Report_POOverBudget_Excel()
        {
            GarmentDeliveryOrderFacade facade = new GarmentDeliveryOrderFacade(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            var data = dataUtilDO(facade, GetCurrentMethod()).GetNewData();
            await facade.Create(data, USERNAME);

            var Facade   = new GarmentExternalPurchaseOrderFacade(ServiceProvider, _dbContext(GetCurrentMethod()));
            var Response = Facade.GenerateExcelEPOOverBudget(null, null, null, null, null, null, 1, 25, "{}", 7);

            Assert.IsType(typeof(System.IO.MemoryStream), Response);
        }
        public async void Should_Success_Get_Report_POOverBudget_Data()
        {
            GarmentDeliveryOrderFacade facade = new GarmentDeliveryOrderFacade(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            var data = dataUtilDO(facade, GetCurrentMethod()).GetNewData();
            await facade.Create(data, USERNAME);

            var Facade   = new GarmentExternalPurchaseOrderFacade(ServiceProvider, _dbContext(GetCurrentMethod()));
            var Response = Facade.GetEPOOverBudgetReport(null, null, null, null, null, null, 1, 25, "{}", 7);

            Assert.NotNull(Response.Item1);
        }
Esempio n. 8
0
        public async Task Should_Success_Get_Excel_Book_Report()
        {
            var httpClientService = new Mock <IHttpClientService>();

            httpClientService.Setup(x => x.GetAsync(It.Is <string>(s => s.Contains("master/garment-suppliers"))))
            .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(new CurrencyDataUtil().GetResultFormatterOkString())
            });
            var serviceProviderMock = new Mock <IServiceProvider>();

            serviceProviderMock
            .Setup(x => x.GetService(typeof(IdentityService)))
            .Returns(new IdentityService {
                Username = "******", TimezoneOffset = 7
            });
            serviceProviderMock
            .Setup(x => x.GetService(typeof(IHttpClientService)))
            .Returns(httpClientService.Object);

            var serviceProvider = GetServiceProvider().Object;
            var dbContext       = _dbContext(GetCurrentMethod());
            GarmentDeliveryOrderFacade facade = new GarmentDeliveryOrderFacade(serviceProvider, dbContext);
            var dataUtilDO                   = dataUtil(facade, GetCurrentMethod());
            var garmentBeacukaiFacade        = new GarmentBeacukaiFacade(dbContext, serviceProvider);
            var dataUtilBC                   = new GarmentBeacukaiDataUtil(dataUtilDO, garmentBeacukaiFacade);
            var invoicefacade                = new GarmentInvoiceFacade(dbContext, serviceProvider);
            var garmentInvoiceDetailDataUtil = new GarmentInvoiceDetailDataUtil();
            var garmentinvoiceItemDataUtil   = new GarmentInvoiceItemDataUtil(garmentInvoiceDetailDataUtil);
            var dataUtilInvo                 = new GarmentInvoiceDataUtil(garmentinvoiceItemDataUtil, garmentInvoiceDetailDataUtil, dataUtilDO, invoicefacade);
            var internnotefacade             = new GarmentInternNoteFacades(dbContext, serviceProvider);
            var dataUtilInternNote           = new GarmentInternNoteDataUtil(dataUtilInvo, internnotefacade);
            var correctionfacade             = new GarmentCorrectionNotePriceFacade(serviceProviderMock.Object, dbContext);
            var correctionDataUtil           = new GarmentCorrectionNoteDataUtil(correctionfacade, dataUtilDO);

            var dataDO = await dataUtilDO.GetNewData();

            await facade.Create(dataDO, USERNAME);

            var dataBC = await dataUtilBC.GetTestData(USERNAME, dataDO);

            var dataCorrection = await correctionDataUtil.GetTestData(dataDO);

            var dataInvo = await dataUtilInvo.GetTestData2(USERNAME, dataDO);

            var dataIntern = await dataUtilInternNote.GetNewData(dataInvo);

            await internnotefacade.Create(dataIntern, false, "Unit Test");

            var bookReportFacade = new GarmentPurchasingBookReportFacade(serviceProvider, dbContext);
            var Response         = bookReportFacade.GenerateExcelBookReport(null, null, null, null, null, 7);

            Assert.IsType <System.IO.MemoryStream>(Response);
        }
Esempio n. 9
0
        public async Task Should_Error_Get_Currency_when_Create_Data()
        {
            GarmentDeliveryOrderFacade facade = new GarmentDeliveryOrderFacade(GetServiceProviderError().Object, _dbContext(GetCurrentMethod()));
            var model = await dataUtil(facade, GetCurrentMethod()).GetNewData();

            foreach (var item in model.Items)
            {
                item.CurrencyCode = "test";
            }
            Exception e = await Assert.ThrowsAsync <Exception>(async() => await facade.Create(model, USERNAME));

            Assert.NotNull(e.Message);
        }
Esempio n. 10
0
        public async Task Should_Success_Get_Report_POEDODuration_Excel()
        {
            GarmentDeliveryOrderFacade facade = new GarmentDeliveryOrderFacade(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            var data = await dataUtilDO(facade, GetCurrentMethod()).GetNewData();

            await facade.Create(data, USERNAME);

            var Facade   = new GarmentExternalPurchaseOrderFacade(ServiceProvider, _dbContext(GetCurrentMethod()));
            var Response = Facade.GenerateExcelEPODODuration("", "", "0-30 hari", null, null, 7);

            Assert.IsType <System.IO.MemoryStream>(Response);

            var Response1 = Facade.GenerateExcelEPODODuration("", "", ">60 hari", null, null, 7);

            Assert.IsType <System.IO.MemoryStream>(Response1);
        }
        public async Task Should_Success_Get_Report_POEDODuration_Data()
        {
            GarmentDeliveryOrderFacade facade = new GarmentDeliveryOrderFacade(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            var data = await dataUtilDO(facade, GetCurrentMethod()).GetNewData();

            await facade.Create(data, USERNAME);

            var Facade   = new GarmentExternalPurchaseOrderFacade(ServiceProvider, _dbContext(GetCurrentMethod()));
            var Response = Facade.GetEPODODurationReport("", "", "0-30 hari", null, null, 1, 25, "{}", 7);

            Assert.NotNull(Response.Item1);

            var Response1 = Facade.GetEPODODurationReport("", "", "31-60 hari", null, null, 1, 25, "{}", 7);

            Assert.NotNull(Response1.Item1);

            var Response2 = Facade.GetEPODODurationReport("", "", ">60 hari", null, null, 1, 25, "{}", 7);

            Assert.NotNull(Response2.Item1);
        }
        public async void Should_Success_Get_Report_Excel()
        {
            GarmentDeliveryOrderFacade facade = new GarmentDeliveryOrderFacade(GetServiceProvider(), _dbContext(GetCurrentMethod()));
            var data = dataUtilDO(facade, GetCurrentMethod()).GetNewData();
            await facade.Create(data, USERNAME);

            var uFacade   = new GarmentUnitReceiptNoteFacade(GetServiceProvider(), _dbContext(GetCurrentMethod()));
            var datas     = dataUtil(uFacade, GetCurrentMethod()).GetNewDataWithStorage();
            var Responses = await uFacade.Create(datas);

            Assert.NotEqual(Responses, 0);
            var Facade   = new MonitoringUnitReceiptAllFacade(ServiceProvider, _dbContext(GetCurrentMethod()));
            var Response = Facade.GetReport(null, null, null, null, null, null, null, null, 1, 25, "{}", 7);

            Assert.NotEqual(Response.Item2, 0);

            var Response1 = Facade.GenerateExcel(null, null, null, null, null, null, null, null, 1, 25, "{}", 7);

            Assert.IsType(typeof(System.IO.MemoryStream), Response1);
        }
        public async Task Should_Success_Get_Report_Data()
        {
            GarmentDeliveryOrderFacade facade = new GarmentDeliveryOrderFacade(GetServiceProvider(), _dbContext(GetCurrentMethod()));
            var data = await dataUtilDO(facade, GetCurrentMethod()).GetNewData();

            await facade.Create(data, USERNAME);

            var uFacade = new GarmentUnitReceiptNoteFacade(GetServiceProvider(), _dbContext(GetCurrentMethod()));
            var datas   = await dataUtil(uFacade, GetCurrentMethod()).GetNewDataWithStorage();

            var Responses = await uFacade.Create(datas);

            Assert.NotEqual(Responses, 0);
            var Facade   = new MonitoringUnitReceiptAllFacade(ServiceProvider, _dbContext(GetCurrentMethod()));
            var Response = Facade.GetReport(null, null, null, null, null, null, null, null, 1, 25, "{}", 7);

            Assert.NotEqual(Response.Item2, 0);

            var Response1 = Facade.GetReport(null, null, null, null, null, null, null, null, 1, 25, "{}", 7);

            Assert.NotNull(Response1.Item1);
        }
Esempio n. 14
0
        public async Task Should_Success_Get_Report_AccuracyArrival()
        {
            GarmentDeliveryOrderFacade facade = new GarmentDeliveryOrderFacade(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            var data = await dataUtil(facade, GetCurrentMethod()).GetNewData3();

            data.DODate = DateTimeOffset.Now.AddDays(-35);
            foreach (var item in data.Items)
            {
                foreach (var detail in item.Details)
                {
                    detail.ProductCode = "LBL";
                }
            }
            await facade.Create(data, USERNAME);

            var Facade   = new GarmentDeliveryOrderFacade(ServiceProvider, _dbContext(GetCurrentMethod()));
            var Response = Facade.GetReportHeaderAccuracyofArrival(null, null, null, 7);

            Assert.NotNull(Response.Item1);

            var data2 = await dataUtil(facade, GetCurrentMethod()).GetNewData3();

            data2.DODate = DateTimeOffset.Now.AddDays(-35);
            foreach (var item in data2.Items)
            {
                foreach (var detail in item.Details)
                {
                    detail.ProductCode = "SUB";
                }
            }
            await facade.Create(data2, USERNAME);

            var data3 = await dataUtil(facade, GetCurrentMethod()).GetNewData3();

            data3.DODate = DateTimeOffset.Now.AddDays(-34);
            foreach (var item in data3.Items)
            {
                foreach (var detail in item.Details)
                {
                    detail.ProductCode = "SUB";
                }
            }
            await facade.Create(data3, USERNAME);

            var data4 = await dataUtil(facade, GetCurrentMethod()).GetNewData3();

            data4.DODate = DateTimeOffset.Now.AddDays(-33);
            foreach (var item in data4.Items)
            {
                foreach (var detail in item.Details)
                {
                    detail.ProductCode = "LBL";
                }
            }
            await facade.Create(data4, USERNAME);

            var Response1 = Facade.GetReportHeaderAccuracyofArrival(null, null, null, 7);

            Assert.NotNull(Response1.Item1);

            long   nowTicks  = DateTimeOffset.Now.Ticks;
            string nowTicksA = $"{nowTicks}a";
            AccuracyOfArrivalReportViewModel viewModelAccuracy = new AccuracyOfArrivalReportViewModel
            {
                supplier = new SupplierViewModel(),
                product  = new GarmentProductViewModel(),
            };

            viewModelAccuracy.Id              = 1;
            viewModelAccuracy.doNo            = data.DONo;
            viewModelAccuracy.supplier.Id     = data.SupplierId;
            viewModelAccuracy.supplier.Code   = data.SupplierCode;
            viewModelAccuracy.supplier.Name   = data.SupplierName;
            viewModelAccuracy.doDate          = data.DODate;
            viewModelAccuracy.poSerialNumber  = nowTicksA;
            viewModelAccuracy.product.Id      = nowTicks;
            viewModelAccuracy.product.Code    = nowTicksA;
            viewModelAccuracy.prDate          = DateTimeOffset.Now;
            viewModelAccuracy.poDate          = DateTimeOffset.Now;
            viewModelAccuracy.epoDate         = DateTimeOffset.Now;
            viewModelAccuracy.article         = nowTicksA;
            viewModelAccuracy.roNo            = nowTicksA;
            viewModelAccuracy.shipmentDate    = DateTimeOffset.Now;
            viewModelAccuracy.status          = nowTicksA;
            viewModelAccuracy.staff           = nowTicksA;
            viewModelAccuracy.category        = nowTicksA;
            viewModelAccuracy.dateDiff        = (int)nowTicks;
            viewModelAccuracy.ok_notOk        = nowTicksA;
            viewModelAccuracy.percentOk_notOk = (int)nowTicks;
            viewModelAccuracy.jumlahOk        = (int)nowTicks;
            viewModelAccuracy.jumlah          = (int)nowTicks;

            var Response2 = Facade.GetReportDetailAccuracyofArrival($"BuyerCode{nowTicksA}", null, null, null, 7);

            Assert.NotNull(Response2.Item1);

            var Response3 = Facade.GetReportDetailAccuracyofArrival($"BuyerCode{nowTicksA}", "Bahan Pendukung", null, null, 7);

            Assert.NotNull(Response3.Item1);
        }
Esempio n. 15
0
        public async Task Should_Success_Get_Report_AccuracyDelivery()
        {
            GarmentDeliveryOrderFacade facade = new GarmentDeliveryOrderFacade(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            var data = await dataUtil(facade, GetCurrentMethod()).GetNewData3();

            data.DODate = DateTimeOffset.Now.AddDays(10);
            foreach (var item in data.Items)
            {
                foreach (var detail in item.Details)
                {
                    detail.ProductCode = "LBL";
                }
            }
            await facade.Create(data, USERNAME);

            var Facade   = new GarmentDeliveryOrderFacade(ServiceProvider, _dbContext(GetCurrentMethod()));
            var Response = Facade.GetReportHeaderAccuracyofDelivery(null, null, data.PaymentType, data.PaymentMethod, 7);

            Assert.NotNull(Response.Item1);

            var data2 = await dataUtil(facade, GetCurrentMethod()).GetNewData3();

            data2.DODate = DateTimeOffset.Now.AddDays(10);
            foreach (var item in data2.Items)
            {
                foreach (var detail in item.Details)
                {
                    detail.ProductCode = "SUB";
                }
            }
            await facade.Create(data2, USERNAME);

            var data3 = await dataUtil(facade, GetCurrentMethod()).GetNewData3();

            data3.DODate = DateTimeOffset.Now.AddDays(10);
            foreach (var item in data3.Items)
            {
                foreach (var detail in item.Details)
                {
                    detail.ProductCode = "SUB";
                }
            }
            await facade.Create(data3, USERNAME);

            var data4 = await dataUtil(facade, GetCurrentMethod()).GetNewData3();

            data4.DODate = DateTimeOffset.Now.AddDays(11);
            foreach (var item in data4.Items)
            {
                foreach (var detail in item.Details)
                {
                    detail.ProductCode = "LBL";
                }
            }
            await facade.Create(data4, USERNAME);

            var Response1 = Facade.GetReportHeaderAccuracyofDelivery(null, null, "", "", 7);

            Assert.NotNull(Response1.Item1);

            long   nowTicks  = DateTimeOffset.Now.Ticks;
            string nowTicksA = $"{nowTicks}a";
            var    Response2 = Facade.GetReportDetailAccuracyofDelivery($"BuyerCode{nowTicksA}", null, null, "", "", 7);

            Assert.NotNull(Response2.Item1);
        }