Backend/e-suite.Modules.ExceptionLogManager/e-suite.Modules.ExceptionLogManager.UnitTests/GetExceptionLogsUnitTests.cs
2026-01-20 21:50:10 +00:00

41 lines
1.3 KiB
C#

using e_suite.Modules.ExceptionLogManager.UnitTests.Helpers;
using e_suite.Utilities.Pagination;
using NUnit.Framework;
namespace e_suite.Modules.ExceptionLogManager.UnitTests;
public class GetExceptionLogsUnitTests: ExceptionLogManagerTestBase
{
[SetUp]
public override async Task Setup()
{
await base.Setup();
}
[Test]
public async Task GetLogException_WhenCalled_UsingRespository_ReturnsExpectedResult()
{
//Act
await ExceptionLogManager.LogException(new DivideByZeroException(), "Unit Test", string.Empty, CancellationToken.None);
var result = ExceptionLogManagerRepository.GetExceptionLogs();
//Assert
Assert.That(result, Is.Not.Null);
Assert.That(result.Count, Is.EqualTo(1));
Assert.Pass();
}
[Test]
public async Task GetLogException_WhenCalled_UsingLogger_ReturnsExpectedResult()
{
//Act
await ExceptionLogManager.LogException(new DivideByZeroException(), "Unit Test", string.Empty, CancellationToken.None);
var result = ExceptionLogManager.GetExceptionLogs(new Paging(), CancellationToken.None).Result;
//Assert
Assert.That(result, Is.Not.Null);
Assert.That(result, Has.Count.EqualTo(1));
Assert.Pass();
}
}