private UnitPaymentOrderDataUtil _dataUtil(UnitPaymentOrderFacade facade, string testName) { PurchaseRequestFacade purchaseRequestFacade = new PurchaseRequestFacade(GetServiceProvider(testName).Object, _dbContext(testName)); PurchaseRequestItemDataUtil purchaseRequestItemDataUtil = new PurchaseRequestItemDataUtil(); PurchaseRequestDataUtil purchaseRequestDataUtil = new PurchaseRequestDataUtil(purchaseRequestItemDataUtil, purchaseRequestFacade); InternalPurchaseOrderFacade internalPurchaseOrderFacade = new InternalPurchaseOrderFacade(GetServiceProvider(testName).Object, _dbContext(testName)); InternalPurchaseOrderItemDataUtil internalPurchaseOrderItemDataUtil = new InternalPurchaseOrderItemDataUtil(); InternalPurchaseOrderDataUtil internalPurchaseOrderDataUtil = new InternalPurchaseOrderDataUtil(internalPurchaseOrderItemDataUtil, internalPurchaseOrderFacade, purchaseRequestDataUtil); ExternalPurchaseOrderFacade externalPurchaseOrderFacade = new ExternalPurchaseOrderFacade(GetServiceProvider(testName).Object, _dbContext(testName)); ExternalPurchaseOrderDetailDataUtil externalPurchaseOrderDetailDataUtil = new ExternalPurchaseOrderDetailDataUtil(); ExternalPurchaseOrderItemDataUtil externalPurchaseOrderItemDataUtil = new ExternalPurchaseOrderItemDataUtil(externalPurchaseOrderDetailDataUtil); ExternalPurchaseOrderDataUtil externalPurchaseOrderDataUtil = new ExternalPurchaseOrderDataUtil(externalPurchaseOrderFacade, internalPurchaseOrderDataUtil, externalPurchaseOrderItemDataUtil); DeliveryOrderFacade deliveryOrderFacade = new DeliveryOrderFacade(_dbContext(testName), GetServiceProvider(testName).Object); DeliveryOrderDetailDataUtil deliveryOrderDetailDataUtil = new DeliveryOrderDetailDataUtil(); DeliveryOrderItemDataUtil deliveryOrderItemDataUtil = new DeliveryOrderItemDataUtil(deliveryOrderDetailDataUtil); DeliveryOrderDataUtil deliveryOrderDataUtil = new DeliveryOrderDataUtil(deliveryOrderItemDataUtil, deliveryOrderDetailDataUtil, externalPurchaseOrderDataUtil, deliveryOrderFacade); UnitReceiptNoteFacade unitReceiptNoteFacade = new UnitReceiptNoteFacade(GetServiceProvider(testName).Object, _dbContext(testName)); UnitReceiptNoteItemDataUtil unitReceiptNoteItemDataUtil = new UnitReceiptNoteItemDataUtil(); UnitReceiptNoteDataUtil unitReceiptNoteDataUtil = new UnitReceiptNoteDataUtil(unitReceiptNoteItemDataUtil, unitReceiptNoteFacade, deliveryOrderDataUtil); return(new UnitPaymentOrderDataUtil(unitReceiptNoteDataUtil, facade)); }
private UnitReceiptNoteDataUtil _dataUtil(UnitReceiptNoteFacade facade, PurchasingDbContext _DbContext) { PurchaseRequestFacade purchaseRequestFacade = new PurchaseRequestFacade(_ServiceProvider.Object, _DbContext); PurchaseRequestItemDataUtil purchaseRequestItemDataUtil = new PurchaseRequestItemDataUtil(); PurchaseRequestDataUtil purchaseRequestDataUtil = new PurchaseRequestDataUtil(purchaseRequestItemDataUtil, purchaseRequestFacade); InternalPurchaseOrderFacade internalPurchaseOrderFacade = new InternalPurchaseOrderFacade(_ServiceProvider.Object, _DbContext); InternalPurchaseOrderItemDataUtil internalPurchaseOrderItemDataUtil = new InternalPurchaseOrderItemDataUtil(); InternalPurchaseOrderDataUtil internalPurchaseOrderDataUtil = new InternalPurchaseOrderDataUtil(internalPurchaseOrderItemDataUtil, internalPurchaseOrderFacade, purchaseRequestDataUtil); ExternalPurchaseOrderFacade externalPurchaseOrderFacade = new ExternalPurchaseOrderFacade(_ServiceProvider.Object, _DbContext); ExternalPurchaseOrderDetailDataUtil externalPurchaseOrderDetailDataUtil = new ExternalPurchaseOrderDetailDataUtil(); ExternalPurchaseOrderItemDataUtil externalPurchaseOrderItemDataUtil = new ExternalPurchaseOrderItemDataUtil(externalPurchaseOrderDetailDataUtil); ExternalPurchaseOrderDataUtil externalPurchaseOrderDataUtil = new ExternalPurchaseOrderDataUtil(externalPurchaseOrderFacade, internalPurchaseOrderDataUtil, externalPurchaseOrderItemDataUtil); DeliveryOrderFacade deliveryOrderFacade = new DeliveryOrderFacade(_DbContext, _ServiceProvider.Object); DeliveryOrderDetailDataUtil deliveryOrderDetailDataUtil = new DeliveryOrderDetailDataUtil(); DeliveryOrderItemDataUtil deliveryOrderItemDataUtil = new DeliveryOrderItemDataUtil(deliveryOrderDetailDataUtil); DeliveryOrderDataUtil deliveryOrderDataUtil = new DeliveryOrderDataUtil(deliveryOrderItemDataUtil, deliveryOrderDetailDataUtil, externalPurchaseOrderDataUtil, deliveryOrderFacade); UnitReceiptNoteFacade unitReceiptNoteFacade = new UnitReceiptNoteFacade(_ServiceProvider.Object, _DbContext); UnitReceiptNoteItemDataUtil unitReceiptNoteItemDataUtil = new UnitReceiptNoteItemDataUtil(); UnitReceiptNoteDataUtil unitReceiptNoteDataUtil = new UnitReceiptNoteDataUtil(unitReceiptNoteItemDataUtil, unitReceiptNoteFacade, deliveryOrderDataUtil); return(new UnitReceiptNoteDataUtil(unitReceiptNoteItemDataUtil, facade, deliveryOrderDataUtil)); }
private UnitPaymentPriceCorrectionNoteDataUtils CorrectionDataUtil(UnitPaymentPriceCorrectionNoteFacade facade, string testName, IServiceProvider serviceProvider) { PurchaseRequestFacade purchaseRequestFacade = new PurchaseRequestFacade(serviceProvider, GetDbContext(testName)); PurchaseRequestItemDataUtil purchaseRequestItemDataUtil = new PurchaseRequestItemDataUtil(); PurchaseRequestDataUtil purchaseRequestDataUtil = new PurchaseRequestDataUtil(purchaseRequestItemDataUtil, purchaseRequestFacade); InternalPurchaseOrderFacade internalPurchaseOrderFacade = new InternalPurchaseOrderFacade(serviceProvider, GetDbContext(testName)); InternalPurchaseOrderItemDataUtil internalPurchaseOrderItemDataUtil = new InternalPurchaseOrderItemDataUtil(); InternalPurchaseOrderDataUtil internalPurchaseOrderDataUtil = new InternalPurchaseOrderDataUtil(internalPurchaseOrderItemDataUtil, internalPurchaseOrderFacade, purchaseRequestDataUtil); ExternalPurchaseOrderFacade externalPurchaseOrderFacade = new ExternalPurchaseOrderFacade(serviceProvider, GetDbContext(testName)); ExternalPurchaseOrderDetailDataUtil externalPurchaseOrderDetailDataUtil = new ExternalPurchaseOrderDetailDataUtil(); ExternalPurchaseOrderItemDataUtil externalPurchaseOrderItemDataUtil = new ExternalPurchaseOrderItemDataUtil(externalPurchaseOrderDetailDataUtil); ExternalPurchaseOrderDataUtil externalPurchaseOrderDataUtil = new ExternalPurchaseOrderDataUtil(externalPurchaseOrderFacade, internalPurchaseOrderDataUtil, externalPurchaseOrderItemDataUtil); DeliveryOrderFacade deliveryOrderFacade = new DeliveryOrderFacade(GetDbContext(testName), serviceProvider); DeliveryOrderDetailDataUtil deliveryOrderDetailDataUtil = new DeliveryOrderDetailDataUtil(); DeliveryOrderItemDataUtil deliveryOrderItemDataUtil = new DeliveryOrderItemDataUtil(deliveryOrderDetailDataUtil); DeliveryOrderDataUtil deliveryOrderDataUtil = new DeliveryOrderDataUtil(deliveryOrderItemDataUtil, deliveryOrderDetailDataUtil, externalPurchaseOrderDataUtil, deliveryOrderFacade); UnitReceiptNoteFacade unitReceiptNoteFacade = new UnitReceiptNoteFacade(serviceProvider, GetDbContext(testName)); UnitReceiptNoteItemDataUtil unitReceiptNoteItemDataUtil = new UnitReceiptNoteItemDataUtil(); UnitReceiptNoteDataUtil unitReceiptNoteDataUtil = new UnitReceiptNoteDataUtil(unitReceiptNoteItemDataUtil, unitReceiptNoteFacade, deliveryOrderDataUtil); UnitPaymentOrderFacade unitPaymentOrderFacade = new UnitPaymentOrderFacade(serviceProvider, GetDbContext(testName)); UnitPaymentOrderDataUtil unitPaymentOrderDataUtil = new UnitPaymentOrderDataUtil(unitReceiptNoteDataUtil, unitPaymentOrderFacade); return(new UnitPaymentPriceCorrectionNoteDataUtils(unitPaymentOrderDataUtil, facade)); }
public async void Should_Success_Get_Report_Data() { var serviceProvider = new Mock <IServiceProvider>(); ExternalPurchaseOrder externalPurchaseOrder = await EPODataUtil.GetTestData("Unit test"); DeliveryOrder deliveryOrder = await DODataUtil.GetTestData("unit-test"); UnitReceiptNote urn = await DataUtil.GetTestData3("unit-test"); UnitReceiptNoteFacade facade = new UnitReceiptNoteFacade(serviceProvider.Object, _dbContext(GetCurrentMethod())); await _dataUtil(facade, GetCurrentMethod()).GetTestData("unit-test"); //UnitPaymentOrder upo = await UPODataUtil.GetTestData(); //await UPOFacade.Create(upo, "unit-test", false, 7); var DateFrom = DateTime.Now; DateFrom = DateFrom.Date; var DateTo = DateTime.Now; DateTo = DateTo.Date; if (externalPurchaseOrder != null && deliveryOrder != null && urn != null) { var Response = Facade.GetReport(null, null, null, DateFrom, DateTo); Assert.NotEqual(Response.Item2, 0); } }
private UnitPaymentCorrectionNoteDataUtil _dataUtil(UnitPaymentQuantityCorrectionNoteFacade facade, PurchasingDbContext dbContext, IServiceProvider serviceProvider) { PurchaseRequestFacade purchaseRequestFacade = new PurchaseRequestFacade(serviceProvider, dbContext); PurchaseRequestItemDataUtil purchaseRequestItemDataUtil = new PurchaseRequestItemDataUtil(); PurchaseRequestDataUtil purchaseRequestDataUtil = new PurchaseRequestDataUtil(purchaseRequestItemDataUtil, purchaseRequestFacade); InternalPurchaseOrderFacade internalPurchaseOrderFacade = new InternalPurchaseOrderFacade(serviceProvider, dbContext); InternalPurchaseOrderItemDataUtil internalPurchaseOrderItemDataUtil = new InternalPurchaseOrderItemDataUtil(); InternalPurchaseOrderDataUtil internalPurchaseOrderDataUtil = new InternalPurchaseOrderDataUtil(internalPurchaseOrderItemDataUtil, internalPurchaseOrderFacade, purchaseRequestDataUtil); ExternalPurchaseOrderFacade externalPurchaseOrderFacade = new ExternalPurchaseOrderFacade(serviceProvider, dbContext); ExternalPurchaseOrderDetailDataUtil externalPurchaseOrderDetailDataUtil = new ExternalPurchaseOrderDetailDataUtil(); ExternalPurchaseOrderItemDataUtil externalPurchaseOrderItemDataUtil = new ExternalPurchaseOrderItemDataUtil(externalPurchaseOrderDetailDataUtil); ExternalPurchaseOrderDataUtil externalPurchaseOrderDataUtil = new ExternalPurchaseOrderDataUtil(externalPurchaseOrderFacade, internalPurchaseOrderDataUtil, externalPurchaseOrderItemDataUtil); DeliveryOrderFacade deliveryOrderFacade = new DeliveryOrderFacade(dbContext, serviceProvider); DeliveryOrderDetailDataUtil deliveryOrderDetailDataUtil = new DeliveryOrderDetailDataUtil(); DeliveryOrderItemDataUtil deliveryOrderItemDataUtil = new DeliveryOrderItemDataUtil(deliveryOrderDetailDataUtil); DeliveryOrderDataUtil deliveryOrderDataUtil = new DeliveryOrderDataUtil(deliveryOrderItemDataUtil, deliveryOrderDetailDataUtil, externalPurchaseOrderDataUtil, deliveryOrderFacade); UnitReceiptNoteFacade unitReceiptNoteFacade = new UnitReceiptNoteFacade(serviceProvider, dbContext); UnitReceiptNoteItemDataUtil unitReceiptNoteItemDataUtil = new UnitReceiptNoteItemDataUtil(); UnitReceiptNoteDataUtil unitReceiptNoteDataUtil = new UnitReceiptNoteDataUtil(unitReceiptNoteItemDataUtil, unitReceiptNoteFacade, deliveryOrderDataUtil); UnitPaymentOrderFacade unitPaymentOrderFacade = new UnitPaymentOrderFacade(serviceProvider, dbContext); UnitPaymentOrderDataUtil unitPaymentOrderDataUtil = new UnitPaymentOrderDataUtil(unitReceiptNoteDataUtil, unitPaymentOrderFacade); return(new UnitPaymentCorrectionNoteDataUtil(unitPaymentOrderDataUtil, facade, unitReceiptNoteFacade)); }
public void Should_Success_GenerateExcel() { var dbContext = _dbContext(GetCurrentMethod()); UnitReceiptNoteFacade facade = new UnitReceiptNoteFacade(_ServiceProvider.Object, dbContext); var dataUtil = _dataUtil(facade, dbContext).GetTestData(USERNAME).Result; var response = facade.GenerateExcel(dataUtil.URNNo, "", dataUtil.UnitId, "", dataUtil.SupplierId, null, null, 1); Assert.NotNull(response); }
public void Should_Success_Delete_Data() { var dbContext = _dbContext(GetCurrentMethod()); UnitReceiptNoteFacade facade = new UnitReceiptNoteFacade(_ServiceProvider.Object, dbContext); var dataUtil = _dataUtil(facade, dbContext).GetTestData(USERNAME).Result; var response = facade.Delete((int)dataUtil.Id, dataUtil.CreatedBy); Assert.NotEqual(response, 0); }
public void Should_Success_Get_Data() { var dbContext = _dbContext(GetCurrentMethod()); UnitReceiptNoteFacade facade = new UnitReceiptNoteFacade(_ServiceProvider.Object, dbContext); var dataUtil = _dataUtil(facade, dbContext).GetTestData(USERNAME); var Response = facade.Read(); Assert.NotEqual(Response.Data.Count, 0); }
public void Should_Success_Get_Data_By_Id() { var dbContext = _dbContext(GetCurrentMethod()); UnitReceiptNoteFacade facade = new UnitReceiptNoteFacade(_ServiceProvider.Object, dbContext); var dataUtil = _dataUtil(facade, dbContext).GetTestData(USERNAME).Result; var Response = facade.ReadById((int)dataUtil.Id); Assert.NotNull(Response); }
public async Task Should_Success_Get_Data() { var dbContext = _dbContext(GetCurrentMethod()); UnitReceiptNoteFacade facade = new UnitReceiptNoteFacade(_ServiceProvider(GetCurrentMethod()).Object, dbContext); var dataUtil = await _dataUtil(facade, dbContext, GetCurrentMethod()).GetTestData(USERNAME); var Response = facade.Read(); Assert.NotEmpty(Response.Data); }
public async Task Should_Success_GetReport() { var dbContext = _dbContext(GetCurrentMethod()); UnitReceiptNoteFacade facade = new UnitReceiptNoteFacade(_ServiceProvider.Object, dbContext); var dataUtil = await _dataUtil(facade, dbContext).GetTestData(USERNAME); var response = facade.GetReport(dataUtil.URNNo, "", dataUtil.UnitId, "", dataUtil.SupplierId, null, null, 1, 25, "{}", 1); Assert.NotEqual(response.Data.Count, 0); }
public async Task Should_Success_Get_By_No() { var dbContext = _dbContext(GetCurrentMethod()); UnitReceiptNoteFacade facade = new UnitReceiptNoteFacade(_ServiceProvider.Object, dbContext); var dataUtil = await _dataUtil(facade, dbContext).GetTestData(USERNAME); var response = facade.ReadByNoFiltered(1, 25, "{}", null, "{ no : ['" + dataUtil.URNNo + "']}"); Assert.NotNull(response); }
public async Task Should_Success_Get_Subledger() { var dbContext = _dbContext(GetCurrentMethod()); UnitReceiptNoteFacade facade = new UnitReceiptNoteFacade(_ServiceProvider.Object, dbContext); var dataUtil = await _dataUtil(facade, dbContext).GetTestData(USERNAME); var response = await facade.GetUnitReceiptNoteForSubledger(new List <string>() { dataUtil.URNNo }); Assert.NotEmpty(response); }
public async Task Should_Success_Update_Data() { var dbContext = _dbContext(GetCurrentMethod()); UnitReceiptNoteFacade facade = new UnitReceiptNoteFacade(_ServiceProvider.Object, dbContext); var dataUtil = await _dataUtil(facade, dbContext).GetTestData(USERNAME); var response = await facade.Update((int)dataUtil.Id, dataUtil, dataUtil.CreatedBy); Assert.NotEqual(response, 0); }
public async Task Should_Success_GenerateExcel_Spb() { var dbContext = _dbContext(GetCurrentMethod()); UnitReceiptNoteFacade facade = new UnitReceiptNoteFacade(_ServiceProvider(GetCurrentMethod()).Object, dbContext); var dataUtil = await _dataUtil(facade, dbContext, GetCurrentMethod()).GetTestData(USERNAME); var response = facade.GenerateExcelSpb(dataUtil.URNNo, "", "", null, null, 1); Assert.NotNull(response); }
public async Task Should_Success_GetSpbReport() { var dbContext = _dbContext(GetCurrentMethod()); UnitReceiptNoteFacade facade = new UnitReceiptNoteFacade(_ServiceProvider(GetCurrentMethod()).Object, dbContext); var dataUtil = await _dataUtil(facade, dbContext, GetCurrentMethod()).GetTestData(USERNAME); var response = facade.GetSpbReport(dataUtil.URNNo, "", "", null, null, 25, 1, "{}", 1); Assert.NotEmpty(response.Data); }
public async Task Should_Success_Get_Creditor_Account_Data() { var dbContext = _dbContext(GetCurrentMethod()); UnitReceiptNoteFacade facade = new UnitReceiptNoteFacade(_ServiceProvider(GetCurrentMethod()).Object, dbContext); var dataUtil = await _dataUtil(facade, dbContext, GetCurrentMethod()).GetTestData(USERNAME); var response = facade.GetCreditorAccountDataByURNNo(dataUtil.URNNo); Assert.NotNull(response); }
public async Task Should_Success_Create_Having_Stock_Data() { var dbContext = _dbContext(GetCurrentMethod()); UnitReceiptNoteFacade facade = new UnitReceiptNoteFacade(_ServiceProvider.Object, dbContext); var model = await _dataUtil(facade, dbContext).GetNewHavingStockData(USERNAME); model.IsStorage = true; var response = await facade.Create(model, USERNAME); Assert.NotEqual(response, 0); }
public void Should_Success_Create_Data() { var dbContext = _dbContext(GetCurrentMethod()); UnitReceiptNoteFacade facade = new UnitReceiptNoteFacade(_ServiceProvider.Object, dbContext); var model = _dataUtil(facade, dbContext).GetNewData(USERNAME).Result; model.IsStorage = true; var response = facade.Create(model, USERNAME).Result; Assert.NotEqual(response, 0); }
private UnitPaymentPriceCorrectionNoteDataUtils _dataUtil(UnitPaymentPriceCorrectionNoteFacade facade, string testName) { var serviceProvider = new Mock <IServiceProvider>(); serviceProvider .Setup(x => x.GetService(typeof(IdentityService))) .Returns(new IdentityService() { Token = "Token", Username = "******" }); serviceProvider .Setup(x => x.GetService(typeof(IHttpClientService))) .Returns(new HttpClientTestService()); var services = new ServiceCollection(); services.AddMemoryCache(); var serviceProviders = services.BuildServiceProvider(); var memoryCache = serviceProviders.GetService <IMemoryCache>(); serviceProvider .Setup(x => x.GetService(typeof(IMemoryCacheManager))) .Returns(new MemoryCacheManager(memoryCache)); PurchaseRequestFacade purchaseRequestFacade = new PurchaseRequestFacade(serviceProvider.Object, _dbContext(testName)); PurchaseRequestItemDataUtil purchaseRequestItemDataUtil = new PurchaseRequestItemDataUtil(); PurchaseRequestDataUtil purchaseRequestDataUtil = new PurchaseRequestDataUtil(purchaseRequestItemDataUtil, purchaseRequestFacade); InternalPurchaseOrderFacade internalPurchaseOrderFacade = new InternalPurchaseOrderFacade(serviceProvider.Object, _dbContext(testName)); InternalPurchaseOrderItemDataUtil internalPurchaseOrderItemDataUtil = new InternalPurchaseOrderItemDataUtil(); InternalPurchaseOrderDataUtil internalPurchaseOrderDataUtil = new InternalPurchaseOrderDataUtil(internalPurchaseOrderItemDataUtil, internalPurchaseOrderFacade, purchaseRequestDataUtil); ExternalPurchaseOrderFacade externalPurchaseOrderFacade = new ExternalPurchaseOrderFacade(serviceProvider.Object, _dbContext(testName)); ExternalPurchaseOrderDetailDataUtil externalPurchaseOrderDetailDataUtil = new ExternalPurchaseOrderDetailDataUtil(); ExternalPurchaseOrderItemDataUtil externalPurchaseOrderItemDataUtil = new ExternalPurchaseOrderItemDataUtil(externalPurchaseOrderDetailDataUtil); ExternalPurchaseOrderDataUtil externalPurchaseOrderDataUtil = new ExternalPurchaseOrderDataUtil(externalPurchaseOrderFacade, internalPurchaseOrderDataUtil, externalPurchaseOrderItemDataUtil); DeliveryOrderFacade deliveryOrderFacade = new DeliveryOrderFacade(_dbContext(testName), serviceProvider.Object); DeliveryOrderDetailDataUtil deliveryOrderDetailDataUtil = new DeliveryOrderDetailDataUtil(); DeliveryOrderItemDataUtil deliveryOrderItemDataUtil = new DeliveryOrderItemDataUtil(deliveryOrderDetailDataUtil); DeliveryOrderDataUtil deliveryOrderDataUtil = new DeliveryOrderDataUtil(deliveryOrderItemDataUtil, deliveryOrderDetailDataUtil, externalPurchaseOrderDataUtil, deliveryOrderFacade); UnitReceiptNoteFacade unitReceiptNoteFacade = new UnitReceiptNoteFacade(serviceProvider.Object, _dbContext(testName)); UnitReceiptNoteItemDataUtil unitReceiptNoteItemDataUtil = new UnitReceiptNoteItemDataUtil(); UnitReceiptNoteDataUtil unitReceiptNoteDataUtil = new UnitReceiptNoteDataUtil(unitReceiptNoteItemDataUtil, unitReceiptNoteFacade, deliveryOrderDataUtil); UnitPaymentOrderFacade unitPaymentOrderFacade = new UnitPaymentOrderFacade(_dbContext(testName)); UnitPaymentOrderDataUtil unitPaymentOrderDataUtil = new UnitPaymentOrderDataUtil(unitReceiptNoteDataUtil, unitPaymentOrderFacade); return(new UnitPaymentPriceCorrectionNoteDataUtils(unitPaymentOrderDataUtil, facade)); }
public async Task Should_Success_CreateNullCOA_Data() { var dbContext = _dbContext(GetCurrentMethod()); UnitReceiptNoteFacade facade2 = new UnitReceiptNoteFacade(GetServiceProvider2().Object, dbContext); var model2 = await _dataUtil(facade2, dbContext).GetNewData(USERNAME); model2.IsStorage = true; model2.UnitId = null; var response2 = await facade2.Create(model2, USERNAME); Assert.NotEqual(response2, 0); }
public async Task Should_Success_Create_Data_SupplierIsImport() { var dbContext = _dbContext(GetCurrentMethod()); UnitReceiptNoteFacade facade = new UnitReceiptNoteFacade(GetServiceProviderCurrencyNotNull(GetCurrentMethod()).Object, dbContext); var model = await _dataUtil(facade, dbContext, GetCurrentMethod()).GetNewData(USERNAME); model.IsStorage = true; model.UnitId = null; model.SupplierIsImport = true; var response = await facade.Create(model, USERNAME); Assert.NotEqual(0, response); }
public void Should_Success_Get_Report_Data_Excel_Null_Parameter() { var dbContext = _dbContext(GetCurrentMethod()); UnitReceiptNoteFacade facade = new UnitReceiptNoteFacade(_ServiceProvider.Object, dbContext); var dataUtil = _dataUtil(facade, dbContext).GetTestData(USERNAME); //UnitReceiptNote urn = await _dataUtil.GetTestData2("unit-test"); var DateFrom = DateTime.Now; DateFrom = DateFrom.Date; var DateTo = DateTime.Now; DateTo = DateTo.Date; ImportPurchasingBookReportFacade iprFacade = new ImportPurchasingBookReportFacade(_ServiceProvider.Object, dbContext); //var Response = facade.GetReport(null, null, null, DateFrom, DateTo); var Response = iprFacade.GenerateExcel(null, null, null, DateFrom, DateTo); Assert.IsType(typeof(System.IO.MemoryStream), Response); }
public void Should_Success_Get_GetPurchaseRequestCategoryCode() { var dbContext = _dbContext(GetCurrentMethod()); UnitReceiptNoteFacade facade = new UnitReceiptNoteFacade(_ServiceProvider.Object, dbContext); var dataUtil = _dataUtil(facade, dbContext).GetTestData(USERNAME); var Response = facade.Read(); Assert.NotEqual(Response.Data.Count, 0); foreach (var data in Response.Data) { foreach (var item in data.Items) { var categoryCode = facade.GetPurchaseRequestCategoryCode(item.PRId); Assert.NotNull(categoryCode); } } }
//public async Task Should_Success_Get_Report_Data() //{ // ExternalPurchaseOrder externalPurchaseOrder = await EPODataUtil.GetNewData("unit-test"); // await EPOFacade.Create(externalPurchaseOrder, "unit-test", 7); // DeliveryOrder deliveryOrder = await DODataUtil.GetNewData("unit-test"); // await DOFacade.Create(deliveryOrder, "unit-test"); // UnitReceiptNote urn = await DataUtil.GetNewDatas("unit-test"); // await Facade.Create(urn, "unit-test"); // //UnitPaymentOrder upo = await UPODataUtil.GetTestData(); // //await UPOFacade.Create(upo, "unit-test", false, 7); // var DateFrom = DateTime.Now; // DateFrom = DateFrom.Date; // var DateTo = DateTime.Now; // DateTo = DateTo.Date; // var Response = IPRFacade.GetReport(null, null,null ,DateFrom,DateTo); // Assert.NotEqual(Response.Item2, 0); //} public void Should_Success_Get_Report_Data() { //ExternalPurchaseOrder externalPurchaseOrder = await EPODataUtil.GetTestData("Unit test"); //DeliveryOrder deliveryOrder = await DODataUtil.GetTestData("unit-test"); var dbContext = _dbContext(GetCurrentMethod()); UnitReceiptNoteFacade facade = new UnitReceiptNoteFacade(_ServiceProvider.Object, dbContext); var dataUtil = _dataUtil(facade, dbContext).GetTestData(USERNAME); //UnitReceiptNote urn = await _dataUtil.GetTestData2("unit-test"); var DateFrom = DateTime.Now.AddDays(-1); DateFrom = DateFrom.Date; var DateTo = DateTime.Now.AddDays(1); DateTo = DateTo.Date; ImportPurchasingBookReportFacade response = new ImportPurchasingBookReportFacade(_ServiceProvider.Object, dbContext); var Response = response.GetReport(null, null, null, DateFrom, DateTo); Assert.Equal(Response.Item2, 0); }
private UnitPaymentCorrectionNoteDataUtil _dataUtil(UnitPaymentQuantityCorrectionNoteFacade facade, PurchasingDbContext dbContext) { var serviceProvider = new Mock <IServiceProvider>(); serviceProvider .Setup(x => x.GetService(typeof(IdentityService))) .Returns(new IdentityService() { Token = "Token", Username = "******" }); serviceProvider .Setup(x => x.GetService(typeof(IHttpClientService))) .Returns(new HttpClientTestService()); PurchaseRequestFacade purchaseRequestFacade = new PurchaseRequestFacade(serviceProvider.Object, dbContext); PurchaseRequestItemDataUtil purchaseRequestItemDataUtil = new PurchaseRequestItemDataUtil(); PurchaseRequestDataUtil purchaseRequestDataUtil = new PurchaseRequestDataUtil(purchaseRequestItemDataUtil, purchaseRequestFacade); InternalPurchaseOrderFacade internalPurchaseOrderFacade = new InternalPurchaseOrderFacade(serviceProvider.Object, dbContext); InternalPurchaseOrderItemDataUtil internalPurchaseOrderItemDataUtil = new InternalPurchaseOrderItemDataUtil(); InternalPurchaseOrderDataUtil internalPurchaseOrderDataUtil = new InternalPurchaseOrderDataUtil(internalPurchaseOrderItemDataUtil, internalPurchaseOrderFacade, purchaseRequestDataUtil); ExternalPurchaseOrderFacade externalPurchaseOrderFacade = new ExternalPurchaseOrderFacade(serviceProvider.Object, dbContext); ExternalPurchaseOrderDetailDataUtil externalPurchaseOrderDetailDataUtil = new ExternalPurchaseOrderDetailDataUtil(); ExternalPurchaseOrderItemDataUtil externalPurchaseOrderItemDataUtil = new ExternalPurchaseOrderItemDataUtil(externalPurchaseOrderDetailDataUtil); ExternalPurchaseOrderDataUtil externalPurchaseOrderDataUtil = new ExternalPurchaseOrderDataUtil(externalPurchaseOrderFacade, internalPurchaseOrderDataUtil, externalPurchaseOrderItemDataUtil); DeliveryOrderFacade deliveryOrderFacade = new DeliveryOrderFacade(dbContext, serviceProvider.Object); DeliveryOrderDetailDataUtil deliveryOrderDetailDataUtil = new DeliveryOrderDetailDataUtil(); DeliveryOrderItemDataUtil deliveryOrderItemDataUtil = new DeliveryOrderItemDataUtil(deliveryOrderDetailDataUtil); DeliveryOrderDataUtil deliveryOrderDataUtil = new DeliveryOrderDataUtil(deliveryOrderItemDataUtil, deliveryOrderDetailDataUtil, externalPurchaseOrderDataUtil, deliveryOrderFacade); UnitReceiptNoteFacade unitReceiptNoteFacade = new UnitReceiptNoteFacade(serviceProvider.Object, dbContext); UnitReceiptNoteItemDataUtil unitReceiptNoteItemDataUtil = new UnitReceiptNoteItemDataUtil(); UnitReceiptNoteDataUtil unitReceiptNoteDataUtil = new UnitReceiptNoteDataUtil(unitReceiptNoteItemDataUtil, unitReceiptNoteFacade, deliveryOrderDataUtil); UnitPaymentOrderFacade unitPaymentOrderFacade = new UnitPaymentOrderFacade(dbContext); UnitPaymentOrderDataUtil unitPaymentOrderDataUtil = new UnitPaymentOrderDataUtil(unitReceiptNoteDataUtil, unitPaymentOrderFacade); return(new UnitPaymentCorrectionNoteDataUtil(unitPaymentOrderDataUtil, facade, unitReceiptNoteFacade)); }
public void Should_Success_Read_DataBySupplier() { var dbContext = _dbContext(GetCurrentMethod()); UnitReceiptNoteFacade facade = new UnitReceiptNoteFacade(_ServiceProvider.Object, dbContext); var dataUtil = _dataUtil(facade, dbContext).GetTestData(USERNAME); var filter = JsonConvert.SerializeObject(new { DivisionId = "DivisionId", SupplierId = "supId", PaymentMethod = "test", CurrencyCode = "CurrencyCode", UseIncomeTax = true, UseVat = false, CategoryId = "CategoryId" }); var response = facade.ReadBySupplierUnit(Filter: filter); Assert.NotEqual(response.Data.Count, 0); }
public void Should_Success_Get_Report_Data() { var dbContext = _dbContext(GetCurrentMethod()); UnitReceiptNoteFacade facade = new UnitReceiptNoteFacade(_ServiceProvider.Object, dbContext); var dataUtil = _dataUtil(facade, dbContext).GetTestData(USERNAME); //UnitReceiptNote urn = await _dataUtil.GetTestData2("unit-test"); var DateFrom = DateTime.Now.AddDays(-1); DateFrom = DateFrom.Date; var DateTo = DateTime.Now.AddDays(1); DateTo = DateTo.Date; //UnitPaymentOrder upo = await UPODataUtil.GetTestData(); //await UPOFacade.Create(upo, "unit-test", false, 7); DateTo = DateTo.Date; //if (externalPurchaseOrder != null && deliveryOrder != null && urn != null) //{ LocalPurchasingBookReportFacade Facade = new LocalPurchasingBookReportFacade(_ServiceProvider.Object, dbContext); var Response = Facade.GetReport(null, null, null, DateFrom, DateTo); Assert.Equal(Response.Item2, 0); //} }
public void Should_Success_Get_Report_Total_Purchase_By_Units_Null_Data_Excel() { var dbContext = _dbContext(GetCurrentMethod()); UnitReceiptNoteFacade facade = new UnitReceiptNoteFacade(_ServiceProvider.Object, dbContext); var dataUtil = _dataUtil(facade, dbContext).GetTestData(USERNAME); //UnitReceiptNote urn = await _dataUtil.GetTestData2("unit-test"); var DateFrom = DateTime.Now.AddDays(-1); DateFrom = DateFrom.Date; var DateTo = DateTime.Now.AddDays(1); DateTo = DateTo.Date; //UnitPaymentOrder upo = await UPODataUtil.GetTestData(); //await UPOFacade.Create(upo, "unit-test", false, 7); DateTo = DateTo.Date; //if (externalPurchaseOrder != null && deliveryOrder != null && urn != null) //{ LocalPurchasingBookReportFacade Facade = new LocalPurchasingBookReportFacade(_ServiceProvider.Object, dbContext); //var Response = Facade.GetReport(null, null, null, DateFrom, DateTo); var Response = Facade.GenerateExcel(null, null, null, DateFrom, DateTo); Assert.IsType(typeof(System.IO.MemoryStream), Response); }
private UnitPaymentOrderDataUtil _dataUtil(UnitPaymentOrderFacade facade, PurchasingDbContext dbContext, string testname) { var serviceProvider = new Mock <IServiceProvider>(); var distributionCache = new Mock <IDistributedCache>(); //var emptyArray = new Mock<string>(); //distributionCache // .Setup(x => x.GetString(It.IsAny<string>())) // .Returns(string.Empty); serviceProvider .Setup(x => x.GetService(typeof(IdentityService))) .Returns(new IdentityService() { Token = "Token", Username = "******" }); serviceProvider .Setup(x => x.GetService(typeof(IHttpClientService))) .Returns(new HttpClientTestService()); serviceProvider .Setup(x => x.GetService(typeof(InternalPurchaseOrderFacade))) .Returns(new InternalPurchaseOrderFacade(serviceProvider.Object, _dbContext(testname))); serviceProvider .Setup(x => x.GetService(typeof(IDistributedCache))) .Returns(distributionCache.Object); var services = new ServiceCollection(); services.AddMemoryCache(); var serviceProviders = services.BuildServiceProvider(); var memoryCache = serviceProviders.GetService <IMemoryCache>(); serviceProvider .Setup(x => x.GetService(typeof(IMemoryCacheManager))) .Returns(new MemoryCacheManager(memoryCache)); var mockCurrencyProvider = new Mock <ICurrencyProvider>(); mockCurrencyProvider .Setup(x => x.GetCurrencyByCurrencyCode(It.IsAny <string>())) .ReturnsAsync((Currency)null); mockCurrencyProvider .Setup(x => x.GetCurrencyByCurrencyCodeDate(It.IsAny <string>(), It.IsAny <DateTimeOffset>())) .ReturnsAsync((Currency)null); serviceProvider .Setup(x => x.GetService(typeof(ICurrencyProvider))) .Returns(mockCurrencyProvider.Object); PurchaseRequestFacade purchaseRequestFacade = new PurchaseRequestFacade(serviceProvider.Object, dbContext); PurchaseRequestItemDataUtil purchaseRequestItemDataUtil = new PurchaseRequestItemDataUtil(); PurchaseRequestDataUtil purchaseRequestDataUtil = new PurchaseRequestDataUtil(purchaseRequestItemDataUtil, purchaseRequestFacade); InternalPurchaseOrderFacade internalPurchaseOrderFacade = new InternalPurchaseOrderFacade(serviceProvider.Object, dbContext); InternalPurchaseOrderItemDataUtil internalPurchaseOrderItemDataUtil = new InternalPurchaseOrderItemDataUtil(); InternalPurchaseOrderDataUtil internalPurchaseOrderDataUtil = new InternalPurchaseOrderDataUtil(internalPurchaseOrderItemDataUtil, internalPurchaseOrderFacade, purchaseRequestDataUtil); ExternalPurchaseOrderFacade externalPurchaseOrderFacade = new ExternalPurchaseOrderFacade(serviceProvider.Object, dbContext); ExternalPurchaseOrderDetailDataUtil externalPurchaseOrderDetailDataUtil = new ExternalPurchaseOrderDetailDataUtil(); ExternalPurchaseOrderItemDataUtil externalPurchaseOrderItemDataUtil = new ExternalPurchaseOrderItemDataUtil(externalPurchaseOrderDetailDataUtil); ExternalPurchaseOrderDataUtil externalPurchaseOrderDataUtil = new ExternalPurchaseOrderDataUtil(externalPurchaseOrderFacade, internalPurchaseOrderDataUtil, externalPurchaseOrderItemDataUtil); DeliveryOrderFacade deliveryOrderFacade = new DeliveryOrderFacade(dbContext, serviceProvider.Object); DeliveryOrderDetailDataUtil deliveryOrderDetailDataUtil = new DeliveryOrderDetailDataUtil(); DeliveryOrderItemDataUtil deliveryOrderItemDataUtil = new DeliveryOrderItemDataUtil(deliveryOrderDetailDataUtil); DeliveryOrderDataUtil deliveryOrderDataUtil = new DeliveryOrderDataUtil(deliveryOrderItemDataUtil, deliveryOrderDetailDataUtil, externalPurchaseOrderDataUtil, deliveryOrderFacade); UnitReceiptNoteFacade unitReceiptNoteFacade = new UnitReceiptNoteFacade(serviceProvider.Object, dbContext); UnitReceiptNoteItemDataUtil unitReceiptNoteItemDataUtil = new UnitReceiptNoteItemDataUtil(); UnitReceiptNoteDataUtil unitReceiptNoteDataUtil = new UnitReceiptNoteDataUtil(unitReceiptNoteItemDataUtil, unitReceiptNoteFacade, deliveryOrderDataUtil); return(new UnitPaymentOrderDataUtil(unitReceiptNoteDataUtil, facade)); }