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.
39 lines
1.7 KiB
C#
39 lines
1.7 KiB
C#
using ZB.MOM.WW.ScadaBridge.AuditLog.Site;
|
|
|
|
namespace ZB.MOM.WW.ScadaBridge.AuditLog.Tests.Site;
|
|
|
|
/// <summary>
|
|
/// Tests for <see cref="SiteAuditRetentionOptions"/> clamping.
|
|
/// The resolved knobs guard the daily site retention job against misconfiguration:
|
|
/// retention days are clamped to [1, 90]; the purge interval is clamped away from
|
|
/// TimeSpan.Zero (an Akka/Timer spin footgun).
|
|
/// </summary>
|
|
public class SiteAuditRetentionOptionsTests
|
|
{
|
|
/// <summary>Verifies that resolved retention days, clamps.</summary>
|
|
/// <param name="configured">Test case input.</param>
|
|
/// <param name="expected">Test case input.</param>
|
|
[Theory]
|
|
[InlineData(0, 1)] // clamp floor
|
|
[InlineData(7, 7)] // default passthrough
|
|
[InlineData(365, 90)] // clamp ceiling (spec: min 1, max 90)
|
|
public void ResolvedRetentionDays_Clamps(int configured, int expected)
|
|
=> Assert.Equal(expected, new SiteAuditRetentionOptions { RetentionDays = configured }.ResolvedRetentionDays);
|
|
|
|
/// <summary>Verifies that defaults, are, seven days, daily purge, five minute initial delay.</summary>
|
|
[Fact]
|
|
public void Defaults_Are_SevenDays_DailyPurge_FiveMinuteInitialDelay()
|
|
{
|
|
var o = new SiteAuditRetentionOptions();
|
|
Assert.Equal(7, o.ResolvedRetentionDays);
|
|
Assert.Equal(TimeSpan.FromHours(24), o.ResolvedPurgeInterval);
|
|
Assert.Equal(TimeSpan.FromMinutes(5), o.InitialDelay);
|
|
}
|
|
|
|
/// <summary>Verifies that resolved purge interval, clamps zero to one minute.</summary>
|
|
[Fact]
|
|
public void ResolvedPurgeInterval_ClampsZeroToOneMinute()
|
|
=> Assert.Equal(TimeSpan.FromMinutes(1),
|
|
new SiteAuditRetentionOptions { PurgeInterval = TimeSpan.Zero }.ResolvedPurgeInterval);
|
|
}
|