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.
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user