- 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.
39 lines
1.1 KiB
C#
39 lines
1.1 KiB
C#
using System;
|
|
using System.Threading.Tasks;
|
|
using ComplianceNFs.Core.Entities;
|
|
using ComplianceNFs.Core.Application.Services;
|
|
using ComplianceNFs.Core.Ports;
|
|
using Xunit;
|
|
using Moq;
|
|
|
|
namespace ComplianceNFs.Infrastructure.Tests
|
|
{
|
|
public class ArchivingServiceTests
|
|
{
|
|
[Fact]
|
|
public async Task ArchiveAsync_CallsFileArchiver()
|
|
{
|
|
// Arrange
|
|
var mockArchiver = new Mock<IFileArchiver>();
|
|
var service = new ArchivingService(mockArchiver.Object);
|
|
var invoice = new EnergyInvoice
|
|
{
|
|
MailId = "mailid",
|
|
ConversationId = "convid",
|
|
SupplierEmail = "test@supplier.com",
|
|
ReceivedDate = DateTime.Now,
|
|
InvoiceId = 1,
|
|
Filename = "file.xml",
|
|
Status = InvoiceStatus.Validated
|
|
};
|
|
var fileBytes = new byte[] { 1, 2, 3 };
|
|
|
|
// Act
|
|
await service.ArchiveAsync(invoice, fileBytes);
|
|
|
|
// Assert
|
|
mockArchiver.Verify(a => a.ArchiveAsync(invoice, fileBytes), Times.Once);
|
|
}
|
|
}
|
|
}
|