diff --git a/src/Configuration/OpcApplicationConfiguration.cs b/src/Configuration/OpcApplicationConfiguration.cs
index c4b4e051..962bf535 100644
--- a/src/Configuration/OpcApplicationConfiguration.cs
+++ b/src/Configuration/OpcApplicationConfiguration.cs
@@ -44,12 +44,12 @@ public string Hostname
///
/// Enables unsecure endpoint access to the application.
///
- public bool EnableUnsecureTransport { get; set; } = false;
+ public bool EnableUnsecureTransport { get; set; }
///
/// Sets the LDS registration interval in milliseconds.
///
- public int LdsRegistrationInterval { get; set; } = 0;
+ public int LdsRegistrationInterval { get; set; }
///
/// Set the max string length the OPC stack supports.
diff --git a/src/DeterministicAlarms/DeterministicAlarmsNodeManager.cs b/src/DeterministicAlarms/DeterministicAlarmsNodeManager.cs
index b86fbd5f..ddd00bda 100644
--- a/src/DeterministicAlarms/DeterministicAlarmsNodeManager.cs
+++ b/src/DeterministicAlarms/DeterministicAlarmsNodeManager.cs
@@ -9,12 +9,13 @@ namespace OpcPlc.DeterministicAlarms;
using System;
using System.Collections.Generic;
using System.IO;
-
+using System.Linq;
+
public class DeterministicAlarmsNodeManager : CustomNodeManager2
{
private readonly SimBackendService _system;
private readonly List _folders = new();
- private uint _nodeIdCounter = 0;
+ private uint _nodeIdCounter;
private List _rootNotifiers;
private readonly IServerInternal _server;
private readonly ServerSystemContext _defaultSystemContext;
@@ -119,11 +120,11 @@ private void ReplayScriptStart(Configuration.Configuration scriptConfiguration)
{
VerifyScriptConfiguration(scriptConfiguration);
_logger.LogInformation("Script starts executing");
- var scriptEngine = new ScriptEngine(scriptConfiguration.Script, OnScriptStepAvailable, _timeService);
+ _ = new ScriptEngine(scriptConfiguration.Script, OnScriptStepAvailable, _timeService);
}
catch (ScriptException ex)
{
- _logger.LogError($"Script Engine Exception '{ex.Message}'\nSCRIPT WILL NOT START");
+ _logger.LogError(ex, $"Script Engine Exception '{ex.Message}'\nSCRIPT WILL NOT START");
throw;
}
}
@@ -512,7 +513,7 @@ public override ServiceResult ConditionRefresh(
OperationContext context,
IList monitoredItems)
{
- foreach (MonitoredItem monitoredItem in monitoredItems)
+ foreach (var monitoredItem in monitoredItems.Cast())
{
if (monitoredItem == null)
{
diff --git a/src/Helpers/MetricsHelper.cs b/src/Helpers/MetricsHelper.cs
index 26c6b4ed..4e2b98a6 100644
--- a/src/Helpers/MetricsHelper.cs
+++ b/src/Helpers/MetricsHelper.cs
@@ -153,7 +153,7 @@ public static void AddMonitoredItemCount(int delta = 1)
///
/// Add a published count.
///
- public static void AddPublishedCount(string sessionId, string subscriptionId, int dataChanges, int events)
+ public static void AddPublishedCount(int dataChanges, int events)
{
if (!IsEnabled)
{
diff --git a/src/Helpers/PnJsonHelper.cs b/src/Helpers/PnJsonHelper.cs
index f007c8ee..7d770975 100644
--- a/src/Helpers/PnJsonHelper.cs
+++ b/src/Helpers/PnJsonHelper.cs
@@ -52,7 +52,7 @@ public static async Task PrintPublisherConfigJsonAsync(string pnJsonFileName, st
sb.AppendLine("]");
string pnJson = sb.ToString();
- logger.LogInformation("OPC Publisher configuration file: {pnJsonFile}", $"{pnJsonFileName}{pnJson}");
+ logger.LogInformation("OPC Publisher configuration file: {PnJsonFile}", $"{pnJsonFileName}{pnJson}");
await File.WriteAllTextAsync(pnJsonFileName, pnJson.Trim()).ConfigureAwait(false);
}
diff --git a/src/OpcPlcServer.cs b/src/OpcPlcServer.cs
index e78a5ad2..eaec0b69 100644
--- a/src/OpcPlcServer.cs
+++ b/src/OpcPlcServer.cs
@@ -84,7 +84,7 @@ public async Task StartAsync(string[] args, CancellationToken cancellationToken
// Validate and parse extra arguments.
if (extraArgs.Count > 0)
{
- Logger.LogWarning($"Found one or more invalid command line arguments: {string.Join(" ", extraArgs)}");
+ Logger.LogWarning("Found one or more invalid command line arguments: {InvalidArgs}", string.Join(" ", extraArgs));
Logger.LogInformation(CliOptions.GetUsageHelp(Config.ProgramName));
}
@@ -196,20 +196,20 @@ private void StartWebServer(IHost host)
if (Config.ShowPublisherConfigJsonIp)
{
- Logger.LogInformation("Web server started: {pnJsonUri}", $"http://{GetIpAddress()}:{Config.WebServerPort}/{Config.PnJson}");
+ Logger.LogInformation("Web server started: {PnJsonUri}", $"http://{GetIpAddress()}:{Config.WebServerPort}/{Config.PnJson}");
}
else if (Config.ShowPublisherConfigJsonPh)
{
- Logger.LogInformation("Web server started: {pnJsonUri}", $"http://{Config.OpcUa.Hostname}:{Config.WebServerPort}/{Config.PnJson}");
+ Logger.LogInformation("Web server started: {PnJsonUri}", $"http://{Config.OpcUa.Hostname}:{Config.WebServerPort}/{Config.PnJson}");
}
else
{
- Logger.LogInformation("Web server started on port {webServerPort}", Config.WebServerPort);
+ Logger.LogInformation("Web server started on port {WebServerPort}", Config.WebServerPort);
}
}
catch (Exception e)
{
- Logger.LogError("Could not start web server on port {webServerPort}: {message}",
+ Logger.LogError(e, "Could not start web server on port {WebServerPort}: {Message}",
Config.WebServerPort,
e.Message);
}
@@ -289,22 +289,22 @@ private async Task StartPlcServerAndSimulationAsync()
ApplicationConfiguration plcApplicationConfiguration = await opcUaAppConfigFactory.ConfigureAsync().ConfigureAwait(false);
// start the server.
- Logger.LogInformation("Starting server on endpoint {endpoint} ...", plcApplicationConfiguration.ServerConfiguration.BaseAddresses[0]);
+ Logger.LogInformation("Starting server on endpoint {Endpoint} ...", plcApplicationConfiguration.ServerConfiguration.BaseAddresses[0]);
Logger.LogInformation("Simulation settings are:");
Logger.LogInformation("One simulation phase consists of {SimulationCycleCount} cycles", PlcSimulationInstance.SimulationCycleCount);
Logger.LogInformation("One cycle takes {SimulationCycleLength} ms", PlcSimulationInstance.SimulationCycleLength);
- Logger.LogInformation("Reference test simulation: {addReferenceTestSimulation}",
+ Logger.LogInformation("Reference test simulation: {AddReferenceTestSimulation}",
PlcSimulationInstance.AddReferenceTestSimulation ? "Enabled" : "Disabled");
- Logger.LogInformation("Simple events: {addSimpleEventsSimulation}",
+ Logger.LogInformation("Simple events: {AddSimpleEventsSimulation}",
PlcSimulationInstance.AddSimpleEventsSimulation ? "Enabled" : "Disabled");
- Logger.LogInformation("Alarms: {addAlarmSimulation}", PlcSimulationInstance.AddAlarmSimulation ? "Enabled" : "Disabled");
- Logger.LogInformation("Deterministic alarms: {deterministicAlarmSimulation}",
+ Logger.LogInformation("Alarms: {AddAlarmSimulation}", PlcSimulationInstance.AddAlarmSimulation ? "Enabled" : "Disabled");
+ Logger.LogInformation("Deterministic alarms: {DeterministicAlarmSimulation}",
PlcSimulationInstance.DeterministicAlarmSimulationFile != null ? "Enabled" : "Disabled");
- Logger.LogInformation("Anonymous authentication: {anonymousAuth}", Config.DisableAnonymousAuth ? "Disabled" : "Enabled");
- Logger.LogInformation("Reject chain validation with CA certs with unknown revocation status: {rejectValidationUnknownRevocStatus}", Config.OpcUa.DontRejectUnknownRevocationStatus ? "Disabled" : "Enabled");
- Logger.LogInformation("Username/Password authentication: {usernamePasswordAuth}", Config.DisableUsernamePasswordAuth ? "Disabled" : "Enabled");
- Logger.LogInformation("Certificate authentication: {certAuth}", Config.DisableCertAuth ? "Disabled" : "Enabled");
+ Logger.LogInformation("Anonymous authentication: {AnonymousAuth}", Config.DisableAnonymousAuth ? "Disabled" : "Enabled");
+ Logger.LogInformation("Reject chain validation with CA certs with unknown revocation status: {RejectValidationUnknownRevocStatus}", Config.OpcUa.DontRejectUnknownRevocationStatus ? "Disabled" : "Enabled");
+ Logger.LogInformation("Username/Password authentication: {UsernamePasswordAuth}", Config.DisableUsernamePasswordAuth ? "Disabled" : "Enabled");
+ Logger.LogInformation("Certificate authentication: {CertAuth}", Config.DisableCertAuth ? "Disabled" : "Enabled");
// Add simple events, alarms, reference test simulation and deterministic alarms.
PlcServer = new PlcServer(Config, PlcSimulationInstance, TimeService, _pluginNodes, Logger);
diff --git a/src/PlcNodeManager.cs b/src/PlcNodeManager.cs
index 1f506a7a..78757046 100644
--- a/src/PlcNodeManager.cs
+++ b/src/PlcNodeManager.cs
@@ -183,7 +183,7 @@ private BaseDataVariableState CreateBaseVariable(BaseDataVariableState baseDataV
{
ushort namespaceIndex = NamespaceIndexes[(int)namespaceType];
- if (path is uint || path is long)
+ if (path is uint or long)
{
baseDataVariableState.NodeId = new NodeId((uint)path, namespaceIndex);
baseDataVariableState.BrowseName = new QualifiedName(((uint)path).ToString(), namespaceIndex);
@@ -195,7 +195,7 @@ private BaseDataVariableState CreateBaseVariable(BaseDataVariableState baseDataV
}
else
{
- _logger.LogDebug("NodeId type is {nodeIdType}", (string)path.GetType().ToString());
+ _logger.LogDebug("NodeId type is {NodeIdType}", (string)path.GetType().ToString());
baseDataVariableState.NodeId = new NodeId(path, namespaceIndex);
baseDataVariableState.BrowseName = new QualifiedName(name, namespaceIndex);
}
diff --git a/src/PlcServer.cs b/src/PlcServer.cs
index ec36fd8e..c92c423a 100644
--- a/src/PlcServer.cs
+++ b/src/PlcServer.cs
@@ -265,7 +265,7 @@ public override ResponseHeader Publish(
if (PublishMetricsEnabled)
{
- AddPublishMetrics(notificationMessage, context.SessionId.ToString(), subscriptionId.ToString());
+ AddPublishMetrics(notificationMessage);
}
LogSuccessWithSessionIdAndSubscriptionId(
@@ -431,13 +431,13 @@ protected override MasterNodeManager CreateMasterNodeManager(IServerInternal ser
{
string errorMessage = "The script file for deterministic testing is not set (deterministicalarms)";
LogErrorMessage(errorMessage);
- throw new Exception(errorMessage);
+ throw new ArgumentNullException(errorMessage);
}
if (!File.Exists(scriptFileName))
{
string errorMessage = $"The script file ({scriptFileName}) for deterministic testing does not exist";
LogErrorMessage(errorMessage);
- throw new Exception(errorMessage);
+ throw new InvalidOperationException(errorMessage);
}
DeterministicAlarmsNodeManager = new DeterministicAlarmsNodeManager(server, configuration, TimeService, scriptFileName, _logger);
@@ -574,7 +574,7 @@ protected override void OnServerStopping()
base.OnServerStopping();
}
- private void AddPublishMetrics(NotificationMessage notificationMessage, string sessionId, string subscriptionId)
+ private void AddPublishMetrics(NotificationMessage notificationMessage)
{
int events = 0;
int dataChanges = 0;
@@ -596,7 +596,7 @@ private void AddPublishMetrics(NotificationMessage notificationMessage, string s
}
});
- MetricsHelper.AddPublishedCount(sessionId, subscriptionId, dataChanges, events);
+ MetricsHelper.AddPublishedCount(dataChanges, events);
}
[LoggerMessage(
diff --git a/src/PlcSimulation.cs b/src/PlcSimulation.cs
index be723f68..8ccf23a9 100644
--- a/src/PlcSimulation.cs
+++ b/src/PlcSimulation.cs
@@ -32,7 +32,7 @@ public PlcSimulation(ImmutableList pluginNodes)
public bool AddReferenceTestSimulation { get; set; } = true;
public string DeterministicAlarmSimulationFile { get; set; }
- public uint EventInstanceCount { get; set; } = 0;
+ public uint EventInstanceCount { get; set; }
public uint EventInstanceRate { get; set; } = 1000; // ms.
///
@@ -128,5 +128,5 @@ private void Disable(ITimer timer)
private PlcServer _plcServer;
private ITimer _eventInstanceGenerator;
- private uint _eventInstanceCycle = 0;
+ private uint _eventInstanceCycle;
}
diff --git a/src/PluginNodes/Boiler2PluginNodes.cs b/src/PluginNodes/Boiler2PluginNodes.cs
index b57ce42e..95e386ec 100644
--- a/src/PluginNodes/Boiler2PluginNodes.cs
+++ b/src/PluginNodes/Boiler2PluginNodes.cs
@@ -40,7 +40,7 @@ public class Boiler2PluginNodes(TimeService timeService, ILogger logger) : Plugi
private TimeSpan _maintenanceInterval = TimeSpan.FromSeconds(300); // 5 min.
private TimeSpan _overheatInterval = TimeSpan.FromSeconds(120); // 2 min.
- private bool _isOverheated = false;
+ private bool _isOverheated;
private readonly SemaphoreSlim _lock = new(1, 1);
public void AddOptions(Mono.Options.OptionSet optionSet)
diff --git a/src/PluginNodes/FastPluginNodes.cs b/src/PluginNodes/FastPluginNodes.cs
index 2d406430..61469914 100644
--- a/src/PluginNodes/FastPluginNodes.cs
+++ b/src/PluginNodes/FastPluginNodes.cs
@@ -18,14 +18,14 @@ public class FastPluginNodes(TimeService timeService, ILogger logger) : PluginNo
private NodeType NodeType { get; set; } = NodeType.UInt;
private string NodeMinValue { get; set; }
private string NodeMaxValue { get; set; }
- private bool NodeRandomization { get; set; } = false;
+ private bool NodeRandomization { get; set; }
private string NodeStepSize { get; set; } = "1";
private uint NodeSamplingInterval { get; set; } // ms.
private PlcNodeManager _plcNodeManager;
private SlowFastCommon _slowFastCommon;
- protected BaseDataVariableState[] _nodes = null;
- protected BaseDataVariableState[] _badNodes = null;
+ protected BaseDataVariableState[] _nodes;
+ protected BaseDataVariableState[] _badNodes;
private ITimer _nodeGenerator;
private bool _updateNodes = true;
diff --git a/src/PluginNodes/SlowFastCommon.cs b/src/PluginNodes/SlowFastCommon.cs
index 4d39450a..3f7d57d9 100644
--- a/src/PluginNodes/SlowFastCommon.cs
+++ b/src/PluginNodes/SlowFastCommon.cs
@@ -12,7 +12,7 @@ public class SlowFastCommon
private readonly Random _random = new();
private BaseDataVariableState _numberOfUpdates;
- private uint _badNodesCycle = 0;
+ private uint _badNodesCycle;
private const string NumberOfUpdates = "NumberOfUpdates";
public SlowFastCommon(PlcNodeManager plcNodeManager, TimeService timeService, ILogger logger)
@@ -43,8 +43,8 @@ private BaseDataVariableState[] CreateBaseLoadNodes(FolderState folder, string n
if (count > 0)
{
- _logger.LogInformation($"Creating {count} {name} nodes of type: {type}");
- _logger.LogInformation($"Node values will change every {nodeRate} ms");
+ _logger.LogInformation("Creating {Count} {Name} nodes of type: {Type}", count, name, type);
+ _logger.LogInformation("Node values will change every {NodeRate} ms", nodeRate);
}
for (int i = 0; i < count; i++)
@@ -140,7 +140,7 @@ private void UpdateNodes(BaseDataVariableState[] nodes, NodeType type, StatusCod
{
if (nodes == null || nodes.Length == 0)
{
- _logger.LogWarning("Invalid argument {argument} provided.", nodes);
+ _logger.LogWarning("Invalid argument {Argument} provided.", nodes);
return;
}
diff --git a/src/PluginNodes/SlowPluginNodes.cs b/src/PluginNodes/SlowPluginNodes.cs
index 762f1b32..ea7e8028 100644
--- a/src/PluginNodes/SlowPluginNodes.cs
+++ b/src/PluginNodes/SlowPluginNodes.cs
@@ -17,14 +17,14 @@ public class SlowPluginNodes(TimeService timeService, ILogger logger) : PluginNo
private NodeType NodeType { get; set; } = NodeType.UInt;
private string NodeMinValue { get; set; }
private string NodeMaxValue { get; set; }
- private bool NodeRandomization { get; set; } = false;
+ private bool NodeRandomization { get; set; }
private string NodeStepSize { get; set; } = "1";
private uint NodeSamplingInterval { get; set; } // ms.
private PlcNodeManager _plcNodeManager;
private SlowFastCommon _slowFastCommon;
- protected BaseDataVariableState[] _nodes = null;
- protected BaseDataVariableState[] _badNodes = null;
+ protected BaseDataVariableState[] _nodes;
+ protected BaseDataVariableState[] _badNodes;
private ITimer _nodeGenerator;
private bool _updateNodes = true;
diff --git a/src/TimeService.cs b/src/TimeService.cs
index 08bb5825..3cd41c22 100644
--- a/src/TimeService.cs
+++ b/src/TimeService.cs
@@ -99,9 +99,7 @@ public interface ITimer : IDisposable
void Close();
}
-public class FastTimerElapsedEventArgs : EventArgs
-{
-}
+public class FastTimerElapsedEventArgs : EventArgs;
public delegate void FastTimerElapsedEventHandler(object sender, FastTimerElapsedEventArgs e);
@@ -151,8 +149,8 @@ public bool Enabled
///
/// The current interval between triggering of this timer
///
- public double Interval { get; set; } = 0.0;
-
+ public double Interval { get; set; }
+
///
/// The event handler we call when the timer is triggered
///
@@ -268,6 +266,6 @@ public void Dispose()
private static readonly float _tickFrequency = 1000f / Stopwatch.Frequency;
- private bool _isEnabled = false;
- private int _isRunning = 0;
+ private bool _isEnabled;
+ private int _isRunning;
}
diff --git a/tests/AlarmTests.cs b/tests/AlarmTests.cs
index 472d0f9e..6856aace 100644
--- a/tests/AlarmTests.cs
+++ b/tests/AlarmTests.cs
@@ -10,7 +10,7 @@ public class AlarmTests : SubscriptionTestsBase
{
private NodeId _eventType;
- public AlarmTests() : base(new[] { "--alm" })
+ public AlarmTests() : base(["--alm"])
{
}
diff --git a/tests/Boiler2DeviceHealthEventsTests.cs b/tests/Boiler2DeviceHealthEventsTests.cs
index 649e20c4..f565746d 100644
--- a/tests/Boiler2DeviceHealthEventsTests.cs
+++ b/tests/Boiler2DeviceHealthEventsTests.cs
@@ -15,13 +15,13 @@ public class Boiler2DeviceHealthEventsTests : SubscriptionTestsBase
{
private NodeId _eventType;
- public Boiler2DeviceHealthEventsTests() : base(new[] {
+ public Boiler2DeviceHealthEventsTests() : base([
"--b2ts=5", // Temperature change speed.
"--b2bt=1", // Base temperature.
"--b2tt=123", // Target temperature.
"--b2mi=567", // Maintenance interval.
"--b2oi=678", // Overheat interval.
- })
+ ])
{
}
diff --git a/tests/Boiler2Tests.cs b/tests/Boiler2Tests.cs
index 1ecf6049..244f5c5b 100644
--- a/tests/Boiler2Tests.cs
+++ b/tests/Boiler2Tests.cs
@@ -13,13 +13,13 @@ namespace OpcPlc.Tests;
[TestFixture]
public class Boiler2Tests : SimulatorTestsBase
{
- public Boiler2Tests() : base(new[] {
+ public Boiler2Tests() : base([
"--b2ts=5", // Temperature change speed.
"--b2bt=1", // Base temperature.
"--b2tt=123", // Target temperature.
"--b2mi=567", // Maintenance interval.
"--b2oi=678", // Overheat interval.
- })
+ ])
{
}
diff --git a/tests/BoilerTests.cs b/tests/BoilerTests.cs
index 6780c5ce..92fc7e9e 100644
--- a/tests/BoilerTests.cs
+++ b/tests/BoilerTests.cs
@@ -16,7 +16,7 @@ namespace OpcPlc.Tests;
public class BoilerTests : SimulatorTestsBase
{
private ComplexTypeSystem _complexTypeSystem;
- public BoilerTests() : base(new[] { "--ctb" })
+ public BoilerTests() : base(["--ctb"])
{
}
diff --git a/tests/DataRandomizationTests.cs b/tests/DataRandomizationTests.cs
index 10acfea2..cb02914b 100644
--- a/tests/DataRandomizationTests.cs
+++ b/tests/DataRandomizationTests.cs
@@ -13,7 +13,7 @@
public class DataRandomizationTests : SubscriptionTestsBase
{
// Set any cmd params needed for the plc server explicitly
- public DataRandomizationTests() : base(new[] { "--str=true" })
+ public DataRandomizationTests() : base(["--str=true"])
{
}
diff --git a/tests/DeterministicAlarmsTests.cs b/tests/DeterministicAlarmsTests.cs
index 2c508cc4..13e3ff2f 100644
--- a/tests/DeterministicAlarmsTests.cs
+++ b/tests/DeterministicAlarmsTests.cs
@@ -16,10 +16,10 @@ public class DeterministicAlarmsTests : SubscriptionTestsBase
private static readonly LocalizedText Disabled = English("Disabled");
private static readonly LocalizedText Enabled = English("Enabled");
- public DeterministicAlarmsTests() : base(new[]
- {
+ public DeterministicAlarmsTests() : base(
+ [
"--dalm=DeterministicAlarmsTests/dalm001.json",
- })
+ ])
{
}
diff --git a/tests/DeterministicAlarmsTests2.cs b/tests/DeterministicAlarmsTests2.cs
index 0f0fef4d..4f891d82 100644
--- a/tests/DeterministicAlarmsTests2.cs
+++ b/tests/DeterministicAlarmsTests2.cs
@@ -16,10 +16,10 @@ public class DeterministicAlarmsTests2 : SubscriptionTestsBase
private static readonly LocalizedText Disabled = English("Disabled");
private static readonly LocalizedText Enabled = English("Enabled");
- public DeterministicAlarmsTests2() : base(new[]
- {
+ public DeterministicAlarmsTests2() : base(
+ [
"--dalm=DeterministicAlarmsTests/dalm002.json",
- })
+ ])
{
}
diff --git a/tests/EventInstancesTests.cs b/tests/EventInstancesTests.cs
index 8c7d12f9..88985cbc 100644
--- a/tests/EventInstancesTests.cs
+++ b/tests/EventInstancesTests.cs
@@ -16,7 +16,7 @@ public class EventInstancesTests : SubscriptionTestsBase
private NodeId _eventType;
// Set any cmd params needed for the plc server explicitly.
- public EventInstancesTests() : base(new[] { "--ei=1", "--er=1000" })
+ public EventInstancesTests() : base(["--ei=1", "--er=1000"])
{
}
diff --git a/tests/EventMonitoringTests.cs b/tests/EventMonitoringTests.cs
index d6709d21..5315afd9 100644
--- a/tests/EventMonitoringTests.cs
+++ b/tests/EventMonitoringTests.cs
@@ -13,7 +13,7 @@ public class EventMonitoringTests : SubscriptionTestsBase
{
private NodeId _eventType;
- public EventMonitoringTests() : base(new[] { "--simpleevents" })
+ public EventMonitoringTests() : base(["--simpleevents"])
{
}
diff --git a/tests/GuidNodesTests.cs b/tests/GuidNodesTests.cs
index a4c4dfa5..5adca8a6 100644
--- a/tests/GuidNodesTests.cs
+++ b/tests/GuidNodesTests.cs
@@ -10,7 +10,7 @@ namespace OpcPlc.Tests;
public class GuidNodesTests : SubscriptionTestsBase
{
// Set any cmd params needed for the plc server explicitly
- public GuidNodesTests() : base(new[] { "--gn=2" })
+ public GuidNodesTests() : base(["--gn=2"])
{
}
diff --git a/tests/MetricsTests.cs b/tests/MetricsTests.cs
index 4bb58e65..956b078f 100644
--- a/tests/MetricsTests.cs
+++ b/tests/MetricsTests.cs
@@ -85,7 +85,7 @@ public void TestAddPublishedCount()
{
var sessionId = Guid.NewGuid().ToString();
var subscriptionId = Guid.NewGuid().ToString();
- MetricsHelper.AddPublishedCount(sessionId, subscriptionId, 1, 0);
+ MetricsHelper.AddPublishedCount(1, 0);
_metrics.TryGetValue("opc_plc_published_count_with_type", out var counter).Should().BeTrue();
counter.Should().Be(1);
}
diff --git a/tests/SimulatorNodesTests.cs b/tests/SimulatorNodesTests.cs
index 3d292a1a..de8f2c67 100644
--- a/tests/SimulatorNodesTests.cs
+++ b/tests/SimulatorNodesTests.cs
@@ -15,7 +15,7 @@ namespace OpcPlc.Tests;
public class SimulatorNodesTests : SimulatorTestsBase
{
// Set any cmd params needed for the plc server explicitly.
- public SimulatorNodesTests() : base(new string[] { "--str=false" })
+ public SimulatorNodesTests() : base(["--str=false"])
{
}
diff --git a/tests/UserDefinedNodesTests.cs b/tests/UserDefinedNodesTests.cs
index 47da82b2..26c27a68 100644
--- a/tests/UserDefinedNodesTests.cs
+++ b/tests/UserDefinedNodesTests.cs
@@ -10,7 +10,7 @@
public class UserDefinedNodesTests : SubscriptionTestsBase
{
// Set any cmd params needed for the plc server explicitly
- public UserDefinedNodesTests() : base(new[] { "--nodesfile=nodesfile.json" })
+ public UserDefinedNodesTests() : base(["--nodesfile=nodesfile.json"])
{
}
diff --git a/tests/VariableTests.cs b/tests/VariableTests.cs
index d02b8f4a..4ea36da1 100644
--- a/tests/VariableTests.cs
+++ b/tests/VariableTests.cs
@@ -14,7 +14,7 @@ public class VariableTests : SimulatorTestsBase
private NodeId _scalarStaticNode;
// Set any cmd params needed for the plc server explicitly.
- public VariableTests() : base(new[] { "--ref" })
+ public VariableTests() : base(["--ref"])
{
}