Files
lmxopcua/tests/ZB.MOM.WW.LmxOpcUa.Client.Shared.Tests/Fakes/FakeEndpointDiscovery.cs
Joseph Doherty 41a6b66943 Apply code style formatting and restore partial modifiers on Avalonia views
Linter/formatter pass across the full codebase. Restores required partial
keyword on AXAML code-behind classes that the formatter incorrectly removed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 07:58:13 -04:00

35 lines
1.1 KiB
C#

using Opc.Ua;
using ZB.MOM.WW.LmxOpcUa.Client.Shared.Adapters;
namespace ZB.MOM.WW.LmxOpcUa.Client.Shared.Tests.Fakes;
internal sealed class FakeEndpointDiscovery : IEndpointDiscovery
{
public bool ThrowOnSelect { get; set; }
public int SelectCallCount { get; private set; }
public string? LastEndpointUrl { get; private set; }
public EndpointDescription SelectEndpoint(ApplicationConfiguration config, string endpointUrl,
MessageSecurityMode requestedMode)
{
SelectCallCount++;
LastEndpointUrl = endpointUrl;
if (ThrowOnSelect)
throw new InvalidOperationException($"No endpoint found for {endpointUrl}");
return new EndpointDescription
{
EndpointUrl = endpointUrl,
SecurityMode = requestedMode,
SecurityPolicyUri = requestedMode == MessageSecurityMode.None
? SecurityPolicies.None
: SecurityPolicies.Basic256Sha256,
Server = new ApplicationDescription
{
ApplicationName = "FakeServer",
ApplicationUri = "urn:localhost:FakeServer"
}
};
}
}