Caller-provided SourceNode wins (preserves reconciled rows from other nodes); otherwise the writer fills it from the local INodeIdentityProvider.NodeName. Reads from the provider on every write — singleton lifetime means zero overhead.
21 lines
721 B
C#
21 lines
721 B
C#
using ScadaLink.Commons.Interfaces.Services;
|
|
|
|
namespace ScadaLink.AuditLog.Tests.TestSupport;
|
|
|
|
/// <summary>
|
|
/// Test fake for <see cref="INodeIdentityProvider"/>. Returns the configured
|
|
/// <see cref="NodeName"/> verbatim — including <c>null</c> — so tests can
|
|
/// exercise both the "stamped" and "unconfigured" branches of the SourceNode
|
|
/// stamping logic in <see cref="ScadaLink.AuditLog.Site.SqliteAuditWriter"/>
|
|
/// and <see cref="ScadaLink.AuditLog.Central.CentralAuditWriter"/>.
|
|
/// </summary>
|
|
internal sealed class FakeNodeIdentityProvider : INodeIdentityProvider
|
|
{
|
|
public string? NodeName { get; }
|
|
|
|
public FakeNodeIdentityProvider(string? nodeName = null)
|
|
{
|
|
NodeName = nodeName;
|
|
}
|
|
}
|