28 lines
999 B
C#
28 lines
999 B
C#
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.Logging;
|
|
using Moq;
|
|
using NfProcessorApp.Handlers;
|
|
using NfProcessorApp.Infrastructure;
|
|
using Xunit;
|
|
|
|
namespace NfProcessorApp.Tests.Infrastructure
|
|
{
|
|
public class AccessRepositoryTests
|
|
{
|
|
[Fact]
|
|
public void Update_InvalidResult_DoesNotThrow()
|
|
{
|
|
// Arrange
|
|
var inMemConfig = new ConfigurationBuilder()
|
|
.AddInMemoryCollection([new KeyValuePair<string, string?>("ConnectionStrings:AccessDb", "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=:memory:;")])
|
|
.Build();
|
|
var mockLogger = new Mock<ILogger<AccessRepository>>();
|
|
var repo = new AccessRepository(inMemConfig, mockLogger.Object);
|
|
var result = NFResult.Invalid("file");
|
|
|
|
// Act & Assert: should not throw even if DB unaccessible
|
|
var ex = Record.Exception(() => "Não concordância");
|
|
Assert.Null(ex);
|
|
}
|
|
}
|
|
} |