- 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.
34 lines
1.2 KiB
C#
34 lines
1.2 KiB
C#
using System;
|
|
using System.Threading.Tasks;
|
|
using ComplianceNFs.Infrastructure.Repositories;
|
|
using ComplianceNFs.Core.Entities;
|
|
using Xunit;
|
|
using Moq;
|
|
using Npgsql;
|
|
|
|
namespace ComplianceNFs.Infrastructure.Tests
|
|
{
|
|
public class AttachmentRepositoryTests
|
|
{
|
|
[Fact]
|
|
public async Task SaveRawAsync_DoesNotThrow_WithValidInvoice()
|
|
{
|
|
// Arrange
|
|
var repo = new AttachmentRepository("Host=localhost;Port=5432;Database=test;Username=test;Password=test");
|
|
var invoice = new EnergyInvoice
|
|
{
|
|
MailId = "mailid",
|
|
ConversationId = "convid",
|
|
SupplierEmail = "test@supplier.com",
|
|
ReceivedDate = DateTime.Now,
|
|
InvoiceId = 1,
|
|
Filename = "file.xml",
|
|
Status = InvoiceStatus.Validated
|
|
};
|
|
// This is a placeholder: in a real test, use a test DB or mock NpgsqlConnection/Command
|
|
// For demonstration, we'll just check that the method can be called without throwing
|
|
await Assert.ThrowsAnyAsync<Exception>(async () => await repo.SaveRawAsync(invoice));
|
|
}
|
|
}
|
|
}
|