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>
This commit is contained in:
Joseph Doherty
2026-03-31 07:58:13 -04:00
parent 55ef854612
commit 41a6b66943
221 changed files with 4274 additions and 3823 deletions

View File

@@ -35,4 +35,4 @@ internal sealed class FakeApplicationConfigurationFactory : IApplicationConfigur
return Task.FromResult(config);
}
}
}

View File

@@ -9,7 +9,8 @@ internal sealed class FakeEndpointDiscovery : IEndpointDiscovery
public int SelectCallCount { get; private set; }
public string? LastEndpointUrl { get; private set; }
public EndpointDescription SelectEndpoint(ApplicationConfiguration config, string endpointUrl, MessageSecurityMode requestedMode)
public EndpointDescription SelectEndpoint(ApplicationConfiguration config, string endpointUrl,
MessageSecurityMode requestedMode)
{
SelectCallCount++;
LastEndpointUrl = endpointUrl;
@@ -31,4 +32,4 @@ internal sealed class FakeEndpointDiscovery : IEndpointDiscovery
}
};
}
}
}

View File

@@ -5,17 +5,8 @@ namespace ZB.MOM.WW.LmxOpcUa.Client.Shared.Tests.Fakes;
internal sealed class FakeSessionAdapter : ISessionAdapter
{
private readonly List<FakeSubscriptionAdapter> _createdSubscriptions = [];
private Action<bool>? _keepAliveCallback;
private readonly List<FakeSubscriptionAdapter> _createdSubscriptions = new();
public bool Connected { get; set; } = true;
public string SessionId { get; set; } = "ns=0;i=12345";
public string SessionName { get; set; } = "FakeSession";
public string EndpointUrl { get; set; } = "opc.tcp://localhost:4840";
public string ServerName { get; set; } = "FakeServer";
public string SecurityMode { get; set; } = "None";
public string SecurityPolicyUri { get; set; } = "http://opcfoundation.org/UA/SecurityPolicy#None";
public NamespaceTable NamespaceUris { get; set; } = new();
public bool Closed { get; private set; }
public bool Disposed { get; private set; }
@@ -35,38 +26,39 @@ internal sealed class FakeSessionAdapter : ISessionAdapter
public bool ThrowOnWrite { get; set; }
public bool ThrowOnBrowse { get; set; }
public ReferenceDescriptionCollection BrowseResponse { get; set; } = new();
public ReferenceDescriptionCollection BrowseResponse { get; set; } = [];
public byte[]? BrowseContinuationPoint { get; set; }
public ReferenceDescriptionCollection BrowseNextResponse { get; set; } = new();
public ReferenceDescriptionCollection BrowseNextResponse { get; set; } = [];
public byte[]? BrowseNextContinuationPoint { get; set; }
public bool HasChildrenResponse { get; set; } = false;
public List<DataValue> HistoryReadRawResponse { get; set; } = new();
public List<DataValue> HistoryReadAggregateResponse { get; set; } = new();
public List<DataValue> HistoryReadRawResponse { get; set; } = [];
public List<DataValue> HistoryReadAggregateResponse { get; set; } = [];
public bool ThrowOnHistoryReadRaw { get; set; }
public bool ThrowOnHistoryReadAggregate { get; set; }
/// <summary>
/// The next FakeSubscriptionAdapter to return from CreateSubscriptionAsync.
/// If null, a new one is created automatically.
/// The next FakeSubscriptionAdapter to return from CreateSubscriptionAsync.
/// If null, a new one is created automatically.
/// </summary>
public FakeSubscriptionAdapter? NextSubscription { get; set; }
public IReadOnlyList<FakeSubscriptionAdapter> CreatedSubscriptions => _createdSubscriptions;
public bool Connected { get; set; } = true;
public string SessionId { get; set; } = "ns=0;i=12345";
public string SessionName { get; set; } = "FakeSession";
public string EndpointUrl { get; set; } = "opc.tcp://localhost:4840";
public string ServerName { get; set; } = "FakeServer";
public string SecurityMode { get; set; } = "None";
public string SecurityPolicyUri { get; set; } = "http://opcfoundation.org/UA/SecurityPolicy#None";
public NamespaceTable NamespaceUris { get; set; } = new();
public void RegisterKeepAliveHandler(Action<bool> callback)
{
_keepAliveCallback = callback;
}
/// <summary>
/// Simulates a keep-alive event.
/// </summary>
public void SimulateKeepAlive(bool isGood)
{
_keepAliveCallback?.Invoke(isGood);
}
public Task<DataValue> ReadValueAsync(NodeId nodeId, CancellationToken ct)
{
ReadCount++;
@@ -119,7 +111,8 @@ internal sealed class FakeSessionAdapter : ISessionAdapter
}
public Task<IReadOnlyList<DataValue>> HistoryReadAggregateAsync(
NodeId nodeId, DateTime startTime, DateTime endTime, NodeId aggregateId, double intervalMs, CancellationToken ct)
NodeId nodeId, DateTime startTime, DateTime endTime, NodeId aggregateId, double intervalMs,
CancellationToken ct)
{
HistoryReadAggregateCount++;
if (ThrowOnHistoryReadAggregate)
@@ -147,4 +140,12 @@ internal sealed class FakeSessionAdapter : ISessionAdapter
Disposed = true;
Connected = false;
}
}
/// <summary>
/// Simulates a keep-alive event.
/// </summary>
public void SimulateKeepAlive(bool isGood)
{
_keepAliveCallback?.Invoke(isGood);
}
}

