513fa1aa16
Comment/XML-doc changes only: - add summaries to ~10k test methods, fixtures, fakes and helpers (+ <param> on theories, <returns> on async Task methods, <inheritdoc/> on interface implementations the checker can resolve) - strip ~2.6k project-tracking references (WP*, P*-*, row-NN, Task N, #NN, Component-0NN) from comments, keeping the explanatory text; reword false positives in comments only - real docs on fakes implementing BCL/library interfaces (IDisposable, ILogger, IOptionsMonitor, IAsyncLifetime) - reword the last 5 src/ false positives (CWE-1236, failures-1, year-0001, M365) Only non-comment edits: four one-line nested classes split across lines so members can carry docs. Build 0 errors / 0 warnings.
43 lines
1.9 KiB
C#
43 lines
1.9 KiB
C#
using Microsoft.Extensions.DependencyInjection;
|
|
using ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Repositories;
|
|
|
|
namespace ZB.MOM.WW.ScadaBridge.AuditLog.Tests.TestSupport;
|
|
|
|
/// <summary>
|
|
/// Deferred-work register row 61 — the replacement for <c>AuditLogIngestActor</c>'s deleted
|
|
/// repository-taking "test-mode" constructor.
|
|
///
|
|
/// <para>
|
|
/// That constructor cached a scoped repository on an actor field for the actor's whole
|
|
/// lifetime. Nothing in production selected it, but the shape was one call site away from
|
|
/// re-introducing a captive-dependency bug, so it had to be allowlisted in the Host tests'
|
|
/// <c>CaptiveDependencyGuard</c>. The actor now has a single <see cref="IServiceProvider"/>
|
|
/// constructor; a fixture that wants a concrete repository builds one of these instead.
|
|
/// </para>
|
|
///
|
|
/// <para>
|
|
/// Behaviour is unchanged for the ingest path: the old ctor passed <c>redactor: null</c> and
|
|
/// <c>failureCounter: null</c>, and a provider with neither registered resolves both to null
|
|
/// too — so the actor still falls back to <c>SafeDefaultAuditRedactor</c> and still logs
|
|
/// without a health counter. The one deliberate difference is that
|
|
/// <c>IngestCachedTelemetryCommand</c> now takes the real dual-write handler rather than the
|
|
/// deleted "no dual write" stub; no fixture built on this helper sends that message.
|
|
/// </para>
|
|
/// </summary>
|
|
internal static class StubAuditRepositoryProvider
|
|
{
|
|
/// <summary>
|
|
/// Builds a provider whose every scope yields the same audit-log repository instance.
|
|
/// </summary>
|
|
/// <param name="repository">Repository instance shared by every scope.</param>
|
|
/// <returns>A service provider whose scopes all resolve the supplied repository.</returns>
|
|
public static ServiceProvider Build(IAuditLogRepository repository)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(repository);
|
|
|
|
return new ServiceCollection()
|
|
.AddScoped(_ => repository)
|
|
.BuildServiceProvider();
|
|
}
|
|
}
|