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:
@@ -10,8 +10,8 @@ public class OpcUaClientServiceTests : IDisposable
|
||||
{
|
||||
private readonly FakeApplicationConfigurationFactory _configFactory = new();
|
||||
private readonly FakeEndpointDiscovery _endpointDiscovery = new();
|
||||
private readonly FakeSessionFactory _sessionFactory = new();
|
||||
private readonly OpcUaClientService _service;
|
||||
private readonly FakeSessionFactory _sessionFactory = new();
|
||||
|
||||
public OpcUaClientServiceTests()
|
||||
{
|
||||
@@ -23,11 +23,14 @@ public class OpcUaClientServiceTests : IDisposable
|
||||
_service.Dispose();
|
||||
}
|
||||
|
||||
private ConnectionSettings ValidSettings(string url = "opc.tcp://localhost:4840") => new()
|
||||
private ConnectionSettings ValidSettings(string url = "opc.tcp://localhost:4840")
|
||||
{
|
||||
EndpointUrl = url,
|
||||
SessionTimeoutSeconds = 60
|
||||
};
|
||||
return new ConnectionSettings
|
||||
{
|
||||
EndpointUrl = url,
|
||||
SessionTimeoutSeconds = 60
|
||||
};
|
||||
}
|
||||
|
||||
// --- Connection tests ---
|
||||
|
||||
@@ -243,15 +246,15 @@ public class OpcUaClientServiceTests : IDisposable
|
||||
{
|
||||
var session = new FakeSessionAdapter
|
||||
{
|
||||
BrowseResponse = new ReferenceDescriptionCollection
|
||||
{
|
||||
BrowseResponse =
|
||||
[
|
||||
new ReferenceDescription
|
||||
{
|
||||
NodeId = new ExpandedNodeId("ns=2;s=Child1"),
|
||||
DisplayName = new LocalizedText("Child1"),
|
||||
NodeClass = NodeClass.Variable
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
_sessionFactory.EnqueueSession(session);
|
||||
await _service.ConnectAsync(ValidSettings());
|
||||
@@ -269,12 +272,12 @@ public class OpcUaClientServiceTests : IDisposable
|
||||
{
|
||||
var session = new FakeSessionAdapter
|
||||
{
|
||||
BrowseResponse = new ReferenceDescriptionCollection()
|
||||
BrowseResponse = []
|
||||
};
|
||||
_sessionFactory.EnqueueSession(session);
|
||||
await _service.ConnectAsync(ValidSettings());
|
||||
|
||||
await _service.BrowseAsync(null);
|
||||
await _service.BrowseAsync();
|
||||
|
||||
session.BrowseCount.ShouldBe(1);
|
||||
}
|
||||
@@ -284,15 +287,15 @@ public class OpcUaClientServiceTests : IDisposable
|
||||
{
|
||||
var session = new FakeSessionAdapter
|
||||
{
|
||||
BrowseResponse = new ReferenceDescriptionCollection
|
||||
{
|
||||
BrowseResponse =
|
||||
[
|
||||
new ReferenceDescription
|
||||
{
|
||||
NodeId = new ExpandedNodeId("ns=2;s=Folder1"),
|
||||
DisplayName = new LocalizedText("Folder1"),
|
||||
NodeClass = NodeClass.Object
|
||||
}
|
||||
},
|
||||
],
|
||||
HasChildrenResponse = true
|
||||
};
|
||||
_sessionFactory.EnqueueSession(session);
|
||||
@@ -309,25 +312,25 @@ public class OpcUaClientServiceTests : IDisposable
|
||||
{
|
||||
var session = new FakeSessionAdapter
|
||||
{
|
||||
BrowseResponse = new ReferenceDescriptionCollection
|
||||
{
|
||||
BrowseResponse =
|
||||
[
|
||||
new ReferenceDescription
|
||||
{
|
||||
NodeId = new ExpandedNodeId("ns=2;s=A"),
|
||||
DisplayName = new LocalizedText("A"),
|
||||
NodeClass = NodeClass.Variable
|
||||
}
|
||||
},
|
||||
BrowseContinuationPoint = new byte[] { 1, 2, 3 },
|
||||
BrowseNextResponse = new ReferenceDescriptionCollection
|
||||
{
|
||||
],
|
||||
BrowseContinuationPoint = [1, 2, 3],
|
||||
BrowseNextResponse =
|
||||
[
|
||||
new ReferenceDescription
|
||||
{
|
||||
NodeId = new ExpandedNodeId("ns=2;s=B"),
|
||||
DisplayName = new LocalizedText("B"),
|
||||
NodeClass = NodeClass.Variable
|
||||
}
|
||||
},
|
||||
],
|
||||
BrowseNextContinuationPoint = null
|
||||
};
|
||||
_sessionFactory.EnqueueSession(session);
|
||||
@@ -436,7 +439,7 @@ public class OpcUaClientServiceTests : IDisposable
|
||||
_sessionFactory.EnqueueSession(session);
|
||||
await _service.ConnectAsync(ValidSettings());
|
||||
|
||||
await _service.SubscribeAlarmsAsync(null, 1000);
|
||||
await _service.SubscribeAlarmsAsync();
|
||||
|
||||
session.CreatedSubscriptions.Count.ShouldBe(1);
|
||||
session.CreatedSubscriptions[0].AddEventCount.ShouldBe(1);
|
||||
@@ -472,21 +475,21 @@ public class OpcUaClientServiceTests : IDisposable
|
||||
var handle = fakeSub.ActiveHandles.First();
|
||||
var fields = new EventFieldList
|
||||
{
|
||||
EventFields = new VariantCollection
|
||||
{
|
||||
new Variant(new byte[] { 1, 2, 3 }), // 0: EventId
|
||||
new Variant(ObjectTypeIds.AlarmConditionType), // 1: EventType
|
||||
new Variant("Source1"), // 2: SourceName
|
||||
new Variant(DateTime.UtcNow), // 3: Time
|
||||
new Variant(new LocalizedText("High temp")), // 4: Message
|
||||
new Variant((ushort)500), // 5: Severity
|
||||
new Variant("HighTemp"), // 6: ConditionName
|
||||
new Variant(true), // 7: Retain
|
||||
new Variant(false), // 8: AckedState
|
||||
new Variant(true), // 9: ActiveState
|
||||
new Variant(true), // 10: EnabledState
|
||||
new Variant(false) // 11: SuppressedOrShelved
|
||||
}
|
||||
EventFields =
|
||||
[
|
||||
new Variant(new byte[] { 1, 2, 3 }), // 0: EventId
|
||||
new Variant(ObjectTypeIds.AlarmConditionType), // 1: EventType
|
||||
new Variant("Source1"), // 2: SourceName
|
||||
new Variant(DateTime.UtcNow), // 3: Time
|
||||
new Variant(new LocalizedText("High temp")), // 4: Message
|
||||
new Variant((ushort)500), // 5: Severity
|
||||
new Variant("HighTemp"), // 6: ConditionName
|
||||
new Variant(true), // 7: Retain
|
||||
new Variant(false), // 8: AckedState
|
||||
new Variant(true), // 9: ActiveState
|
||||
new Variant(true), // 10: EnabledState
|
||||
new Variant(false)
|
||||
]
|
||||
};
|
||||
fakeSub.SimulateEvent(handle, fields);
|
||||
|
||||
@@ -563,8 +566,8 @@ public class OpcUaClientServiceTests : IDisposable
|
||||
{
|
||||
var expectedValues = new List<DataValue>
|
||||
{
|
||||
new DataValue(new Variant(1.0), StatusCodes.Good),
|
||||
new DataValue(new Variant(2.0), StatusCodes.Good)
|
||||
new(new Variant(1.0), StatusCodes.Good),
|
||||
new(new Variant(2.0), StatusCodes.Good)
|
||||
};
|
||||
var session = new FakeSessionAdapter { HistoryReadRawResponse = expectedValues };
|
||||
_sessionFactory.EnqueueSession(session);
|
||||
@@ -600,7 +603,7 @@ public class OpcUaClientServiceTests : IDisposable
|
||||
{
|
||||
var expectedValues = new List<DataValue>
|
||||
{
|
||||
new DataValue(new Variant(1.5), StatusCodes.Good)
|
||||
new(new Variant(1.5), StatusCodes.Good)
|
||||
};
|
||||
var session = new FakeSessionAdapter { HistoryReadAggregateResponse = expectedValues };
|
||||
_sessionFactory.EnqueueSession(session);
|
||||
@@ -650,9 +653,9 @@ public class OpcUaClientServiceTests : IDisposable
|
||||
if (nodeId == VariableIds.Server_ServiceLevel)
|
||||
return new DataValue(new Variant((byte)200), StatusCodes.Good);
|
||||
if (nodeId == VariableIds.Server_ServerRedundancy_ServerUriArray)
|
||||
return new DataValue(new Variant(new[] { "urn:server1", "urn:server2" }), StatusCodes.Good);
|
||||
return new DataValue(new Variant(["urn:server1", "urn:server2"]), StatusCodes.Good);
|
||||
if (nodeId == VariableIds.Server_ServerArray)
|
||||
return new DataValue(new Variant(new[] { "urn:server1" }), StatusCodes.Good);
|
||||
return new DataValue(new Variant(["urn:server1"]), StatusCodes.Good);
|
||||
return new DataValue(StatusCodes.BadNodeIdUnknown);
|
||||
}
|
||||
};
|
||||
@@ -663,14 +666,14 @@ public class OpcUaClientServiceTests : IDisposable
|
||||
|
||||
info.Mode.ShouldBe("Warm");
|
||||
info.ServiceLevel.ShouldBe((byte)200);
|
||||
info.ServerUris.ShouldBe(new[] { "urn:server1", "urn:server2" });
|
||||
info.ServerUris.ShouldBe(["urn:server1", "urn:server2"]);
|
||||
info.ApplicationUri.ShouldBe("urn:server1");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task GetRedundancyInfoAsync_MissingOptionalArrays_ReturnsGracefully()
|
||||
{
|
||||
int readCallIndex = 0;
|
||||
var readCallIndex = 0;
|
||||
var session = new FakeSessionAdapter
|
||||
{
|
||||
ReadResponseFunc = nodeId =>
|
||||
@@ -712,7 +715,7 @@ public class OpcUaClientServiceTests : IDisposable
|
||||
_sessionFactory.EnqueueSession(session2);
|
||||
|
||||
var settings = ValidSettings("opc.tcp://primary:4840");
|
||||
settings.FailoverUrls = new[] { "opc.tcp://backup:4840" };
|
||||
settings.FailoverUrls = ["opc.tcp://backup:4840"];
|
||||
|
||||
var stateChanges = new List<ConnectionStateChangedEventArgs>();
|
||||
_service.ConnectionStateChanged += (_, e) => stateChanges.Add(e);
|
||||
@@ -728,7 +731,7 @@ public class OpcUaClientServiceTests : IDisposable
|
||||
// Should have reconnected
|
||||
stateChanges.ShouldContain(e => e.NewState == ConnectionState.Reconnecting);
|
||||
stateChanges.ShouldContain(e => e.NewState == ConnectionState.Connected &&
|
||||
e.EndpointUrl == "opc.tcp://backup:4840");
|
||||
e.EndpointUrl == "opc.tcp://backup:4840");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -744,7 +747,7 @@ public class OpcUaClientServiceTests : IDisposable
|
||||
_sessionFactory.EnqueueSession(session2);
|
||||
|
||||
var settings = ValidSettings("opc.tcp://primary:4840");
|
||||
settings.FailoverUrls = new[] { "opc.tcp://backup:4840" };
|
||||
settings.FailoverUrls = ["opc.tcp://backup:4840"];
|
||||
|
||||
await _service.ConnectAsync(settings);
|
||||
session1.SimulateKeepAlive(false);
|
||||
@@ -813,4 +816,4 @@ public class OpcUaClientServiceTests : IDisposable
|
||||
service.ShouldBeAssignableTo<IOpcUaClientService>();
|
||||
service.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user