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.
44 lines
1.7 KiB
C#
44 lines
1.7 KiB
C#
using ZB.MOM.WW.ScadaBridge.SiteRuntime.Tracking;
|
|
|
|
namespace ZB.MOM.WW.ScadaBridge.SiteRuntime.Tests.Tracking;
|
|
|
|
/// <summary>
|
|
/// Eager startup validation for <see cref="OperationTrackingOptions"/>
|
|
/// (arch-review 08 round 2 NF4). The store opens the SQLite connection string at
|
|
/// construction, so an empty connection string must fail the host at boot; the
|
|
/// retention window must be positive or terminal-row purge would delete
|
|
/// everything.
|
|
/// </summary>
|
|
public class OperationTrackingOptionsValidatorTests
|
|
{
|
|
/// <summary>Verifies that default options are valid.</summary>
|
|
[Fact]
|
|
public void DefaultOptions_AreValid()
|
|
{
|
|
var validator = new OperationTrackingOptionsValidator();
|
|
Assert.True(validator.Validate(null, new OperationTrackingOptions()).Succeeded);
|
|
}
|
|
|
|
/// <summary>Verifies that empty connection string fails.</summary>
|
|
[Fact]
|
|
public void EmptyConnectionString_Fails()
|
|
{
|
|
var validator = new OperationTrackingOptionsValidator();
|
|
var result = validator.Validate(null, new OperationTrackingOptions { ConnectionString = "" });
|
|
Assert.False(result.Succeeded);
|
|
Assert.Contains(result.Failures!,
|
|
f => f.Contains(nameof(OperationTrackingOptions.ConnectionString), StringComparison.Ordinal));
|
|
}
|
|
|
|
/// <summary>Verifies that zero retention days fails.</summary>
|
|
[Fact]
|
|
public void ZeroRetentionDays_Fails()
|
|
{
|
|
var validator = new OperationTrackingOptionsValidator();
|
|
var result = validator.Validate(null, new OperationTrackingOptions { RetentionDays = 0 });
|
|
Assert.False(result.Succeeded);
|
|
Assert.Contains(result.Failures!,
|
|
f => f.Contains(nameof(OperationTrackingOptions.RetentionDays), StringComparison.Ordinal));
|
|
}
|
|
}
|