39 lines
1.2 KiB
C#
39 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;
|
|
using Microsoft.Extensions.Logging;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace ComplianceNFs.Infrastructure.Tests
|
|
{
|
|
public class AttachmentRepositoryTests
|
|
{
|
|
[Fact]
|
|
public async Task SaveRawAsync_DoesNotThrow_WithValidInvoice()
|
|
{
|
|
// Arrange
|
|
var options = new DbContextOptionsBuilder<ComplianceNFsDbContext>()
|
|
.Options;
|
|
using var dbContext = new ComplianceNFsDbContext(options);
|
|
var mockLogger = new Mock<ILogger<AttachmentRepository>>();
|
|
var repo = new AttachmentRepository(dbContext, mockLogger.Object);
|
|
var invoice = new EnergyInvoice
|
|
{
|
|
MailId = "mailid",
|
|
ConversationId = "convid",
|
|
SupplierEmail = "test@supplier.com",
|
|
ReceivedDate = DateTime.Now,
|
|
InvoiceId = 1,
|
|
Filename = "file.xml",
|
|
Status = InvoiceStatus.Validated
|
|
};
|
|
// Act & Assert
|
|
await repo.SaveRawAsync(invoice); // Should not throw
|
|
}
|
|
}
|
|
}
|