- Added ComplianceNFs.Infrastructure.Tests project to the solution. - Implemented unit tests for AccessDbRepository, ArchivingService, AttachmentRepository, InvoiceIngestionService, MailListener, MonitorViewModel, and Worker. - Enhanced existing tests with additional assertions and mock setups. - Updated TODOs and roadmap documentation to reflect changes in service implementations and testing coverage. - Modified ComplianceNFs.sln to include new test project and adjust solution properties.
31 lines
1.2 KiB
C#
31 lines
1.2 KiB
C#
using System.Collections.Generic;
|
|
using ComplianceNFs.Infrastructure.Repositories;
|
|
using ComplianceNFs.Core.Entities;
|
|
using Xunit;
|
|
using Moq;
|
|
|
|
namespace ComplianceNFs.Infrastructure.Tests
|
|
{
|
|
public class AccessDbRepositoryTests
|
|
{
|
|
[Fact]
|
|
public void GetByCnpj_ReturnsExpectedRecords()
|
|
{
|
|
// Arrange
|
|
var expected = new List<BuyingRecord> {
|
|
new BuyingRecord { CodTE = 180310221018240701, CnpjComp = "06272575007403", CnpjVend = "13777004000122", MontLO = 24.72m, PrecLO = 147.29m }
|
|
};
|
|
var CaminhoDB = "X:\\Middle\\Informativo Setorial\\Modelo Word\\BD1_dados cadastrais e faturas.accdb";
|
|
var repo = new AccessDbRepository(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + CaminhoDB + ";Jet OLEDB:Database Password=gds21");
|
|
// Act
|
|
var result = repo.GetByCnpj("06272575007403");
|
|
// Assert
|
|
Assert.NotNull(result);
|
|
Assert.Equal("06272575007403", result.First().CnpjComp);
|
|
Assert.Equal("13777004000122", result.First().CnpjVend);
|
|
Assert.Equal(24.72m, result.First().MontLO);
|
|
Assert.Equal(147.29m, result.First().PrecLO);
|
|
}
|
|
}
|
|
}
|