Address review feedback: simplify Throw.IfNull in SwitchBuilder per westey-m suggestion

Agent-Logs-Url: https://github.com/microsoft/agent-framework/sessions/299950fd-4457-47f3-a373-f65d601b7ea5

Co-authored-by: lokitoth <6936551+lokitoth@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-05-14 12:50:37 +00:00
committed by GitHub
Unverified
parent 6b8b43065a
commit 14b9c02c52
2 changed files with 4 additions and 4 deletions
@@ -39,7 +39,7 @@ public sealed class SwitchBuilder
foreach (ExecutorBinding executor in executors)
{
Throw.IfNull(executor, nameof(executors));
Throw.IfNull(executor);
if (!this._executorIndicies.TryGetValue(executor.Id, out int index))
{
@@ -68,7 +68,7 @@ public sealed class SwitchBuilder
foreach (ExecutorBinding executor in executors)
{
Throw.IfNull(executor, nameof(executors));
Throw.IfNull(executor);
if (!this._executorIndicies.TryGetValue(executor.Id, out int index))
{
@@ -445,9 +445,9 @@ public partial class WorkflowBuilderSmokeTests
// Act/Assert
Assert.Throws<ArgumentNullException>("predicate", () => switchBuilder.AddCase<string>(null!, [target]));
Assert.Throws<ArgumentNullException>("executors", () => switchBuilder.AddCase<string>(_ => true, null!));
Assert.Throws<ArgumentNullException>("executors", () => switchBuilder.AddCase<string>(_ => true, [target, null!]));
Assert.Throws<ArgumentNullException>("executor", () => switchBuilder.AddCase<string>(_ => true, [target, null!]));
Assert.Throws<ArgumentNullException>("executors", () => switchBuilder.WithDefault(null!));
Assert.Throws<ArgumentNullException>("executors", () => switchBuilder.WithDefault([target, null!]));
Assert.Throws<ArgumentNullException>("executor", () => switchBuilder.WithDefault([target, null!]));
}
/// <summary>