public async void Should_Success_Get_Data() { PurchasingDispositionFacade facade = new PurchasingDispositionFacade(ServiceProvider, _dbContext(GetCurrentMethod())); await _dataUtil(facade, GetCurrentMethod()).GetTestData(); var Response = facade.Read(); Assert.NotEqual(Response.Item1.Count, 0); }
public async void Should_Success_Get_Data_TotalPaidPrice() { PurchasingDispositionFacade facade = new PurchasingDispositionFacade(ServiceProvider, _dbContext(GetCurrentMethod())); await _dataUtil(facade, GetCurrentMethod()).GetTestData(); var Response = facade.Read(); var data = Response.Item1.Select(x => new PurchasingDispositionViewModel() { Active = x.Active, Amount = x.Amount, Bank = x.Bank, Calculation = x.Calculation, ConfirmationOrderNo = x.ConfirmationOrderNo, CreatedAgent = x.CreatedAgent, CreatedBy = x.CreatedBy, CreatedUtc = x.CreatedUtc, Currency = new Lib.ViewModels.IntegrationViewModel.CurrencyViewModel() { code = x.CurrencyCode, _id = x.CurrencyId }, Id = x.Id, DispositionNo = x.DispositionNo, //Investation = x.Investation, //InvoiceNo = x.InvoiceNo, IsDeleted = x.IsDeleted, LastModifiedAgent = x.LastModifiedAgent, LastModifiedBy = x.LastModifiedBy, LastModifiedUtc = x.LastModifiedUtc, PaymentDueDate = x.PaymentDueDate, PaymentMethod = x.PaymentMethod, Position = x.Position, ProformaNo = x.ProformaNo, Remark = x.Remark, Supplier = new Lib.ViewModels.IntegrationViewModel.SupplierViewModel() { code = x.SupplierCode, name = x.SupplierName, _id = x.SupplierId }, Items = x.Items.Select(y => new PurchasingDispositionItemViewModel() { Active = y.Active, CreatedAgent = y.CreatedAgent, CreatedBy = y.CreatedBy, CreatedUtc = y.CreatedUtc, EPOId = y.EPOId, EPONo = y.EPONo, Id = y.Id, IncomeTax = new Lib.ViewModels.IntegrationViewModel.IncomeTaxViewModel() { name = y.IncomeTaxName, rate = y.IncomeTaxRate.ToString(), _id = y.IncomeTaxId }, UseVat = y.UseVat, UseIncomeTax = y.UseIncomeTax, LastModifiedUtc = y.LastModifiedUtc, LastModifiedBy = y.LastModifiedBy, LastModifiedAgent = y.LastModifiedAgent, IsDeleted = y.IsDeleted, Details = y.Details.Select(z => new PurchasingDispositionDetailViewModel() { Active = z.Active, IsDeleted = z.IsDeleted, LastModifiedAgent = z.LastModifiedAgent, Category = new Lib.ViewModels.IntegrationViewModel.CategoryViewModel() { code = z.CategoryCode, name = z.CategoryName, _id = z.CategoryId }, Unit = new Lib.ViewModels.IntegrationViewModel.UnitViewModel() { name = z.UnitName, code = z.UnitCode, _id = z.UnitId }, Product = new Lib.ViewModels.IntegrationViewModel.ProductViewModel() { _id = z.ProductId, code = z.ProductCode, name = z.ProductName }, PRNo = z.PRNo, PRId = z.PRId, PriceTotal = z.PriceTotal, PaidQuantity = z.PaidQuantity, CreatedAgent = z.CreatedAgent, CreatedBy = z.CreatedBy, CreatedUtc = z.CreatedUtc, DealQuantity = z.DealQuantity, DealUom = new Lib.ViewModels.IntegrationViewModel.UomViewModel() { unit = z.DealUomUnit, _id = z.DealUomId }, Id = z.Id, PricePerDealUnit = z.PricePerDealUnit, PaidPrice = z.PaidPrice, LastModifiedUtc = z.LastModifiedUtc, LastModifiedBy = z.LastModifiedBy }).ToList() }).ToList() }).ToList(); var totalPaidPriceResponse = facade.GetTotalPaidPrice(data); Assert.NotEqual(totalPaidPriceResponse.Count, 0); }