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.
55 lines
1.7 KiB
C#
55 lines
1.7 KiB
C#
using Microsoft.Extensions.Options;
|
|
using ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Services;
|
|
|
|
namespace ZB.MOM.WW.ScadaBridge.Host.Tests;
|
|
|
|
/// <summary>
|
|
/// Tests for NodeIdentityProvider — surfaces the operator-configured semantic
|
|
/// node name (e.g. node-a / node-b / central-a / central-b) used by downstream
|
|
/// audit writers to stamp the SourceNode column.
|
|
/// </summary>
|
|
public class NodeIdentityProviderTests
|
|
{
|
|
private static INodeIdentityProvider BuildProvider(string nodeName)
|
|
{
|
|
var options = Options.Create(new NodeOptions { NodeName = nodeName });
|
|
return new NodeIdentityProvider(options);
|
|
}
|
|
|
|
/// <summary>Verifies that the provider returns the configured node name.</summary>
|
|
[Fact]
|
|
public void NodeIdentityProvider_returns_configured_NodeName()
|
|
{
|
|
var provider = BuildProvider("central-a");
|
|
|
|
Assert.Equal("central-a", provider.NodeName);
|
|
}
|
|
|
|
/// <summary>Verifies that the provider returns null when the node name is not set.</summary>
|
|
[Fact]
|
|
public void NodeIdentityProvider_returns_null_when_NodeName_unset()
|
|
{
|
|
var provider = BuildProvider(string.Empty);
|
|
|
|
Assert.Null(provider.NodeName);
|
|
}
|
|
|
|
/// <summary>Verifies that the provider returns null when the node name is only whitespace.</summary>
|
|
[Fact]
|
|
public void NodeIdentityProvider_returns_null_when_NodeName_whitespace()
|
|
{
|
|
var provider = BuildProvider(" ");
|
|
|
|
Assert.Null(provider.NodeName);
|
|
}
|
|
|
|
/// <summary>Verifies that the provider trims surrounding whitespace from the node name.</summary>
|
|
[Fact]
|
|
public void NodeIdentityProvider_trims_whitespace()
|
|
{
|
|
var provider = BuildProvider(" node-a ");
|
|
|
|
Assert.Equal("node-a", provider.NodeName);
|
|
}
|
|
}
|