fix(dcl): feed ScadaBridge:MxGateway:ClientNamePrefix into the MxGateway client-name fallback (review 2026-10-21 02/U1, 08/O2)

This commit is contained in:
Joseph Doherty
2026-10-22 06:29:05 -04:00
parent f18d3adbfc
commit 3543a7f295
6 changed files with 71 additions and 6 deletions
@@ -59,6 +59,25 @@ public class MxGatewayDataConnectionTests
Assert.Equal("scadabridge", fake.ConnectedWith!.ClientName);
}
/// <summary>
/// Review 2026-10-21 02/U1: a blank per-connection ClientName falls back to the configured
/// <c>ScadaBridge:MxGateway:ClientNamePrefix</c> rather than a hard-coded literal.
/// </summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task ConnectAsync_blank_client_name_uses_configured_prefix()
{
var fake = new FakeMxGatewayClient();
var adapter = new MxGatewayDataConnection(
fake, NullLogger<MxGatewayDataConnection>.Instance, clientNamePrefix: "plant7-scadabridge");
var details = Details();
details["ClientName"] = " ";
await adapter.ConnectAsync(details);
Assert.Equal("plant7-scadabridge", fake.ConnectedWith!.ClientName);
}
/// <summary>Verifies that the Disconnected event fires exactly once when the event loop faults.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]