diff --git a/.editorconfig b/.editorconfig index 1d9dae68..e2c75376 100644 --- a/.editorconfig +++ b/.editorconfig @@ -207,7 +207,6 @@ dotnet_naming_symbols.constants_with_k.applicable_accessibilities = dotnet_naming_symbols.constants_with_k.required_modifiers = const dotnet_naming_style.constants_with_k_style.capitalization = pascal_case -dotnet_naming_style.constants_with_k_style.required_prefix = k # Constants are PascalCase dotnet_naming_rule.constants_should_be_pascal_case.severity = suggestion @@ -314,6 +313,6 @@ dotnet_diagnostic.CA1852.severity = # CA1860: Avoid using 'Enumerable.Any()' extension method dotnet_diagnostic.CA1860.severity = suggestion -# CA1861: Prefer 'static readonly' fields over constant array arguments if the called method is called repeatedly and is not mutating the passed array +# CA1861: Prefer 'static readonly' fields over constant array arguments if the called method is called repeatedly and is not mutating the passed array dotnet_diagnostic.CA1861.severity = suggestion diff --git a/src/OpcApplicationConfiguration.cs b/src/OpcApplicationConfiguration.cs index a72c77ea..c3de303f 100644 --- a/src/OpcApplicationConfiguration.cs +++ b/src/OpcApplicationConfiguration.cs @@ -70,8 +70,8 @@ public async Task ConfigureAsync() var transportQuotas = new TransportQuotas { MaxStringLength = OpcMaxStringLength, - MaxMessageSize = 4 * 1024 * 1024, // 4MB. - MaxByteStringLength = 4 * 1024 * 1024, // 4MB. + MaxMessageSize = 4 * 1024 * 1024, // 4 MB. + MaxByteStringLength = 4 * 1024 * 1024, // 4 MB. }; var operationLimits = new OperationLimits() diff --git a/tests/DataMonitoringTests.cs b/tests/DataMonitoringTests.cs index 7698a1ee..60345065 100644 --- a/tests/DataMonitoringTests.cs +++ b/tests/DataMonitoringTests.cs @@ -1,5 +1,6 @@ -namespace OpcPlc.Tests; - +namespace OpcPlc.Tests; + +using System; using System.Linq; using FluentAssertions; using NUnit.Framework; @@ -13,7 +14,7 @@ namespace OpcPlc.Tests; public class DataMonitoringTests : SubscriptionTestsBase { // Set any cmd params needed for the plc server explicitly. - public DataMonitoringTests() : base(new string[] { }) + public DataMonitoringTests() : base(Array.Empty()) { } diff --git a/tests/DeterministicAlarmsTests2.cs b/tests/DeterministicAlarmsTests2.cs index 9de9a19f..adedee91 100644 --- a/tests/DeterministicAlarmsTests2.cs +++ b/tests/DeterministicAlarmsTests2.cs @@ -53,7 +53,7 @@ public void VerifyThatTimeForEventsChanges() NodeShouldHaveStates(doorOpen1, Inactive, Disabled); - Assert.AreNotEqual(timeForFirstEvent, timeForNextEvent); + timeForFirstEvent.Should().NotBe(timeForNextEvent); } private void AdvanceToNextStep() diff --git a/tests/PlcSimulatorFixture.cs b/tests/PlcSimulatorFixture.cs index cfc2946a..d93a288d 100644 --- a/tests/PlcSimulatorFixture.cs +++ b/tests/PlcSimulatorFixture.cs @@ -77,7 +77,7 @@ public PlcSimulatorFixture(string[] args) /// Configure and run the simulator in a background thread, run once for the entire assembly. /// The simulator is instrumented with mock time services. /// - public async Task Start() + public async Task StartAsync() { Reset(); @@ -137,7 +137,7 @@ public async Task Start() .GetAwaiter().GetResult()); string endpointUrl = WaitForServerUp(); - await _log.WriteAsync($"Found server at: {endpointUrl}"); + await _log.WriteAsync($"Found server at: {endpointUrl}").ConfigureAwait(false); if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { @@ -146,14 +146,14 @@ public async Task Start() // Use the Loopback IP address as a workaround. // In contrast, on Windows Azure DevOps builds, this results in issues. endpointUrl = $"opc.tcp://{IPAddress.Loopback}:{Port}"; - await _log.WriteAsync($"Connecting to server URL: {endpointUrl}"); + await _log.WriteAsync($"Connecting to server URL: {endpointUrl}").ConfigureAwait(false); } - _config = await GetConfigurationAsync(); + _config = await GetConfigurationAsync().ConfigureAwait(false); _serverEndpoint = GetServerEndpoint(endpointUrl); } - public Task Stop() + public Task StopAsync() { // shutdown simulator _serverCancellationTokenSource.Cancel(); @@ -223,7 +223,7 @@ private static void Reset() private async Task GetConfigurationAsync() { - await _log.WriteLineAsync("Create Application Configuration"); + await _log.WriteLineAsync("Create Application Configuration").ConfigureAwait(false); var application = new ApplicationInstance { diff --git a/tests/SimulatorNodesTests.cs b/tests/SimulatorNodesTests.cs index 85e8764b..3d292a1a 100644 --- a/tests/SimulatorNodesTests.cs +++ b/tests/SimulatorNodesTests.cs @@ -73,7 +73,7 @@ public void Telemetry_FastNode() } else { - Assert.AreEqual(lastValue + 1, value); + value.Should().Be(lastValue + 1); lastValue = value; } @@ -85,17 +85,17 @@ public void Telemetry_FastNode() CallMethod("StopUpdateFastNodes"); var nextValue = ReadValue(nodeId); - Assert.AreEqual(lastValue, nextValue); + nextValue.Should().Be(lastValue); FireTimersWithPeriod(FromSeconds(1), numberOfTimes: 1); nextValue = ReadValue(nodeId); - Assert.AreEqual(lastValue, nextValue); + nextValue.Should().Be(lastValue); FireTimersWithPeriod(FromSeconds(1), numberOfTimes: 1); CallMethod("StartUpdateFastNodes"); FireTimersWithPeriod(FromSeconds(1), numberOfTimes: 1); nextValue = ReadValue(nodeId); - Assert.AreEqual(lastValue + 1, nextValue); + nextValue.Should().Be(lastValue + 1); } [TestCase("DipData", -1000)] diff --git a/tests/SimulatorTestsBase.cs b/tests/SimulatorTestsBase.cs index ef1897cf..6cd050a9 100644 --- a/tests/SimulatorTestsBase.cs +++ b/tests/SimulatorTestsBase.cs @@ -40,8 +40,8 @@ protected SimulatorTestsBase(string[] args = default) [OneTimeSetUp] public async Task Setup() { - await _simulator.Start(); - Session = await _simulator.CreateSessionAsync(GetType().Name); + await _simulator.StartAsync().ConfigureAwait(false); + Session = await _simulator.CreateSessionAsync(GetType().Name).ConfigureAwait(false); } /// Closes the OPC-UA session and stops the simulator. @@ -49,7 +49,7 @@ public async Task Setup() public async Task TearDown() { Session.Close(); - await _simulator.Stop(); + await _simulator.StopAsync().ConfigureAwait(false); } /// diff --git a/tests/opc-plc-tests.csproj b/tests/opc-plc-tests.csproj index 0c75245b..65b45daf 100644 --- a/tests/opc-plc-tests.csproj +++ b/tests/opc-plc-tests.csproj @@ -10,7 +10,7 @@ - + diff --git a/tools/scripts/acr-build.ps1 b/tools/scripts/acr-build.ps1 index f1e4df2c..b22b08b2 100644 --- a/tools/scripts/acr-build.ps1 +++ b/tools/scripts/acr-build.ps1 @@ -204,7 +204,7 @@ if (![string]::IsNullOrEmpty($metadata.tag)) { $fullImageName = "$($Registry).azurecr.io/$($namespace)$($imageName):$($tagPrefix)$($sourceTag)$($tagPostfix)" Write-Host "Full image name: $($fullImageName)" -$manifest = @" +$manifest = @" image: $($fullImageName) tags: [$($tagPrefix)$($latestTag)$($tagPostfix)] manifests: diff --git a/tools/scripts/docker-source.ps1 b/tools/scripts/docker-source.ps1 index 727c1da0..81d0a778 100644 --- a/tools/scripts/docker-source.ps1 +++ b/tools/scripts/docker-source.ps1 @@ -52,6 +52,7 @@ if ($projFile) { $argumentList += "-r" $argumentList += $runtimeId $argumentList += "/p:TargetLatestRuntimePatch=true" + $argumentList += "--self-contained" } else { $runtimeId = "portable" diff --git a/version.json b/version.json index 8da508ca..e9bc44b9 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", - "version": "2.9.14", + "version": "2.9.15", "versionHeightOffset": -1, "publicReleaseRefSpec": [ "^refs/heads/main$",