Skip to content

Commit ae03e24

Browse files
committed
fix(tests): disambiguate Assert.DoesNotThrow/Throws overloads post-NUnit4 rebase
Rebasing onto upstream/master (PR #220 merge) pulled in AgentUuidValidationTests.cs, whose bare lambda arguments to Assert.DoesNotThrow / Assert.Throws are ambiguous between the TestDelegate and Action overloads once NUnit is upgraded to 4.x. TestDelegate is obsolete-as-error in NUnit 4, so cast to Action explicitly at the three call sites instead.
1 parent 5ac0dad commit ae03e24

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

tests/MTConnect.NET-Common-Tests/Agents/AgentUuidValidationTests.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -601,15 +601,15 @@ public void Warn_delegate_emits_persisted_warn_only_when_override_null_and_persi
601601
[Test]
602602
public void Null_warn_delegate_does_not_throw_on_either_rejection_path()
603603
{
604-
Assert.DoesNotThrow(() =>
604+
Assert.DoesNotThrow((Action)(() =>
605605
{
606606
_ = AgentUuidResolver.Resolve(
607607
operatorSuppliedUuid: "not-a-uuid",
608608
persistedUuid: "also-not-a-uuid",
609609
agentName: "test-agent",
610610
hostname: "test-host",
611611
warn: null);
612-
});
612+
}));
613613
}
614614

615615
/// <summary>
@@ -620,14 +620,14 @@ public void Null_warn_delegate_does_not_throw_on_either_rejection_path()
620620
[Test]
621621
public void Default_warn_argument_omitted_does_not_throw()
622622
{
623-
Assert.DoesNotThrow(() =>
623+
Assert.DoesNotThrow((Action)(() =>
624624
{
625625
_ = AgentUuidResolver.Resolve(
626626
operatorSuppliedUuid: "not-a-uuid",
627627
persistedUuid: "also-not-a-uuid",
628628
agentName: "test-agent",
629629
hostname: "test-host");
630-
});
630+
}));
631631
}
632632

633633
// ------------------------------------------------------------------
@@ -1056,7 +1056,7 @@ public void Resolve_warn_on_nil_uuid_uses_broad_acceptable_wording()
10561056
public void Derive_throws_when_both_agent_name_and_hostname_are_empty(string agentName, string hostname)
10571057
{
10581058
Assert.Throws<ArgumentException>(
1059-
() => DeterministicAgentUuid.Derive(agentName, hostname, port: 0),
1059+
(Action)(() => DeterministicAgentUuid.Derive(agentName, hostname, port: 0)),
10601060
"Both seed components empty must not silently derive a fleet-wide collision UUID.");
10611061
}
10621062

0 commit comments

Comments
 (0)