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.
45 lines
1.9 KiB
C#
45 lines
1.9 KiB
C#
using ZB.MOM.WW.ScadaBridge.AuditLog.Central;
|
|
|
|
namespace ZB.MOM.WW.ScadaBridge.AuditLog.Tests.Central;
|
|
|
|
/// <summary>
|
|
/// Eager startup validation for <see cref="AuditLogPartitionMaintenanceOptions"/>
|
|
/// (arch-review 08 round 2 NF4). A zero tick interval spins the maintenance
|
|
/// hosted service; a zero look-ahead leaves the partition function without a
|
|
/// future monthly boundary, risking inserts into the unbounded tail partition.
|
|
/// </summary>
|
|
public class AuditLogPartitionMaintenanceOptionsValidatorTests
|
|
{
|
|
/// <summary>Verifies that the default options pass validation.</summary>
|
|
[Fact]
|
|
public void DefaultOptions_AreValid()
|
|
{
|
|
var validator = new AuditLogPartitionMaintenanceOptionsValidator();
|
|
Assert.True(validator.Validate(null, new AuditLogPartitionMaintenanceOptions()).Succeeded);
|
|
}
|
|
|
|
/// <summary>Verifies that a zero interval fails validation and names the interval property.</summary>
|
|
[Fact]
|
|
public void ZeroIntervalSeconds_Fails()
|
|
{
|
|
var validator = new AuditLogPartitionMaintenanceOptionsValidator();
|
|
var result = validator.Validate(null,
|
|
new AuditLogPartitionMaintenanceOptions { IntervalSeconds = 0 });
|
|
Assert.False(result.Succeeded);
|
|
Assert.Contains(result.Failures!,
|
|
f => f.Contains(nameof(AuditLogPartitionMaintenanceOptions.IntervalSeconds), StringComparison.Ordinal));
|
|
}
|
|
|
|
/// <summary>Verifies that a zero look-ahead fails validation and names the look-ahead property.</summary>
|
|
[Fact]
|
|
public void ZeroLookaheadMonths_Fails()
|
|
{
|
|
var validator = new AuditLogPartitionMaintenanceOptionsValidator();
|
|
var result = validator.Validate(null,
|
|
new AuditLogPartitionMaintenanceOptions { LookaheadMonths = 0 });
|
|
Assert.False(result.Succeeded);
|
|
Assert.Contains(result.Failures!,
|
|
f => f.Contains(nameof(AuditLogPartitionMaintenanceOptions.LookaheadMonths), StringComparison.Ordinal));
|
|
}
|
|
}
|