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.
50 lines
1.9 KiB
C#
50 lines
1.9 KiB
C#
using NSubstitute;
|
|
using ZB.MOM.WW.ScadaBridge.AuditLog.Site;
|
|
using ZB.MOM.WW.ScadaBridge.HealthMonitoring;
|
|
|
|
namespace ZB.MOM.WW.ScadaBridge.AuditLog.Tests.Site;
|
|
|
|
/// <summary>
|
|
/// The <see cref="HealthMetricsAuditWriteFailureCounter"/>
|
|
/// adapter is the production binding for <see cref="IAuditWriteFailureCounter"/>
|
|
/// on site nodes; it forwards every FallbackAuditWriter primary failure into
|
|
/// the shared <see cref="ISiteHealthCollector"/> so the site health report
|
|
/// surfaces the failure count as <c>SiteAuditWriteFailures</c>.
|
|
/// </summary>
|
|
public class HealthMetricsAuditWriteFailureCounterTests
|
|
{
|
|
/// <summary>Verifies that a single increment is routed to the collector as a site audit write failure.</summary>
|
|
[Fact]
|
|
public void Increment_Routes_To_Collector_IncrementSiteAuditWriteFailures()
|
|
{
|
|
var collector = Substitute.For<ISiteHealthCollector>();
|
|
var counter = new HealthMetricsAuditWriteFailureCounter(collector);
|
|
|
|
counter.Increment();
|
|
|
|
collector.Received(1).IncrementSiteAuditWriteFailures();
|
|
}
|
|
|
|
/// <summary>Verifies that each of several increments is routed to the collector.</summary>
|
|
[Fact]
|
|
public void Increment_Multiple_Calls_Route_To_Collector_Each_Time()
|
|
{
|
|
var collector = Substitute.For<ISiteHealthCollector>();
|
|
var counter = new HealthMetricsAuditWriteFailureCounter(collector);
|
|
|
|
counter.Increment();
|
|
counter.Increment();
|
|
counter.Increment();
|
|
|
|
collector.Received(3).IncrementSiteAuditWriteFailures();
|
|
}
|
|
|
|
/// <summary>Verifies that constructing the counter with a null collector throws an <see cref="ArgumentNullException"/>.</summary>
|
|
[Fact]
|
|
public void Construction_With_Null_Collector_Throws_ArgumentNullException()
|
|
{
|
|
Assert.Throws<ArgumentNullException>(
|
|
() => new HealthMetricsAuditWriteFailureCounter(null!));
|
|
}
|
|
}
|