refactor: update validation test classes to be sealed and simplify Dispose methods

This commit is contained in:
Miha Kralj
2025-12-26 16:43:23 -08:00
parent bfb0f6a322
commit 4750c2b1e8
31 changed files with 238 additions and 228 deletions
+12 -4
View File
@@ -4,10 +4,11 @@ using Xunit.Abstractions;
namespace QuanTAlib.Tests;
public class BesselValidationTests : IDisposable
public sealed class BesselValidationTests : IDisposable
{
private readonly ValidationTestData _testData;
private readonly ITestOutputHelper _output;
private bool _disposed;
public BesselValidationTests(ITestOutputHelper output)
{
@@ -18,14 +19,20 @@ public class BesselValidationTests : IDisposable
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
private void Dispose(bool disposing)
{
if (_disposed)
{
return;
}
_disposed = true;
if (disposing)
{
_testData.Dispose();
_testData?.Dispose();
}
}
@@ -51,3 +58,4 @@ public class BesselValidationTests : IDisposable
_output.WriteLine("Bessel validated internally: Span vs TSeries are consistent.");
}
}
-1
View File
@@ -322,6 +322,5 @@ public sealed class Bessel : AbstractBase, IDisposable
{
_publisher.Pub -= _handler;
}
GC.SuppressFinalize(this);
}
}