diff --git a/tests/Compliance/MTConnect-Compliance-Tests/MTConnect-Compliance-Tests.csproj b/tests/Compliance/MTConnect-Compliance-Tests/MTConnect-Compliance-Tests.csproj
index 5e741def2..c4fc68db8 100644
--- a/tests/Compliance/MTConnect-Compliance-Tests/MTConnect-Compliance-Tests.csproj
+++ b/tests/Compliance/MTConnect-Compliance-Tests/MTConnect-Compliance-Tests.csproj
@@ -11,8 +11,8 @@
-
-
+
+
diff --git a/tests/MTConnect.NET-AgentModule-MqttRelay-Tests/LastSentSequencePersisterTests.cs b/tests/MTConnect.NET-AgentModule-MqttRelay-Tests/LastSentSequencePersisterTests.cs
index 7fccbc448..c55fa0fd2 100644
--- a/tests/MTConnect.NET-AgentModule-MqttRelay-Tests/LastSentSequencePersisterTests.cs
+++ b/tests/MTConnect.NET-AgentModule-MqttRelay-Tests/LastSentSequencePersisterTests.cs
@@ -2,6 +2,7 @@
// TrakHound Inc. licenses this file to you under the MIT license.
using NUnit.Framework;
+using System;
namespace MTConnect.AgentModule.MqttRelay.Tests
{
@@ -90,7 +91,7 @@ public void TryFlush_keeps_dirty_when_writer_throws()
persister.Update(123UL);
Assert.Throws(
- () => persister.TryFlush(_ => throw new System.IO.IOException("disk full")));
+ (Action)(() => persister.TryFlush(_ => throw new System.IO.IOException("disk full"))));
Assert.That(persister.IsDirty, Is.True,
"A failed write must leave the persister dirty so the next flush retries.");
@@ -135,7 +136,7 @@ public void TryFlush_no_ops_when_writer_is_null()
// A null writer means the caller has not wired persistence
// (e.g. DurableRelay disabled at runtime); the persister
// must not throw.
- Assert.DoesNotThrow(() => persister.TryFlush(null));
+ Assert.DoesNotThrow((Action)(() => persister.TryFlush(null)));
// Dirty bit unchanged because no write happened.
Assert.That(persister.IsDirty, Is.True);
}
diff --git a/tests/MTConnect.NET-AgentModule-MqttRelay-Tests/MTConnect.NET-AgentModule-MqttRelay-Tests.csproj b/tests/MTConnect.NET-AgentModule-MqttRelay-Tests/MTConnect.NET-AgentModule-MqttRelay-Tests.csproj
index 6c2835679..8859d5f72 100644
--- a/tests/MTConnect.NET-AgentModule-MqttRelay-Tests/MTConnect.NET-AgentModule-MqttRelay-Tests.csproj
+++ b/tests/MTConnect.NET-AgentModule-MqttRelay-Tests/MTConnect.NET-AgentModule-MqttRelay-Tests.csproj
@@ -8,8 +8,8 @@
-
-
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/tests/MTConnect.NET-AgentModule-MqttRelay-Tests/MqttRelayLifecycleDisconnectTests.cs b/tests/MTConnect.NET-AgentModule-MqttRelay-Tests/MqttRelayLifecycleDisconnectTests.cs
index d2611d524..56184d2cb 100644
--- a/tests/MTConnect.NET-AgentModule-MqttRelay-Tests/MqttRelayLifecycleDisconnectTests.cs
+++ b/tests/MTConnect.NET-AgentModule-MqttRelay-Tests/MqttRelayLifecycleDisconnectTests.cs
@@ -89,10 +89,10 @@ public void DisconnectWithTimeout_does_not_throw_when_disconnect_factory_throws_
// and route the exception to the fault logger.
string loggedFault = null;
- Assert.DoesNotThrow(() => MqttRelayLifecycle.DisconnectWithTimeout(
+ Assert.DoesNotThrow((Action)(() => MqttRelayLifecycle.DisconnectWithTimeout(
disconnect: () => throw new InvalidOperationException("sync throw"),
timeout: TimeSpan.FromSeconds(1),
- onFault: ex => loggedFault = ex.Message));
+ onFault: ex => loggedFault = ex.Message)));
Assert.That(loggedFault, Is.EqualTo("sync throw"));
}
@@ -104,10 +104,10 @@ public void DisconnectWithTimeout_no_ops_when_disconnect_factory_is_null()
// The shutdown path must tolerate a null disconnect factory
// (for example when _mqttClient is null because the worker
// never ran).
- Assert.DoesNotThrow(() => MqttRelayLifecycle.DisconnectWithTimeout(
+ Assert.DoesNotThrow((Action)(() => MqttRelayLifecycle.DisconnectWithTimeout(
disconnect: null,
timeout: TimeSpan.FromSeconds(1),
- onFault: _ => { }));
+ onFault: _ => { })));
}
}
}
diff --git a/tests/MTConnect.NET-AgentModule-MqttRelay-Tests/MqttRelayLifecycleStopTests.cs b/tests/MTConnect.NET-AgentModule-MqttRelay-Tests/MqttRelayLifecycleStopTests.cs
index 061d132ea..05d59af5b 100644
--- a/tests/MTConnect.NET-AgentModule-MqttRelay-Tests/MqttRelayLifecycleStopTests.cs
+++ b/tests/MTConnect.NET-AgentModule-MqttRelay-Tests/MqttRelayLifecycleStopTests.cs
@@ -2,6 +2,7 @@
// TrakHound Inc. licenses this file to you under the MIT license.
using NUnit.Framework;
+using System;
namespace MTConnect.AgentModule.MqttRelay.Tests
{
@@ -32,7 +33,7 @@ public void StopServers_does_not_throw_when_both_servers_null()
// either server is the worst case; the helper must be a
// total function over (null, null).
Assert.DoesNotThrow(
- () => MqttRelayLifecycle.StopServers(documentStop: null, entityStop: null));
+ (Action)(() => MqttRelayLifecycle.StopServers(documentStop: null, entityStop: null)));
}
/// Pins the behaviour expressed by the test name: stop servers invokes document stop when provided.
@@ -85,9 +86,9 @@ public void StopServers_swallows_document_stop_exception_and_runs_entity_stop()
// shutdown leaks live handlers.
var entityStopped = false;
- Assert.DoesNotThrow(() => MqttRelayLifecycle.StopServers(
+ Assert.DoesNotThrow((Action)(() => MqttRelayLifecycle.StopServers(
documentStop: () => throw new System.InvalidOperationException("doc"),
- entityStop: () => entityStopped = true));
+ entityStop: () => entityStopped = true)));
Assert.That(entityStopped, Is.True);
}
diff --git a/tests/MTConnect.NET-AgentModule-MqttRelay-Tests/WorkerLoopExceptionLoggerTests.cs b/tests/MTConnect.NET-AgentModule-MqttRelay-Tests/WorkerLoopExceptionLoggerTests.cs
index 093b158ee..7c2070fe8 100644
--- a/tests/MTConnect.NET-AgentModule-MqttRelay-Tests/WorkerLoopExceptionLoggerTests.cs
+++ b/tests/MTConnect.NET-AgentModule-MqttRelay-Tests/WorkerLoopExceptionLoggerTests.cs
@@ -95,9 +95,9 @@ public void Log_no_ops_when_callback_is_null()
// Defensive: the helper must not throw when the logger is
// not wired (would defeat the purpose of catching the
// unexpected exception).
- Assert.DoesNotThrow(() => WorkerLoopExceptionLogger.Log(
+ Assert.DoesNotThrow((Action)(() => WorkerLoopExceptionLogger.Log(
exception: new InvalidOperationException("boom"),
- onLog: null));
+ onLog: null)));
}
/// Pins the behaviour expressed by the test name: log treats subclass of task canceled exception as cancellation.
diff --git a/tests/MTConnect.NET-Common-Tests/Agents/AgentMulticastIsolationTests.cs b/tests/MTConnect.NET-Common-Tests/Agents/AgentMulticastIsolationTests.cs
index 71d570b2f..de51690f6 100644
--- a/tests/MTConnect.NET-Common-Tests/Agents/AgentMulticastIsolationTests.cs
+++ b/tests/MTConnect.NET-Common-Tests/Agents/AgentMulticastIsolationTests.cs
@@ -65,7 +65,7 @@ public void Agent_DeviceAdded_NullInternalErrorSwallowsFault()
var device = new Device { Name = "device-1", Uuid = "uuid-1" };
EventHandler handler = (_, _) => throw new InvalidOperationException("DeviceAdded fault");
- Assert.DoesNotThrow(() => handler.Raise(this, (IDevice)device, null));
+ Assert.DoesNotThrow((Action)(() => handler.Raise(this, (IDevice)device, null)));
}
// -----------------------------------------------------------------------
@@ -96,7 +96,7 @@ public void Agent_ObservationReceived_NullInternalErrorSwallowsFault()
var obs = new ObservationInput();
EventHandler handler = (_, _) => throw new InvalidOperationException("ObservationReceived fault");
- Assert.DoesNotThrow(() => handler.Raise(this, (IObservationInput)obs, null));
+ Assert.DoesNotThrow((Action)(() => handler.Raise(this, (IObservationInput)obs, null)));
}
// -----------------------------------------------------------------------
@@ -127,7 +127,7 @@ public void Agent_ObservationAdded_NullInternalErrorSwallowsFault()
var obs = new Observation();
EventHandler handler = (_, _) => throw new InvalidOperationException("ObservationAdded fault");
- Assert.DoesNotThrow(() => handler.Raise(this, (IObservation)obs, null));
+ Assert.DoesNotThrow((Action)(() => handler.Raise(this, (IObservation)obs, null)));
}
// -----------------------------------------------------------------------
@@ -158,7 +158,7 @@ public void Agent_AssetAdded_NullInternalErrorSwallowsFault()
var asset = new Asset { AssetId = "a1", Timestamp = DateTime.UtcNow };
EventHandler handler = (_, _) => throw new InvalidOperationException("AssetAdded fault");
- Assert.DoesNotThrow(() => handler.Raise(this, (IAsset)asset, null));
+ Assert.DoesNotThrow((Action)(() => handler.Raise(this, (IAsset)asset, null)));
}
// -----------------------------------------------------------------------
@@ -187,7 +187,7 @@ public void AgentBroker_StreamsResponseSent_NullInternalErrorSwallowsFault()
{
EventHandler handler = (_, _) => throw new InvalidOperationException("StreamsResponseSent fault");
- Assert.DoesNotThrow(() => handler.Raise(this, EventArgs.Empty, null));
+ Assert.DoesNotThrow((Action)(() => handler.Raise(this, EventArgs.Empty, null)));
}
// -----------------------------------------------------------------------
@@ -201,7 +201,7 @@ public void Agent_NullGenericHandler_DoesNotThrow()
EventHandler? handler = null;
var device = new Device { Name = "noop-device", Uuid = "noop-uuid" };
- Assert.DoesNotThrow(() => handler.Raise(this, (IDevice)device, null));
+ Assert.DoesNotThrow((Action)(() => handler.Raise(this, (IDevice)device, null)));
}
/// Pins the behavior expressed by the test name: Raise with a null non-generic EventHandler is a safe no-op covering the no-subscriber case at runtime.
@@ -210,7 +210,7 @@ public void AgentBroker_NullNonGenericHandler_DoesNotThrow()
{
EventHandler? handler = null;
- Assert.DoesNotThrow(() => handler.Raise(this, EventArgs.Empty, null));
+ Assert.DoesNotThrow((Action)(() => handler.Raise(this, EventArgs.Empty, null)));
}
// =======================================================================
@@ -246,7 +246,7 @@ public void Agent_InvalidDeviceAdded_NullInternalErrorSwallowsFault()
var result = new ValidationResult(false, "bad device");
MTConnectDeviceValidationHandler handler = (_, _) => throw new InvalidOperationException("InvalidDeviceAdded fault");
- Assert.DoesNotThrow(() => MulticastIsolation.Raise(handler, h => h(device, result)));
+ Assert.DoesNotThrow((Action)(() => MulticastIsolation.Raise(handler, h => h(device, result))));
}
// -----------------------------------------------------------------------
@@ -278,7 +278,7 @@ public void Agent_InvalidComponentAdded_NullInternalErrorSwallowsFault()
var result = new ValidationResult(false, "bad component");
MTConnectComponentValidationHandler handler = (_, _, _) => throw new InvalidOperationException("InvalidComponentAdded fault");
- Assert.DoesNotThrow(() => MulticastIsolation.Raise(handler, h => h("uuid-1", component, result)));
+ Assert.DoesNotThrow((Action)(() => MulticastIsolation.Raise(handler, h => h("uuid-1", component, result))));
}
// -----------------------------------------------------------------------
@@ -310,7 +310,7 @@ public void Agent_InvalidCompositionAdded_NullInternalErrorSwallowsFault()
var result = new ValidationResult(false, "bad composition");
MTConnectCompositionValidationHandler handler = (_, _, _) => throw new InvalidOperationException("InvalidCompositionAdded fault");
- Assert.DoesNotThrow(() => MulticastIsolation.Raise(handler, h => h("uuid-1", composition, result)));
+ Assert.DoesNotThrow((Action)(() => MulticastIsolation.Raise(handler, h => h("uuid-1", composition, result))));
}
// -----------------------------------------------------------------------
@@ -342,7 +342,7 @@ public void Agent_InvalidDataItemAdded_NullInternalErrorSwallowsFault()
var result = new ValidationResult(false, "bad data item");
MTConnectDataItemValidationHandler handler = (_, _, _) => throw new InvalidOperationException("InvalidDataItemAdded fault");
- Assert.DoesNotThrow(() => MulticastIsolation.Raise(handler, h => h("uuid-1", dataItem, result)));
+ Assert.DoesNotThrow((Action)(() => MulticastIsolation.Raise(handler, h => h("uuid-1", dataItem, result))));
}
// -----------------------------------------------------------------------
@@ -372,7 +372,7 @@ public void Agent_InvalidObservationAdded_NullInternalErrorSwallowsFault()
var result = new ValidationResult(false, "bad observation");
MTConnectObservationValidationHandler handler = (_, _, _) => throw new InvalidOperationException("InvalidObservationAdded fault");
- Assert.DoesNotThrow(() => MulticastIsolation.Raise(handler, h => h("uuid-1", "key-1", result)));
+ Assert.DoesNotThrow((Action)(() => MulticastIsolation.Raise(handler, h => h("uuid-1", "key-1", result))));
}
// -----------------------------------------------------------------------
@@ -404,7 +404,7 @@ public void Agent_InvalidAssetAdded_NullInternalErrorSwallowsFault()
var result = new ValidationResult(false, "bad asset");
MTConnectAssetValidationHandler handler = (_, _) => throw new InvalidOperationException("InvalidAssetAdded fault");
- Assert.DoesNotThrow(() => MulticastIsolation.Raise(handler, h => h(asset, result)));
+ Assert.DoesNotThrow((Action)(() => MulticastIsolation.Raise(handler, h => h(asset, result))));
}
// =======================================================================
@@ -435,7 +435,7 @@ public void AgentBroker_DevicesRequestReceived_NullInternalErrorSwallowsFault()
{
MTConnectDevicesRequestedHandler handler = _ => throw new InvalidOperationException("DevicesRequestReceived fault");
- Assert.DoesNotThrow(() => MulticastIsolation.Raise(handler, h => h("uuid-1")));
+ Assert.DoesNotThrow((Action)(() => MulticastIsolation.Raise(handler, h => h("uuid-1"))));
}
// -----------------------------------------------------------------------
@@ -462,7 +462,7 @@ public void AgentBroker_DevicesResponseSent_NullInternalErrorSwallowsFault()
{
MTConnectDevicesHandler handler = _ => throw new InvalidOperationException("DevicesResponseSent fault");
- Assert.DoesNotThrow(() => MulticastIsolation.Raise(handler, h => h(null!)));
+ Assert.DoesNotThrow((Action)(() => MulticastIsolation.Raise(handler, h => h(null!))));
}
// -----------------------------------------------------------------------
@@ -489,7 +489,7 @@ public void AgentBroker_StreamsRequestReceived_NullInternalErrorSwallowsFault()
{
MTConnectStreamsRequestedHandler handler = _ => throw new InvalidOperationException("StreamsRequestReceived fault");
- Assert.DoesNotThrow(() => MulticastIsolation.Raise(handler, h => h("uuid-1")));
+ Assert.DoesNotThrow((Action)(() => MulticastIsolation.Raise(handler, h => h("uuid-1"))));
}
// -----------------------------------------------------------------------
@@ -518,7 +518,7 @@ public void AgentBroker_AssetsRequestReceived_NullInternalErrorSwallowsFault()
var ids = new[] { "asset-1" };
MTConnectAssetsRequestedHandler handler = _ => throw new InvalidOperationException("AssetsRequestReceived fault");
- Assert.DoesNotThrow(() => MulticastIsolation.Raise(handler, h => h(ids)));
+ Assert.DoesNotThrow((Action)(() => MulticastIsolation.Raise(handler, h => h(ids))));
}
// -----------------------------------------------------------------------
@@ -545,7 +545,7 @@ public void AgentBroker_DeviceAssetsRequestReceived_NullInternalErrorSwallowsFau
{
MTConnectDeviceAssetsRequestedHandler handler = _ => throw new InvalidOperationException("DeviceAssetsRequestReceived fault");
- Assert.DoesNotThrow(() => MulticastIsolation.Raise(handler, h => h("uuid-1")));
+ Assert.DoesNotThrow((Action)(() => MulticastIsolation.Raise(handler, h => h("uuid-1"))));
}
// -----------------------------------------------------------------------
@@ -572,7 +572,7 @@ public void AgentBroker_AssetsResponseSent_NullInternalErrorSwallowsFault()
{
MTConnectAssetsHandler handler = _ => throw new InvalidOperationException("AssetsResponseSent fault");
- Assert.DoesNotThrow(() => MulticastIsolation.Raise(handler, h => h(null!)));
+ Assert.DoesNotThrow((Action)(() => MulticastIsolation.Raise(handler, h => h(null!))));
}
// -----------------------------------------------------------------------
@@ -599,7 +599,7 @@ public void AgentBroker_ErrorResponseSent_NullInternalErrorSwallowsFault()
{
MTConnectErrorHandler handler = _ => throw new InvalidOperationException("ErrorResponseSent fault");
- Assert.DoesNotThrow(() => MulticastIsolation.Raise(handler, h => h((IErrorResponseDocument)null!)));
+ Assert.DoesNotThrow((Action)(() => MulticastIsolation.Raise(handler, h => h((IErrorResponseDocument)null!))));
}
}
}
diff --git a/tests/MTConnect.NET-Common-Tests/Agents/AgentUuidDeterministicDefaultTests.cs b/tests/MTConnect.NET-Common-Tests/Agents/AgentUuidDeterministicDefaultTests.cs
index a38c16877..7c7c1416b 100644
--- a/tests/MTConnect.NET-Common-Tests/Agents/AgentUuidDeterministicDefaultTests.cs
+++ b/tests/MTConnect.NET-Common-Tests/Agents/AgentUuidDeterministicDefaultTests.cs
@@ -123,7 +123,7 @@ private static string SimulateFreshBoot(string agentName, int port = 0)
public void DeriveFromSeed_matches_python_uuid_v5_NAMESPACE_DNS_example_com_vector()
{
var derived = DeterministicAgentUuid.DeriveFromSeed("example.com");
- Assert.AreEqual("cfbff0d1-9375-5685-968c-48ce8b15ae17", derived,
+ Assert.That(derived, Is.EqualTo("cfbff0d1-9375-5685-968c-48ce8b15ae17"),
"DeriveFromSeed must reproduce the canonical UUID v5(NAMESPACE_DNS, 'example.com') vector.");
}
diff --git a/tests/MTConnect.NET-Common-Tests/DeviceFinderMulticastIsolationTests.cs b/tests/MTConnect.NET-Common-Tests/DeviceFinderMulticastIsolationTests.cs
index ae37ba301..6cd646595 100644
--- a/tests/MTConnect.NET-Common-Tests/DeviceFinderMulticastIsolationTests.cs
+++ b/tests/MTConnect.NET-Common-Tests/DeviceFinderMulticastIsolationTests.cs
@@ -86,7 +86,7 @@ public void DeviceFinder_DeviceFound_NullInternalErrorSwallowsFault()
{
TestDeviceHandler handler = (_, _) => throw new InvalidOperationException("DeviceFound fault");
- Assert.DoesNotThrow(() => MulticastIsolation.Raise(handler, h => h(this, "device-1")));
+ Assert.DoesNotThrow((Action)(() => MulticastIsolation.Raise(handler, h => h(this, "device-1"))));
}
// -----------------------------------------------------------------------
@@ -113,7 +113,7 @@ public void DeviceFinder_SearchCompleted_NullInternalErrorSwallowsFault()
{
TestRequestStatusHandler handler = (_, _) => throw new InvalidOperationException("SearchCompleted fault");
- Assert.DoesNotThrow(() => MulticastIsolation.Raise(handler, h => h(this, 0L)));
+ Assert.DoesNotThrow((Action)(() => MulticastIsolation.Raise(handler, h => h(this, 0L))));
}
// -----------------------------------------------------------------------
@@ -141,7 +141,7 @@ public void DeviceFinder_PingSent_NullInternalErrorSwallowsFault()
{
TestPingSentHandlerOnFinder handler = (_, _) => throw new InvalidOperationException("PingSent fault");
- Assert.DoesNotThrow(() => MulticastIsolation.Raise(handler, h => h(this, IPAddress.Loopback)));
+ Assert.DoesNotThrow((Action)(() => MulticastIsolation.Raise(handler, h => h(this, IPAddress.Loopback))));
}
// -----------------------------------------------------------------------
@@ -169,7 +169,7 @@ public void DeviceFinder_PingReceived_NullInternalErrorSwallowsFault()
{
TestPingReceivedHandlerOnFinder handler = (_, _, _) => throw new InvalidOperationException("PingReceived fault");
- Assert.DoesNotThrow(() => MulticastIsolation.Raise(handler, h => h(this, IPAddress.Loopback, null!)));
+ Assert.DoesNotThrow((Action)(() => MulticastIsolation.Raise(handler, h => h(this, IPAddress.Loopback, null!))));
}
// -----------------------------------------------------------------------
@@ -196,7 +196,7 @@ public void DeviceFinder_PortRequest_NullInternalErrorSwallowsFault()
{
TestPortRequestHandler handler = (_, _, _) => throw new InvalidOperationException("PortRequest fault");
- Assert.DoesNotThrow(() => MulticastIsolation.Raise(handler, h => h(this, IPAddress.Loopback, 5000)));
+ Assert.DoesNotThrow((Action)(() => MulticastIsolation.Raise(handler, h => h(this, IPAddress.Loopback, 5000))));
}
// -----------------------------------------------------------------------
@@ -223,7 +223,7 @@ public void DeviceFinder_ProbeRequest_NullInternalErrorSwallowsFault()
{
TestProbeRequestHandler handler = (_, _, _) => throw new InvalidOperationException("ProbeRequest fault");
- Assert.DoesNotThrow(() => MulticastIsolation.Raise(handler, h => h(this, IPAddress.Loopback, 5000)));
+ Assert.DoesNotThrow((Action)(() => MulticastIsolation.Raise(handler, h => h(this, IPAddress.Loopback, 5000))));
}
// -----------------------------------------------------------------------
@@ -251,7 +251,7 @@ public void PingQueue_PingSent_NullInternalErrorSwallowsFault()
{
TestPingSentHandlerOnQueue handler = _ => throw new InvalidOperationException("PingQueue.PingSent fault");
- Assert.DoesNotThrow(() => MulticastIsolation.Raise(handler, h => h(IPAddress.Loopback)));
+ Assert.DoesNotThrow((Action)(() => MulticastIsolation.Raise(handler, h => h(IPAddress.Loopback))));
}
// -----------------------------------------------------------------------
@@ -279,7 +279,7 @@ public void PingQueue_PingReceived_NullInternalErrorSwallowsFault()
{
TestPingReceivedHandlerOnQueue handler = (_, _) => throw new InvalidOperationException("PingQueue.PingReceived fault");
- Assert.DoesNotThrow(() => MulticastIsolation.Raise(handler, h => h(IPAddress.Loopback, null!)));
+ Assert.DoesNotThrow((Action)(() => MulticastIsolation.Raise(handler, h => h(IPAddress.Loopback, null!))));
}
// -----------------------------------------------------------------------
@@ -307,7 +307,7 @@ public void PingQueue_Completed_NullInternalErrorSwallowsFault()
{
TestCompletedHandler handler = _ => throw new InvalidOperationException("PingQueue.Completed fault");
- Assert.DoesNotThrow(() => MulticastIsolation.Raise(handler, h => h(new List())));
+ Assert.DoesNotThrow((Action)(() => MulticastIsolation.Raise(handler, h => h(new List()))));
}
// -----------------------------------------------------------------------
@@ -320,7 +320,7 @@ public void DeviceFinder_NullCustomDelegateHandler_DoesNotThrow()
{
TestDeviceHandler? handler = null;
- Assert.DoesNotThrow(() => MulticastIsolation.Raise(handler!, h => h(this, "any")));
+ Assert.DoesNotThrow((Action)(() => MulticastIsolation.Raise(handler!, h => h(this, "any"))));
}
}
}
diff --git a/tests/MTConnect.NET-Common-Tests/Devices/Configurations/PolymorphicLeafCoverageTests.cs b/tests/MTConnect.NET-Common-Tests/Devices/Configurations/PolymorphicLeafCoverageTests.cs
index 3ac63fdc9..ef57c53f8 100644
--- a/tests/MTConnect.NET-Common-Tests/Devices/Configurations/PolymorphicLeafCoverageTests.cs
+++ b/tests/MTConnect.NET-Common-Tests/Devices/Configurations/PolymorphicLeafCoverageTests.cs
@@ -114,7 +114,7 @@ public void Simple_leaf_constructs_via_parameterless_ctor(
Type simpleType, Type abstractInterface, Type simpleInterface)
{
object? instance = null;
- Assert.DoesNotThrow(() => instance = Activator.CreateInstance(simpleType),
+ Assert.DoesNotThrow((Action)(() => instance = Activator.CreateInstance(simpleType)),
$"{simpleType.Name} must have a public parameterless ctor");
Assert.That(instance, Is.Not.Null);
}
@@ -146,7 +146,7 @@ public void DataSet_leaf_constructs_via_parameterless_ctor(
Type dataSetType, Type abstractInterface, Type simpleInterface, Type dataSetInterface)
{
object? instance = null;
- Assert.DoesNotThrow(() => instance = Activator.CreateInstance(dataSetType),
+ Assert.DoesNotThrow((Action)(() => instance = Activator.CreateInstance(dataSetType)),
$"{dataSetType.Name} must have a public parameterless ctor");
Assert.That(instance, Is.Not.Null);
}
diff --git a/tests/MTConnect.NET-Common-Tests/Headers/HeaderVersionRegressionTests.cs b/tests/MTConnect.NET-Common-Tests/Headers/HeaderVersionRegressionTests.cs
index 1d9ba6afe..da27942b1 100644
--- a/tests/MTConnect.NET-Common-Tests/Headers/HeaderVersionRegressionTests.cs
+++ b/tests/MTConnect.NET-Common-Tests/Headers/HeaderVersionRegressionTests.cs
@@ -144,7 +144,7 @@ public void No_response_envelope_emits_the_library_assembly_version()
var assets = broker.GetAssetsResponseDocument();
var error = broker.GetErrorResponseDocument(ErrorCode.UNSUPPORTED, "test");
- Assert.Multiple(() =>
+ Assert.Multiple((Action)(() =>
{
Assert.That(devices!.Header.Version, Is.Not.EqualTo(libraryVersion),
"Devices Header.version must not echo the library assembly version.");
@@ -152,7 +152,7 @@ public void No_response_envelope_emits_the_library_assembly_version()
"Assets Header.version must not echo the library assembly version.");
Assert.That(error!.Header.Version, Is.Not.EqualTo(libraryVersion),
"Error Header.version must not echo the library assembly version.");
- });
+ }));
}
}
}
diff --git a/tests/MTConnect.NET-Common-Tests/Http/CA2022ShortReadEdgeCaseTests.cs b/tests/MTConnect.NET-Common-Tests/Http/CA2022ShortReadEdgeCaseTests.cs
index 0d1926553..e77ba3e5b 100644
--- a/tests/MTConnect.NET-Common-Tests/Http/CA2022ShortReadEdgeCaseTests.cs
+++ b/tests/MTConnect.NET-Common-Tests/Http/CA2022ShortReadEdgeCaseTests.cs
@@ -122,7 +122,7 @@ public void ReadRequestBytes_pre_cancelled_token_throws_immediately()
cts.Cancel();
Assert.That(
- async () => await Invoke(scripted, cts.Token),
+ (Func)(async () => await Invoke(scripted, cts.Token)),
Throws.InstanceOf(),
"A pre-cancelled token must surface as OperationCanceledException. "
+ "Pre-fix, the accumulator ignored the token (signature took only Stream) "
@@ -146,7 +146,7 @@ public void ReadRequestBytes_cancelled_mid_drip_throws_within_next_read()
using var cts = new CancellationTokenSource();
Assert.That(
- async () =>
+ (Func)(async () =>
{
var invocation = Invoke(slow, cts.Token);
// Give the reader time to start awaiting the first drip,
@@ -154,7 +154,7 @@ public void ReadRequestBytes_cancelled_mid_drip_throws_within_next_read()
// Task.Delay(cancellationToken) throws immediately.
cts.CancelAfter(TimeSpan.FromMilliseconds(50));
await invocation.WaitAsync(TimeSpan.FromMilliseconds(200));
- },
+ }),
Throws.InstanceOf(),
"A token cancelled mid-drip must surface as OperationCanceledException within "
+ "the next ReadAsync cycle. Pre-fix, the accumulator ignored the token and "
diff --git a/tests/MTConnect.NET-Common-Tests/MTConnect.NET-Common-Tests.csproj b/tests/MTConnect.NET-Common-Tests/MTConnect.NET-Common-Tests.csproj
index 1b09a0fdd..d65bb5270 100644
--- a/tests/MTConnect.NET-Common-Tests/MTConnect.NET-Common-Tests.csproj
+++ b/tests/MTConnect.NET-Common-Tests/MTConnect.NET-Common-Tests.csproj
@@ -10,7 +10,7 @@
-
+
diff --git a/tests/MTConnect.NET-Common-Tests/MqttClientMulticastIsolationTests.cs b/tests/MTConnect.NET-Common-Tests/MqttClientMulticastIsolationTests.cs
index 90a9bf0e0..1ae71ebc0 100644
--- a/tests/MTConnect.NET-Common-Tests/MqttClientMulticastIsolationTests.cs
+++ b/tests/MTConnect.NET-Common-Tests/MqttClientMulticastIsolationTests.cs
@@ -164,7 +164,7 @@ public void MqttClient_NullHandler_DoesNotThrow()
EventHandler? handler = null;
EventHandler? internalError = null;
- Assert.DoesNotThrow(() => handler.Raise(this, "x", internalError));
+ Assert.DoesNotThrow((Action)(() => handler.Raise(this, "x", internalError)));
}
/// Pins the behavior expressed by the test name: Raise non-generic with a null handler is a safe no-op.
@@ -174,7 +174,7 @@ public void MqttClient_NullHandlerNonGeneric_DoesNotThrow()
EventHandler? handler = null;
EventHandler? internalError = null;
- Assert.DoesNotThrow(() => handler.Raise(this, EventArgs.Empty, internalError));
+ Assert.DoesNotThrow((Action)(() => handler.Raise(this, EventArgs.Empty, internalError)));
}
}
}
diff --git a/tests/MTConnect.NET-Common-Tests/MulticastIsolationTests.cs b/tests/MTConnect.NET-Common-Tests/MulticastIsolationTests.cs
index a8344469b..63452817c 100644
--- a/tests/MTConnect.NET-Common-Tests/MulticastIsolationTests.cs
+++ b/tests/MTConnect.NET-Common-Tests/MulticastIsolationTests.cs
@@ -75,7 +75,7 @@ public void MulticastIsolation_Generic_TerminalSwallowsInternalErrorOwnThrow()
internalError += (s, ex) => throw new InvalidOperationException("internal-1");
internalError += (s, ex) => throw new InvalidOperationException("internal-2");
- Assert.DoesNotThrow(() => handler.Raise(this, 0, internalError!));
+ Assert.DoesNotThrow((Action)(() => handler.Raise(this, 0, internalError!)));
}
// --- Non-generic overload ---------------------------------------------
@@ -138,7 +138,7 @@ public void MulticastIsolation_NonGeneric_TerminalSwallowsInternalErrorOwnThrow(
internalError += (s, ex) => throw new InvalidOperationException("internal-1");
internalError += (s, ex) => throw new InvalidOperationException("internal-2");
- Assert.DoesNotThrow(() => handler.Raise(this, EventArgs.Empty, internalError!));
+ Assert.DoesNotThrow((Action)(() => handler.Raise(this, EventArgs.Empty, internalError!)));
}
// --- Generic custom-delegate overload ---------------------------------
@@ -204,7 +204,7 @@ public void MulticastIsolation_GenericDelegate_TerminalSwallowsInternalErrorOwnT
internalError += (_, _) => throw new InvalidOperationException("internal-1");
internalError += (_, _) => throw new InvalidOperationException("internal-2");
- Assert.DoesNotThrow(() => MulticastIsolation.Raise(handler, h => h(0), internalError!));
+ Assert.DoesNotThrow((Action)(() => MulticastIsolation.Raise(handler, h => h(0), internalError!)));
}
/// Pins the behavior expressed by the test name: the generic-delegate overload accepts a null handler as a safe no-op covering the no-subscriber case.
@@ -213,7 +213,7 @@ public void MulticastIsolation_GenericDelegate_NullHandler_DoesNotThrow()
{
CustomDelegate? handler = null;
- Assert.DoesNotThrow(() => MulticastIsolation.Raise(handler!, h => h(0)));
+ Assert.DoesNotThrow((Action)(() => MulticastIsolation.Raise(handler!, h => h(0))));
}
/// Pins the behavior expressed by the test name: the generic-delegate overload swallows subscriber faults at the per-delegate boundary when internalError is left at its default null.
@@ -222,7 +222,7 @@ public void MulticastIsolation_GenericDelegate_NullInternalErrorSwallowsFault()
{
CustomDelegate handler = _ => throw new InvalidOperationException("boom");
- Assert.DoesNotThrow(() => MulticastIsolation.Raise(handler, h => h(0)));
+ Assert.DoesNotThrow((Action)(() => MulticastIsolation.Raise(handler, h => h(0))));
}
}
}
diff --git a/tests/MTConnect.NET-Common-Tests/Reflection/RegeneratedAssetsCoverageTests.cs b/tests/MTConnect.NET-Common-Tests/Reflection/RegeneratedAssetsCoverageTests.cs
index bbb9c5638..d823f8e51 100644
--- a/tests/MTConnect.NET-Common-Tests/Reflection/RegeneratedAssetsCoverageTests.cs
+++ b/tests/MTConnect.NET-Common-Tests/Reflection/RegeneratedAssetsCoverageTests.cs
@@ -93,7 +93,7 @@ public void Asset_subtype_is_constructible(Type type)
{
object? instance = null;
Assert.DoesNotThrow(
- () => instance = Activator.CreateInstance(type),
+ (Action)(() => instance = Activator.CreateInstance(type)),
$"{type.FullName} parameterless ctor threw");
Assert.That(instance, Is.Not.Null,
$"{type.FullName} parameterless ctor returned null");
diff --git a/tests/MTConnect.NET-Common-Tests/Reflection/RegeneratedConfigurationsCoverageTests.cs b/tests/MTConnect.NET-Common-Tests/Reflection/RegeneratedConfigurationsCoverageTests.cs
index 51e9f45d2..03966d6f2 100644
--- a/tests/MTConnect.NET-Common-Tests/Reflection/RegeneratedConfigurationsCoverageTests.cs
+++ b/tests/MTConnect.NET-Common-Tests/Reflection/RegeneratedConfigurationsCoverageTests.cs
@@ -80,7 +80,7 @@ public void Configuration_subtype_is_constructible(Type type)
{
object? instance = null;
Assert.DoesNotThrow(
- () => instance = Activator.CreateInstance(type),
+ (Action)(() => instance = Activator.CreateInstance(type)),
$"{type.FullName} parameterless ctor threw");
Assert.That(instance, Is.Not.Null,
$"{type.FullName} parameterless ctor returned null");
@@ -111,7 +111,7 @@ public void Configuration_subtype_string_properties_round_trip(Type type)
var sentinel = $"sentinel-{property.Name}";
Assert.DoesNotThrow(
- () => property.SetValue(instance, sentinel),
+ (Action)(() => property.SetValue(instance, sentinel)),
$"{type.FullName}.{property.Name} setter threw");
var readBack = property.GetValue(instance) as string;
Assert.That(readBack, Is.EqualTo(sentinel),
diff --git a/tests/MTConnect.NET-Common-Tests/Reflection/RegeneratedTypesCoverageTests.cs b/tests/MTConnect.NET-Common-Tests/Reflection/RegeneratedTypesCoverageTests.cs
index 7c26b1c78..c6328c9ca 100644
--- a/tests/MTConnect.NET-Common-Tests/Reflection/RegeneratedTypesCoverageTests.cs
+++ b/tests/MTConnect.NET-Common-Tests/Reflection/RegeneratedTypesCoverageTests.cs
@@ -219,7 +219,7 @@ public void Type_can_be_constructed(Type type)
// V2_6_V2_7/.
object? instance = null;
Assert.DoesNotThrow(
- () => instance = Activator.CreateInstance(type),
+ (Action)(() => instance = Activator.CreateInstance(type)),
$"{type.FullName} parameterless ctor threw");
Assert.That(instance, Is.Not.Null,
$"{type.FullName} parameterless ctor returned null");
@@ -255,12 +255,12 @@ public void Type_round_trips_default_property_values(Type type)
object? sentinel = GetDefaultValue(property.PropertyType);
Assert.DoesNotThrow(
- () => property.SetValue(instance, sentinel),
+ (Action)(() => property.SetValue(instance, sentinel)),
$"{key} setter threw for default({property.PropertyType.Name})");
object? readBack = null;
Assert.DoesNotThrow(
- () => readBack = property.GetValue(instance),
+ (Action)(() => readBack = property.GetValue(instance)),
$"{key} getter threw after setting default({property.PropertyType.Name})");
// Read-back equality is only asserted on auto-properties.
diff --git a/tests/MTConnect.NET-Common-Tests/Regressions/DeviceComponentDefaultsRegressionTests.cs b/tests/MTConnect.NET-Common-Tests/Regressions/DeviceComponentDefaultsRegressionTests.cs
index 2822a738c..639c918e8 100644
--- a/tests/MTConnect.NET-Common-Tests/Regressions/DeviceComponentDefaultsRegressionTests.cs
+++ b/tests/MTConnect.NET-Common-Tests/Regressions/DeviceComponentDefaultsRegressionTests.cs
@@ -32,12 +32,12 @@ public class DeviceComponentDefaultsRegressionTests
public void Device_default_constructor_leaves_identity_fields_null()
{
var device = new Device();
- Assert.Multiple(() =>
+ Assert.Multiple((Action)(() =>
{
Assert.That(device.Id, Is.Null, "Device.Id");
Assert.That(device.Name, Is.Null, "Device.Name");
Assert.That(device.Uuid, Is.Null, "Device.Uuid");
- });
+ }));
}
/// Pins the behaviour expressed by the test name: agent default constructor leaves identity fields null.
@@ -45,12 +45,12 @@ public void Device_default_constructor_leaves_identity_fields_null()
public void Agent_default_constructor_leaves_identity_fields_null()
{
var agent = new Agent();
- Assert.Multiple(() =>
+ Assert.Multiple((Action)(() =>
{
Assert.That(agent.Id, Is.Null, "Agent.Id");
Assert.That(agent.Name, Is.Null, "Agent.Name");
Assert.That(agent.Uuid, Is.Null, "Agent.Uuid");
- });
+ }));
}
/// Pins the behaviour expressed by the test name: sequential default devices share null uuid.
@@ -71,12 +71,12 @@ public void Sequential_default_Devices_share_null_Uuid()
public void Object_initializer_continues_to_set_Device_identity()
{
var device = new Device { Id = "id-A", Name = "name-A", Uuid = "uuid-A" };
- Assert.Multiple(() =>
+ Assert.Multiple((Action)(() =>
{
Assert.That(device.Id, Is.EqualTo("id-A"));
Assert.That(device.Name, Is.EqualTo("name-A"));
Assert.That(device.Uuid, Is.EqualTo("uuid-A"));
- });
+ }));
}
// ---- Reflection guard --------------------------------------
diff --git a/tests/MTConnect.NET-Common-Tests/V2_6_V2_7/V2_7DataItemTypeTests.cs b/tests/MTConnect.NET-Common-Tests/V2_6_V2_7/V2_7DataItemTypeTests.cs
index 0faef2fc1..47522eed0 100644
--- a/tests/MTConnect.NET-Common-Tests/V2_6_V2_7/V2_7DataItemTypeTests.cs
+++ b/tests/MTConnect.NET-Common-Tests/V2_6_V2_7/V2_7DataItemTypeTests.cs
@@ -49,7 +49,7 @@ public void V2_7_DataItem_constructs_with_correct_metadata(
// surfaces as a clear NUnit failure with the offending type name
// rather than a bare MissingMethodException.
object? instance = null;
- Assert.DoesNotThrow(() => instance = Activator.CreateInstance(dataItemType),
+ Assert.DoesNotThrow((Action)(() => instance = Activator.CreateInstance(dataItemType)),
$"{dataItemType.Name} should have a public parameterless constructor");
Assert.That(instance, Is.Not.Null);
Assert.That(instance, Is.InstanceOf());
diff --git a/tests/MTConnect.NET-Docs-Tests/MTConnect.NET-Docs-Tests.csproj b/tests/MTConnect.NET-Docs-Tests/MTConnect.NET-Docs-Tests.csproj
index 4e036964f..1cb840c5b 100644
--- a/tests/MTConnect.NET-Docs-Tests/MTConnect.NET-Docs-Tests.csproj
+++ b/tests/MTConnect.NET-Docs-Tests/MTConnect.NET-Docs-Tests.csproj
@@ -11,7 +11,7 @@
-
+
diff --git a/tests/MTConnect.NET-Docs-Tests/RouteCheckHelpersTests.cs b/tests/MTConnect.NET-Docs-Tests/RouteCheckHelpersTests.cs
index 7123c4d82..08aee4a9c 100644
--- a/tests/MTConnect.NET-Docs-Tests/RouteCheckHelpersTests.cs
+++ b/tests/MTConnect.NET-Docs-Tests/RouteCheckHelpersTests.cs
@@ -115,7 +115,7 @@ public void MdFileToRoute_WindowsSeparators_AreNormalised()
public void MdFileToRoute_NullDocsRoot_Throws()
{
var ex = Assert.Throws(
- () => RouteCheckHelpers.MdFileToRoute(null!, "/repo/docs/index.md"));
+ (Action)(() => RouteCheckHelpers.MdFileToRoute(null!, "/repo/docs/index.md")));
Assert.That(ex!.ParamName, Is.EqualTo("docsRoot"));
}
@@ -127,7 +127,7 @@ public void MdFileToRoute_NullDocsRoot_Throws()
public void MdFileToRoute_NullAbsPath_Throws()
{
var ex = Assert.Throws(
- () => RouteCheckHelpers.MdFileToRoute("/repo/docs", null!));
+ (Action)(() => RouteCheckHelpers.MdFileToRoute("/repo/docs", null!)));
Assert.That(ex!.ParamName, Is.EqualTo("absPath"));
}
@@ -276,7 +276,7 @@ public void CollectMarkdownFiles_NullDir_Throws()
{
var results = new List();
var ex = Assert.Throws(
- () => RouteCheckHelpers.CollectMarkdownFiles(null!, results));
+ (Action)(() => RouteCheckHelpers.CollectMarkdownFiles(null!, results)));
Assert.That(ex!.ParamName, Is.EqualTo("dir"));
}
@@ -288,7 +288,7 @@ public void CollectMarkdownFiles_NullDir_Throws()
public void CollectMarkdownFiles_NullResults_Throws()
{
var ex = Assert.Throws(
- () => RouteCheckHelpers.CollectMarkdownFiles("/tmp", null!));
+ (Action)(() => RouteCheckHelpers.CollectMarkdownFiles("/tmp", null!)));
Assert.That(ex!.ParamName, Is.EqualTo("results"));
}
@@ -300,7 +300,7 @@ public void CollectMarkdownFiles_NullResults_Throws()
public void CollectRoutes_NullDocsRoot_Throws()
{
var ex = Assert.Throws(
- () => RouteCheckHelpers.CollectRoutes(null!));
+ (Action)(() => RouteCheckHelpers.CollectRoutes(null!)));
Assert.That(ex!.ParamName, Is.EqualTo("docsRoot"));
}
@@ -405,7 +405,7 @@ public void ExtractBannerPort_EmptyLog_ReturnsNull()
public void ExtractBannerPort_NullLog_Throws()
{
var ex = Assert.Throws(
- () => RouteCheckHelpers.ExtractBannerPort(null!));
+ (Action)(() => RouteCheckHelpers.ExtractBannerPort(null!)));
Assert.That(ex!.ParamName, Is.EqualTo("log"));
}
@@ -459,7 +459,7 @@ public void LocateRepoRoot_NoMatch_ThrowsWithDiagnosticContext()
// ancestor of the temp directory. The walk will exhaust at
// the filesystem root.
var ex = Assert.Throws(
- () => RouteCheckHelpers.LocateRepoRoot(fixture.Path, "no-such-marker-12345.txt"));
+ (Action)(() => RouteCheckHelpers.LocateRepoRoot(fixture.Path, "no-such-marker-12345.txt")));
Assert.That(ex!.Message, Does.Contain(fixture.Path));
Assert.That(ex.Message, Does.Contain("ancestor"));
}
@@ -472,7 +472,7 @@ public void LocateRepoRoot_NoMatch_ThrowsWithDiagnosticContext()
public void LocateRepoRoot_NullStartDirectory_Throws()
{
var ex = Assert.Throws(
- () => RouteCheckHelpers.LocateRepoRoot(null!, "marker.txt"));
+ (Action)(() => RouteCheckHelpers.LocateRepoRoot(null!, "marker.txt")));
Assert.That(ex!.ParamName, Is.EqualTo("startDirectory"));
}
@@ -484,7 +484,7 @@ public void LocateRepoRoot_NullStartDirectory_Throws()
public void LocateRepoRoot_NullMarkerFile_Throws()
{
var ex = Assert.Throws(
- () => RouteCheckHelpers.LocateRepoRoot("/tmp", null!));
+ (Action)(() => RouteCheckHelpers.LocateRepoRoot("/tmp", null!)));
Assert.That(ex!.ParamName, Is.EqualTo("markerFile"));
}
@@ -715,7 +715,7 @@ public void ShardRoutes_AssignmentFollowsRoundRobinModulus()
public void ShardRoutes_NullRoutes_Throws()
{
var ex = Assert.Throws(
- () => RouteCheckHelpers.ShardRoutes(null!, 1, 1));
+ (Action)(() => RouteCheckHelpers.ShardRoutes(null!, 1, 1)));
Assert.That(ex!.ParamName, Is.EqualTo("routes"));
}
@@ -729,7 +729,7 @@ public void ShardRoutes_NullRoutes_Throws()
public void ShardRoutes_NonPositiveTotal_Throws(int total)
{
var ex = Assert.Throws(
- () => RouteCheckHelpers.ShardRoutes(SampleRoutes, 1, total));
+ (Action)(() => RouteCheckHelpers.ShardRoutes(SampleRoutes, 1, total)));
Assert.That(ex!.ParamName, Is.EqualTo("total"));
}
@@ -745,7 +745,7 @@ public void ShardRoutes_NonPositiveTotal_Throws(int total)
public void ShardRoutes_IndexOutOfRange_Throws(int index, int total)
{
var ex = Assert.Throws(
- () => RouteCheckHelpers.ShardRoutes(SampleRoutes, index, total));
+ (Action)(() => RouteCheckHelpers.ShardRoutes(SampleRoutes, index, total)));
Assert.That(ex!.ParamName, Is.EqualTo("index"));
}
diff --git a/tests/MTConnect.NET-HTTP-Tests/MTConnect.NET-HTTP-Tests.csproj b/tests/MTConnect.NET-HTTP-Tests/MTConnect.NET-HTTP-Tests.csproj
index ec37aa305..2cf7036af 100644
--- a/tests/MTConnect.NET-HTTP-Tests/MTConnect.NET-HTTP-Tests.csproj
+++ b/tests/MTConnect.NET-HTTP-Tests/MTConnect.NET-HTTP-Tests.csproj
@@ -10,7 +10,7 @@
-
+
diff --git a/tests/MTConnect.NET-HTTP-Tests/Servers/HttpServerMulticastIsolationTests.cs b/tests/MTConnect.NET-HTTP-Tests/Servers/HttpServerMulticastIsolationTests.cs
index e01683d1a..7d9505aa7 100644
--- a/tests/MTConnect.NET-HTTP-Tests/Servers/HttpServerMulticastIsolationTests.cs
+++ b/tests/MTConnect.NET-HTTP-Tests/Servers/HttpServerMulticastIsolationTests.cs
@@ -57,7 +57,7 @@ public void HttpResponseHandler_ResponseSent_NullInternalErrorSwallowsFault()
var response = new MTConnectHttpResponse { ContentType = "application/xml" };
EventHandler handler = (_, _) => throw new InvalidOperationException("ResponseSent fault");
- Assert.DoesNotThrow(() => handler.Raise(this, response, null));
+ Assert.DoesNotThrow((Action)(() => handler.Raise(this, response, null)));
}
// -----------------------------------------------------------------------
@@ -147,7 +147,7 @@ public void HttpServerStream_StreamStopped_NullInternalErrorSwallowsFault()
{
EventHandler handler = (_, _) => throw new InvalidOperationException("StreamStopped fault");
- Assert.DoesNotThrow(() => handler.Raise(this, "stream-id-1", null));
+ Assert.DoesNotThrow((Action)(() => handler.Raise(this, "stream-id-1", null)));
}
// -----------------------------------------------------------------------
@@ -199,7 +199,7 @@ public void HttpServerStream_HeartbeatReceived_NullInternalErrorSwallowsFault()
var args = new MTConnectHttpStreamArgs("stream-id-2", System.IO.Stream.Null, 42.5);
EventHandler handler = (_, _) => throw new InvalidOperationException("HeartbeatReceived fault");
- Assert.DoesNotThrow(() => handler.Raise(this, args, null));
+ Assert.DoesNotThrow((Action)(() => handler.Raise(this, args, null)));
}
// -----------------------------------------------------------------------
@@ -212,7 +212,7 @@ public void HttpServerStream_NullGenericHandler_DoesNotThrow()
{
EventHandler? handler = null;
- Assert.DoesNotThrow(() => handler.Raise(this, "x", null));
+ Assert.DoesNotThrow((Action)(() => handler.Raise(this, "x", null)));
}
}
}
diff --git a/tests/MTConnect.NET-JSON-Tests/MTConnect.NET-JSON-Tests.csproj b/tests/MTConnect.NET-JSON-Tests/MTConnect.NET-JSON-Tests.csproj
index 3c26ab6cc..1c5a3e524 100644
--- a/tests/MTConnect.NET-JSON-Tests/MTConnect.NET-JSON-Tests.csproj
+++ b/tests/MTConnect.NET-JSON-Tests/MTConnect.NET-JSON-Tests.csproj
@@ -10,8 +10,8 @@
-
-
+
+
diff --git a/tests/MTConnect.NET-JSON-cppagent-Tests/MTConnect.NET-JSON-cppagent-Tests.csproj b/tests/MTConnect.NET-JSON-cppagent-Tests/MTConnect.NET-JSON-cppagent-Tests.csproj
index 5a39b0098..720d8d58d 100644
--- a/tests/MTConnect.NET-JSON-cppagent-Tests/MTConnect.NET-JSON-cppagent-Tests.csproj
+++ b/tests/MTConnect.NET-JSON-cppagent-Tests/MTConnect.NET-JSON-cppagent-Tests.csproj
@@ -10,8 +10,8 @@
-
-
+
+
diff --git a/tests/MTConnect.NET-JSON-cppagent-Tests/Streams/JsonConditionsArrayShapeTests.cs b/tests/MTConnect.NET-JSON-cppagent-Tests/Streams/JsonConditionsArrayShapeTests.cs
index f62e62c36..ec7f90505 100644
--- a/tests/MTConnect.NET-JSON-cppagent-Tests/Streams/JsonConditionsArrayShapeTests.cs
+++ b/tests/MTConnect.NET-JSON-cppagent-Tests/Streams/JsonConditionsArrayShapeTests.cs
@@ -3,6 +3,7 @@
using MTConnect.Streams.Json;
using NUnit.Framework;
+using System;
using System.Collections.Generic;
using System.Text.Json;
@@ -280,8 +281,8 @@ public void Null_WriteAndRead_RoundTripsToNull()
[Test]
public void Read_InvalidRootToken_ThrowsJsonException()
{
- var ex = Assert.Throws(() =>
- JsonSerializer.Deserialize("123", Options()));
+ var ex = Assert.Throws((Action)(() =>
+ JsonSerializer.Deserialize("123", Options())));
Assert.That(ex, Is.Not.Null);
Assert.That(ex!.Message, Does.Contain("Unexpected token"));
}
@@ -313,8 +314,8 @@ public void Read_ArrayShape_UnknownLevel_ThrowsJsonException()
{
const string json = "[{\"Bogus\":{\"dataItemId\":\"x1\"}}]";
- var ex = Assert.Throws(() =>
- JsonSerializer.Deserialize(json, Options()));
+ var ex = Assert.Throws((Action)(() =>
+ JsonSerializer.Deserialize(json, Options())));
Assert.That(ex, Is.Not.Null);
Assert.That(ex!.Message, Does.Contain("Unknown Condition level"));
}
@@ -325,8 +326,8 @@ public void Read_ArrayShape_NonObjectElement_ThrowsJsonException()
{
const string json = "[42]";
- var ex = Assert.Throws(() =>
- JsonSerializer.Deserialize(json, Options()));
+ var ex = Assert.Throws((Action)(() =>
+ JsonSerializer.Deserialize(json, Options())));
Assert.That(ex, Is.Not.Null);
Assert.That(ex!.Message, Does.Contain("expected object wrapper"));
}
@@ -337,8 +338,8 @@ public void Read_ArrayShape_WrapperWithoutPropertyName_ThrowsJsonException()
{
const string json = "[{}]";
- var ex = Assert.Throws(() =>
- JsonSerializer.Deserialize(json, Options()));
+ var ex = Assert.Throws((Action)(() =>
+ JsonSerializer.Deserialize(json, Options())));
Assert.That(ex, Is.Not.Null);
Assert.That(ex!.Message, Does.Contain("Expected property name"));
}
@@ -349,8 +350,8 @@ public void Read_ArrayShape_WrapperWithMultipleProperties_ThrowsJsonException()
{
const string json = "[{\"Fault\":{\"dataItemId\":\"f1\"},\"Warning\":{\"dataItemId\":\"w1\"}}]";
- var ex = Assert.Throws(() =>
- JsonSerializer.Deserialize(json, Options()));
+ var ex = Assert.Throws((Action)(() =>
+ JsonSerializer.Deserialize(json, Options())));
Assert.That(ex, Is.Not.Null);
Assert.That(ex!.Message, Does.Contain("end of JsonConditions wrapper"));
}
@@ -361,8 +362,8 @@ public void Read_ArrayShape_NullEntry_ThrowsJsonException()
{
const string json = "[{\"Normal\":null}]";
- var ex = Assert.Throws(() =>
- JsonSerializer.Deserialize(json, Options()));
+ var ex = Assert.Throws((Action)(() =>
+ JsonSerializer.Deserialize(json, Options())));
Assert.That(ex, Is.Not.Null);
Assert.That(ex!.Message, Does.Contain("Null Condition entry"));
}
@@ -373,8 +374,8 @@ public void Read_ObjectShape_UnknownLevel_ThrowsJsonException()
{
const string json = "{\"Bogus\":[{\"dataItemId\":\"x1\"}]}";
- var ex = Assert.Throws(() =>
- JsonSerializer.Deserialize(json, Options()));
+ var ex = Assert.Throws((Action)(() =>
+ JsonSerializer.Deserialize(json, Options())));
Assert.That(ex, Is.Not.Null);
Assert.That(ex!.Message, Does.Contain("Unknown Condition level"));
}
diff --git a/tests/MTConnect.NET-JSON-cppagent-Tests/Streams/JsonSampleValueConverterEdgeCaseTests.cs b/tests/MTConnect.NET-JSON-cppagent-Tests/Streams/JsonSampleValueConverterEdgeCaseTests.cs
index cb16d108d..bee9e81af 100644
--- a/tests/MTConnect.NET-JSON-cppagent-Tests/Streams/JsonSampleValueConverterEdgeCaseTests.cs
+++ b/tests/MTConnect.NET-JSON-cppagent-Tests/Streams/JsonSampleValueConverterEdgeCaseTests.cs
@@ -1,6 +1,7 @@
// Copyright (c) 2026 TrakHound Inc., All Rights Reserved.
// TrakHound Inc. licenses this file to you under the MIT license.
+using System;
using System.Text.Json;
using MTConnect.NET_JSON_cppagent.Streams;
using MTConnect.Streams.Json;
@@ -139,7 +140,7 @@ public void Read_throws_for_unsupported_token(string payload)
options.Converters.Add(converter);
Assert.That(
- () => JsonSerializer.Deserialize