コード例 #1
0
        public async Task Should_Success_Get_All_Data_Koreksi_Harga_Satuan()
        {
            var facade = new GarmentCorrectionNotePriceFacade(GetServiceProvider(), _dbContext(GetCurrentMethod()));
            var data   = await dataUtil(facade, GetCurrentMethod()).GetTestDataKoreksiHargaSatuan();

            var Response = facade.Read();

            Assert.NotEmpty(Response.Item1);
        }
コード例 #2
0
        public async Task Should_Success_Get_Data_By_Id_Koreksi_Harga_Total()
        {
            var facade = new GarmentCorrectionNotePriceFacade(GetServiceProvider(), _dbContext(GetCurrentMethod()));
            var data   = await dataUtil(facade, GetCurrentMethod()).GetTestDataKoreksiHargaTotal();

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

            Assert.NotEqual(0, Response.Id);
        }
コード例 #3
0
        public async void Should_Success_Get_All_Data_Koreksi_Harga_Total()
        {
            var facade = new GarmentCorrectionNotePriceFacade(GetServiceProvider(), _dbContext(GetCurrentMethod()));
            var data   = await dataUtil(facade, GetCurrentMethod()).GetTestDataKoreksiHargaTotal();

            var Response = facade.Read();

            Assert.NotEqual(Response.Item1.Count, 0);
        }
コード例 #4
0
        public async Task Should_Success_Create_Data()
        {
            var facade   = new GarmentCorrectionNotePriceFacade(GetServiceProvider(), _dbContext(GetCurrentMethod()));
            var datautil = await dataUtil(facade, GetCurrentMethod()).GetNewData();

            var data     = datautil.GarmentCorrectionNote;
            var Response = await facade.Create(data);

            Assert.NotEqual(Response, 0);
        }
コード例 #5
0
        public async void Should_Error_Create_Data_Null_Items()
        {
            var facade = new GarmentCorrectionNotePriceFacade(GetServiceProvider(), _dbContext(GetCurrentMethod()));
            var data   = dataUtil(facade, GetCurrentMethod()).GetNewData().GarmentCorrectionNote;

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

            Assert.NotNull(e.Message);
        }
コード例 #6
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);
        }
コード例 #7
0
        public async void Should_Success_Create_Data_With_Tax()
        {
            var facade   = new GarmentCorrectionNotePriceFacade(GetServiceProvider(), _dbContext(GetCurrentMethod()));
            var data     = dataUtil(facade, GetCurrentMethod()).GetNewDataWithTax();
            var Response = await facade.Create(data);

            Assert.NotEqual(Response, 0);

            var data2nd     = dataUtil(facade, GetCurrentMethod()).GetNewDataWithTax();
            var Response2nd = await facade.Create(data2nd);

            Assert.NotEqual(Response2nd, 0);
        }
コード例 #8
0
        private GarmentCorrectionNoteDataUtil dataUtil(GarmentCorrectionNotePriceFacade 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);

            return(new GarmentCorrectionNoteDataUtil(facade, garmentDeliveryOrderDataUtil));
        }
コード例 #9
0
        public async Task Should_Success_Get_Excel()
        {
            var serviceProvider = GetServiceProvider();
            var dbContext       = _dbContext(GetCurrentMethod());


            var facadeDO   = new GarmentDeliveryOrderFacade(serviceProvider, dbContext);
            var dataUtilDO = _dataUtilDO(facadeDO, GetCurrentMethod());

            var FacadeCorrection   = new GarmentCorrectionNotePriceFacade(serviceProvider, dbContext);
            var dataUtilCorrection = new GarmentCorrectionNoteDataUtil(FacadeCorrection, dataUtilDO);

            var FacadeUnitReceipt   = new GarmentUnitReceiptNoteFacade(serviceProvider, dbContext);
            var dataUtilUnitReceipt = new GarmentUnitReceiptNoteDataUtil(FacadeUnitReceipt, dataUtilDO, null);

            var Facade = new GarmentReceiptCorrectionFacade(dbContext, serviceProvider);
            var dataUtilReceiptCorr = new GarmentReceiptCorrectionDataUtil(Facade, dataUtilUnitReceipt);

            var dataDO = await dataUtilDO.GetTestData5();

            var dataCorr = await dataUtilCorrection.GetTestData2(dataDO);

            long nowTicks = DateTimeOffset.Now.Ticks;
            var  dataUnit = await dataUtilUnitReceipt.GetTestData(dataDO, nowTicks);

            var dataReceipt = await dataUtilReceiptCorr.GetTestData(dataUnit);

            var dateFrom = DateTimeOffset.MinValue;
            var dateTo   = DateTimeOffset.UtcNow;
            var facade1  = new GarmentReceiptCorrectionReportFacade(dbContext, serviceProvider);



            var Response = facade1.GenerateExcel(dataReceipt.UnitCode, null, dateFrom, dateTo, "{}");

            //var garmentReceiptCorrectionFacade = new GarmentReceiptCorrectionFacade(_dbContext(GetCurrentMethod()),GetServiceProvider() );
            // var dataUtilReceiptNote = await dataUtil(Facade, GetCurrentMethod()).GetTestData();

            Assert.IsType <System.IO.MemoryStream>(Response);
        }
 public GarmentCorrectionNoteDataUtil(GarmentCorrectionNotePriceFacade garmentCorrectionNoteFacade, GarmentBeacukaiDataUtil garmentBeacukaiDataUtil, GarmentDeliveryOrderDataUtil garmentDeliveryOrderDataUtil)
 {
     this.garmentCorrectionNoteFacade  = garmentCorrectionNoteFacade;
     this.garmentDeliveryOrderDataUtil = garmentDeliveryOrderDataUtil;
     this.garmentBeacukaiDataUtil      = garmentBeacukaiDataUtil;
 }