View File

@@ -5,21 +5,13 @@ namespace ZB.MOM.WW.LmxOpcUa.Client.Shared.Tests.Fakes;
internal sealed class FakeSessionFactory : ISessionFactory
{
private readonly List<FakeSessionAdapter> _createdSessions = [];
private readonly Queue<FakeSessionAdapter> _sessions = new();
private readonly List<FakeSessionAdapter> _createdSessions = new();
public int CreateCallCount { get; private set; }
public bool ThrowOnCreate { get; set; }
public string? LastEndpointUrl { get; private set; }
/// <summary>
/// Enqueues a session adapter to be returned on the next call to CreateSessionAsync.
/// </summary>
public void EnqueueSession(FakeSessionAdapter session)
{
_sessions.Enqueue(session);
}
public IReadOnlyList<FakeSessionAdapter> CreatedSessions => _createdSessions;
public Task<ISessionAdapter> CreateSessionAsync(
@@ -34,11 +26,8 @@ internal sealed class FakeSessionFactory : ISessionFactory
FakeSessionAdapter session;
if (_sessions.Count > 0)
{
session = _sessions.Dequeue();
}
else
{
session = new FakeSessionAdapter
{
EndpointUrl = endpoint.EndpointUrl,
@@ -46,11 +35,18 @@ internal sealed class FakeSessionFactory : ISessionFactory
SecurityMode = endpoint.SecurityMode.ToString(),
SecurityPolicyUri = endpoint.SecurityPolicyUri ?? string.Empty
};
}
// Ensure endpoint URL matches
session.EndpointUrl = endpoint.EndpointUrl;
_createdSessions.Add(session);
return Task.FromResult<ISessionAdapter>(session);
}
}
/// <summary>
/// Enqueues a session adapter to be returned on the next call to CreateSessionAsync.
/// </summary>
public void EnqueueSession(FakeSessionAdapter session)
{
_sessions.Enqueue(session);
}
}

View File

@@ -5,10 +5,11 @@ namespace ZB.MOM.WW.LmxOpcUa.Client.Shared.Tests.Fakes;
internal sealed class FakeSubscriptionAdapter : ISubscriptionAdapter
{
private uint _nextHandle = 100;
private readonly Dictionary<uint, (NodeId NodeId, Action<string, DataValue>? DataCallback, Action<EventFieldList>? EventCallback)> _items = new();
private readonly
Dictionary<uint, (NodeId NodeId, Action<string, DataValue>? DataCallback, Action<EventFieldList>? EventCallback
)> _items = new();
public uint SubscriptionId { get; set; } = 42;
private uint _nextHandle = 100;
public bool Deleted { get; private set; }
public bool ConditionRefreshCalled { get; private set; }
public bool ThrowOnConditionRefresh { get; set; }
@@ -16,7 +17,15 @@ internal sealed class FakeSubscriptionAdapter : ISubscriptionAdapter
public int AddEventCount { get; private set; }
public int RemoveCount { get; private set; }
public Task<uint> AddDataChangeMonitoredItemAsync(NodeId nodeId, int samplingIntervalMs, Action<string, DataValue> onDataChange, CancellationToken ct)
/// <summary>
/// Gets the handles of all active items.
/// </summary>
public IReadOnlyCollection<uint> ActiveHandles => _items.Keys.ToList();
public uint SubscriptionId { get; set; } = 42;
public Task<uint> AddDataChangeMonitoredItemAsync(NodeId nodeId, int samplingIntervalMs,
Action<string, DataValue> onDataChange, CancellationToken ct)
{
AddDataChangeCount++;
var handle = _nextHandle++;
@@ -31,7 +40,8 @@ internal sealed class FakeSubscriptionAdapter : ISubscriptionAdapter
return Task.CompletedTask;
}
public Task<uint> AddEventMonitoredItemAsync(NodeId nodeId, int samplingIntervalMs, EventFilter filter, Action<EventFieldList> onEvent, CancellationToken ct)
public Task<uint> AddEventMonitoredItemAsync(NodeId nodeId, int samplingIntervalMs, EventFilter filter,
Action<EventFieldList> onEvent, CancellationToken ct)
{
AddEventCount++;
var handle = _nextHandle++;
@@ -60,29 +70,19 @@ internal sealed class FakeSubscriptionAdapter : ISubscriptionAdapter
}
/// <summary>
/// Simulates a data change notification for testing.
/// Simulates a data change notification for testing.
/// </summary>
public void SimulateDataChange(uint handle, DataValue value)
{
if (_items.TryGetValue(handle, out var item) && item.DataCallback != null)
{
item.DataCallback(item.NodeId.ToString(), value);
}
}
/// <summary>
/// Simulates an event notification for testing.
/// Simulates an event notification for testing.
/// </summary>
public void SimulateEvent(uint handle, EventFieldList eventFields)
{
if (_items.TryGetValue(handle, out var item) && item.EventCallback != null)
{
item.EventCallback(eventFields);
}
if (_items.TryGetValue(handle, out var item) && item.EventCallback != null) item.EventCallback(eventFields);
}
/// <summary>
/// Gets the handles of all active items.
/// </summary>
public IReadOnlyCollection<uint> ActiveHandles => _items.Keys.ToList();
}
}