Example #1
0
        public async Task Should_Success_ExpenditureReport()
        {
            //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);
            var data = await _dataUtil(service).GetTestData();

            var newForm = _dataUtil(service).GetNewForm();

            //Act
            var response = service.ExpenditureReport(1, 1, 1, 1, data.Date, data.Date);

            //Assert
            Assert.True(response.Count > 0);
        }
        public async Task Should_Success_Get_Expenditure_Report()
        {
            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;

            var result = service.ExpenditureReport(created.Id, internalNoteId, invoiceId, supplierId, startDate, endDate);

            Assert.NotEmpty(result);
        }