Files
scadalink-design/tests/ScadaLink.AuditLog.Tests/TestSupport/FakeNodeIdentityProvider.cs
Joseph Doherty 479870e40c feat(audit): stamp SourceNode at site SqliteAuditWriter from INodeIdentityProvider
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.
2026-05-23 17:08:21 -04:00

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;
}
}