public async Task <DPPVATBankExpenditureNoteDto> GetTestData() { FormDto form = GetNewForm(); var id = await Service.Create(form); return(Service.Read(id)); }
public async Task Should_Success_Create() { var dbContext = GetDbContext(GetCurrentMethod()); var serviceProviderMock = GetServiceProvider(dbContext); var service = new DPPVATBankExpenditureNoteService(serviceProviderMock.Object); var id = await service.Create(GetForm()); Assert.NotEqual(0, id); }
public async Task Should_Success_Posting() { var dbContext = GetDbContext(GetCurrentMethod()); var serviceProviderMock = GetServiceProvider(dbContext); var service = new DPPVATBankExpenditureNoteService(serviceProviderMock.Object); var id = await service.Create(GetForm()); var result = await service.Posting(new List <int>() { id }); Assert.NotEqual(0, result); }
public async Task Should_Success_Read_Created_By_Id() { var dbContext = GetDbContext(GetCurrentMethod()); var serviceProviderMock = GetServiceProvider(dbContext); var service = new DPPVATBankExpenditureNoteService(serviceProviderMock.Object); var id = await service.Create(GetForm()); var result = service.Read(id); Assert.NotNull(result); }
public async Task Should_Success_Get_Expenditure_Report_From_Invoice() { var dbContext = GetDbContext(GetCurrentMethod()); var serviceProviderMock = GetServiceProvider(dbContext); var service = new DPPVATBankExpenditureNoteService(serviceProviderMock.Object); var id = await service.Create(GetForm()); var created = service.Read(id); var internalNoteId = created.Items.Select(item => item.InternalNote.Id).FirstOrDefault(); var invoiceId = created.Items.SelectMany(item => item.InternalNote.Items).Select(item => item.Invoice.Id).FirstOrDefault(); var result = service.ExpenditureFromInvoice(invoiceId); Assert.NotNull(result); }
public async Task Should_Success_Get_Expenditure_Report_Detail_Pagination() { var dbContext = GetDbContext(GetCurrentMethod()); var serviceProviderMock = GetServiceProvider(dbContext); var service = new DPPVATBankExpenditureNoteService(serviceProviderMock.Object); var id = await service.Create(GetForm()); var created = service.Read(id); var internalNoteId = created.Items.Select(item => item.InternalNote.Id).FirstOrDefault(); var invoiceId = created.Items.SelectMany(item => item.InternalNote.Items).Select(item => item.Invoice.Id).FirstOrDefault(); var supplierId = created.Supplier.Id; var startDate = DateTimeOffset.MinValue; var endDate = DateTimeOffset.MaxValue.AddHours(Offset * -1); var result = service.ExpenditureReportDetailDOPagination(1, 10, created.Id, internalNoteId, invoiceId, supplierId, startDate, endDate); Assert.NotEmpty(result); }
public async Task Should_Success_Create() { //Arrange var dbContex = GetDbContext(GetCurrentAsyncMethod()); var serviceProvider = GetServiceProvider(); serviceProvider .Setup(x => x.GetService(typeof(IHttpClientService))) .Returns(new HttpClientTestService()); serviceProvider .Setup(s => s.GetService(typeof(FinanceDbContext))) .Returns(dbContex); DPPVATBankExpenditureNoteService service = new DPPVATBankExpenditureNoteService(serviceProvider.Object); FormDto form = _dataUtil(service).GetNewForm(); //Act var response = await service.Create(form); //Assert Assert.NotEqual(0, response); }