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.
32 lines
1.5 KiB
C#
32 lines
1.5 KiB
C#
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Options;
|
|
|
|
namespace ZB.MOM.WW.ScadaBridge.DataConnectionLayer.Tests;
|
|
|
|
/// <summary>
|
|
/// Locks the config section <see cref="ServiceCollectionExtensions.AddDataConnectionLayer"/>
|
|
/// binds (arch-review 08 round 2 NF8). Every real appsettings nests this section under
|
|
/// <c>ScadaBridge:</c>; binding a root-level <c>DataConnectionLayer</c> section reads config
|
|
/// that no deployment writes — the drift the Host duplicate was silently masking.
|
|
/// AddDataConnectionLayer alone must bind the canonical <c>ScadaBridge:DataConnection</c> section.
|
|
/// </summary>
|
|
public class DataConnectionOptionsBindingTests
|
|
{
|
|
/// <summary>Verifies that add data connection layer binds the scada bridge data connection section.</summary>
|
|
[Fact]
|
|
public void AddDataConnectionLayer_BindsTheScadaBridgeDataConnectionSection()
|
|
{
|
|
var config = new ConfigurationBuilder().AddInMemoryCollection(new Dictionary<string, string?>
|
|
{
|
|
["ScadaBridge:DataConnection:ReconnectInterval"] = "00:00:42",
|
|
}).Build();
|
|
var services = new ServiceCollection();
|
|
services.AddSingleton<IConfiguration>(config);
|
|
services.AddDataConnectionLayer();
|
|
using var sp = services.BuildServiceProvider();
|
|
Assert.Equal(TimeSpan.FromSeconds(42),
|
|
sp.GetRequiredService<IOptions<DataConnectionOptions>>().Value.ReconnectInterval);
|
|
}
|
|
}
|