Fix audit findings for coverage, architecture checks, and XML docs
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user