Group all 69 projects into category subfolders under src/ and tests/ so the Rider Solution Explorer mirrors the module structure. Folders: Core, Server, Drivers (with a nested Driver CLIs subfolder), Client, Tooling. - Move every project folder on disk with git mv (history preserved as renames). - Recompute relative paths in 57 .csproj files: cross-category ProjectReferences, the lib/ HintPath+None refs in Driver.Historian.Wonderware, and the external mxaccessgw refs in Driver.Galaxy and its test project. - Rebuild ZB.MOM.WW.OtOpcUa.slnx with nested solution folders. - Re-prefix project paths in functional scripts (e2e, compliance, smoke SQL, integration, install). Build green (0 errors); unit tests pass. Docs left for a separate pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
93 lines
3.1 KiB
C#
93 lines
3.1 KiB
C#
using Shouldly;
|
|
using Xunit;
|
|
using ZB.MOM.WW.OtOpcUa.Client.CLI.Commands;
|
|
using ZB.MOM.WW.OtOpcUa.Client.CLI.Tests.Fakes;
|
|
using ZB.MOM.WW.OtOpcUa.Client.Shared.Models;
|
|
|
|
namespace ZB.MOM.WW.OtOpcUa.Client.CLI.Tests;
|
|
|
|
public class RedundancyCommandTests
|
|
{
|
|
[Fact]
|
|
public async Task Execute_PrintsRedundancyInfo()
|
|
{
|
|
var fakeService = new FakeOpcUaClientService
|
|
{
|
|
RedundancyInfoResult = new RedundancyInfo(
|
|
"Hot", 250, ["urn:server:primary", "urn:server:secondary"], "urn:app:myserver")
|
|
};
|
|
var factory = new FakeOpcUaClientServiceFactory(fakeService);
|
|
var command = new RedundancyCommand(factory)
|
|
{
|
|
Url = "opc.tcp://localhost:4840"
|
|
};
|
|
|
|
using var console = TestConsoleHelper.CreateConsole();
|
|
await command.ExecuteAsync(console);
|
|
|
|
var output = TestConsoleHelper.GetOutput(console);
|
|
output.ShouldContain("Redundancy Mode: Hot");
|
|
output.ShouldContain("Service Level: 250");
|
|
output.ShouldContain("Server URIs:");
|
|
output.ShouldContain(" - urn:server:primary");
|
|
output.ShouldContain(" - urn:server:secondary");
|
|
output.ShouldContain("Application URI: urn:app:myserver");
|
|
}
|
|
|
|
[Fact]
|
|
public async Task Execute_NoServerUris_OmitsUriSection()
|
|
{
|
|
var fakeService = new FakeOpcUaClientService
|
|
{
|
|
RedundancyInfoResult = new RedundancyInfo(
|
|
"None", 100, [], "urn:app:standalone")
|
|
};
|
|
var factory = new FakeOpcUaClientServiceFactory(fakeService);
|
|
var command = new RedundancyCommand(factory)
|
|
{
|
|
Url = "opc.tcp://localhost:4840"
|
|
};
|
|
|
|
using var console = TestConsoleHelper.CreateConsole();
|
|
await command.ExecuteAsync(console);
|
|
|
|
var output = TestConsoleHelper.GetOutput(console);
|
|
output.ShouldContain("Redundancy Mode: None");
|
|
output.ShouldContain("Service Level: 100");
|
|
output.ShouldNotContain("Server URIs:");
|
|
output.ShouldContain("Application URI: urn:app:standalone");
|
|
}
|
|
|
|
[Fact]
|
|
public async Task Execute_CallsGetRedundancyInfo()
|
|
{
|
|
var fakeService = new FakeOpcUaClientService();
|
|
var factory = new FakeOpcUaClientServiceFactory(fakeService);
|
|
var command = new RedundancyCommand(factory)
|
|
{
|
|
Url = "opc.tcp://localhost:4840"
|
|
};
|
|
|
|
using var console = TestConsoleHelper.CreateConsole();
|
|
await command.ExecuteAsync(console);
|
|
|
|
fakeService.GetRedundancyInfoCalled.ShouldBeTrue();
|
|
}
|
|
|
|
[Fact]
|
|
public async Task Execute_DisconnectsInFinally()
|
|
{
|
|
var fakeService = new FakeOpcUaClientService();
|
|
var factory = new FakeOpcUaClientServiceFactory(fakeService);
|
|
var command = new RedundancyCommand(factory)
|
|
{
|
|
Url = "opc.tcp://localhost:4840"
|
|
};
|
|
|
|
using var console = TestConsoleHelper.CreateConsole();
|
|
await command.ExecuteAsync(console);
|
|
|
|
fakeService.DisconnectCalled.ShouldBeTrue();
|
|
fakeService.DisposeCalled.ShouldBeTrue();
|
|
}
|
|
} |