Fix audit findings for coverage, architecture checks, and XML docs
All checks were successful
NuGet Publish / build-and-pack (push) Successful in 45s
NuGet Publish / publish-to-gitea (push) Successful in 52s

This commit is contained in:
Joseph Doherty
2026-02-20 15:43:25 -05:00
parent 5528806518
commit 3ffd468c79
99 changed files with 23746 additions and 9548 deletions

View File

@@ -21,11 +21,17 @@ public class CdcTests : IDisposable
private readonly string _dbPath = $"cdc_test_{Guid.NewGuid()}.db";
private readonly Shared.TestDbContext _db;
/// <summary>
/// Initializes a new instance of the <see cref="CdcTests"/> class.
/// </summary>
public CdcTests()
{
_db = new Shared.TestDbContext(_dbPath);
}
/// <summary>
/// Verifies that an insert operation publishes a CDC event.
/// </summary>
[Fact]
public async Task Test_Cdc_Basic_Insert_Fires_Event()
{
@@ -47,6 +53,9 @@ public class CdcTests : IDisposable
snapshot[0].Entity!.Name.ShouldBe("John");
}
/// <summary>
/// Verifies payload is omitted when CDC capture payload is disabled.
/// </summary>
[Fact]
public async Task Test_Cdc_No_Payload_When_Not_Requested()
{
@@ -65,6 +74,9 @@ public class CdcTests : IDisposable
snapshot[0].Entity.ShouldBeNull();
}
/// <summary>
/// Verifies CDC events are published only for committed changes.
/// </summary>
[Fact]
public async Task Test_Cdc_Commit_Only()
{
@@ -95,6 +107,9 @@ public class CdcTests : IDisposable
snapshot[0].DocumentId.ShouldBe(2);
}
/// <summary>
/// Verifies update and delete operations publish CDC events.
/// </summary>
[Fact]
public async Task Test_Cdc_Update_And_Delete()
{
@@ -125,6 +140,9 @@ public class CdcTests : IDisposable
snapshot[2].DocumentId.ShouldBe(1);
}
/// <summary>
/// Disposes test resources and removes temporary files.
/// </summary>
public void Dispose()
{
_db.Dispose();
@@ -155,6 +173,13 @@ public class CdcTests : IDisposable
// Simple helper to avoid System.Reactive dependency in tests
public static class ObservableExtensions
{
/// <summary>
/// Subscribes to an observable sequence using an action callback.
/// </summary>
/// <typeparam name="T">The event type.</typeparam>
/// <param name="observable">The observable sequence.</param>
/// <param name="onNext">The callback for next events.</param>
/// <returns>An <see cref="IDisposable"/> subscription.</returns>
public static IDisposable Subscribe<T>(this IObservable<T> observable, Action<T> onNext)
{
return observable.Subscribe(new AnonymousObserver<T>(onNext));
@@ -163,9 +188,28 @@ public static class ObservableExtensions
private class AnonymousObserver<T> : IObserver<T>
{
private readonly Action<T> _onNext;
/// <summary>
/// Initializes a new instance of the <see cref="AnonymousObserver{T}"/> class.
/// </summary>
/// <param name="onNext">The callback for next events.</param>
public AnonymousObserver(Action<T> onNext) => _onNext = onNext;
/// <summary>
/// Handles completion.
/// </summary>
public void OnCompleted() { }
/// <summary>
/// Handles an observable error.
/// </summary>
/// <param name="error">The observed error.</param>
public void OnError(Exception error) { }
/// <summary>
/// Handles the next value.
/// </summary>
/// <param name="value">The observed value.</param>
public void OnNext(T value) => _onNext(value);
}
}