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

39 lines
1.1 KiB
C#

using e_suite.Modules.ExceptionLogManager.Extensions;
using e_suite.Modules.ExceptionLogManager.UnitTests.Helpers;
using Newtonsoft.Json;
using NUnit.Framework;
namespace e_suite.Modules.ExceptionLogManager.UnitTests;
public class ExtensionUnitTests: ExceptionLogManagerTestBase
{
[SetUp]
public override async Task Setup()
{
await base.Setup();
}
[Test]
public void DoubleExtensionMethod_WhenCalled_ReturnsExpectedResult()
{
//Arrange
var ex = new NullReferenceException();
var exception = new Database.Core.Tables.Diagnostics.ExceptionLog
{
Application = "E-Suite API",
Message = "Internal Server Error",
StackTrace = ex.StackTrace ?? string.Empty,
ExceptionJson = JsonConvert.SerializeObject(ex),
SupportingData = string.Empty,
OccuredAt = _fakeClock.GetNow
};
//Act
var result = exception.ToExceptionLog();
//Assert
Assert.That(result.GetType().Name, Is.EqualTo("ExceptionLog"));
Assert.Pass();
}
}