Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 10, 2026

Motivation and Context

The ForeachExecutor class had no unit test coverage. Unit tests ensure correctness of loop initialization, value iteration logic, index tracking, and state reset behavior.

Description

  • Created ForeachExecutorTest.cs with 100% line/branch coverage
  • Updated WorkflowActionExecutorTest to support non-discrete actions
  • Fine-tuned some method names
  • Updated semantics for DeclarativeWorkflowTest

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

Co-authored-by: crickman <66376200+crickman@users.noreply.github.com>
Copilot AI changed the title [WIP] Add unit test class for foreach executor Add unit tests for ForeachExecutor with comprehensive coverage Feb 11, 2026
Copilot AI requested a review from crickman February 11, 2026 00:12
@crickman crickman changed the title Add unit tests for ForeachExecutor with comprehensive coverage .NET Workflows - Add unit tests for ForeachExecutor (Declarative Workflows) Feb 11, 2026
@crickman crickman added .NET v1.0 Features being tracked for the version 1.0 GA declarative-workflow labels Feb 11, 2026
@markwallace-microsoft markwallace-microsoft added the workflows Related to Workflows in agent-framework label Feb 11, 2026
@crickman crickman marked this pull request as ready for review February 11, 2026 21:57
Copilot AI review requested due to automatic review settings February 11, 2026 21:57
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds unit test coverage for the declarative workflows ForeachExecutor, and updates the workflow visitor wiring to use a new loop-completion method name (CompleteAsync) instead of ResetAsync.

Changes:

  • Added ForeachExecutorTest.cs with unit tests covering initialization, iteration, index handling, completion, and reset behavior.
  • Refactored ForeachExecutor end-of-loop behavior by renaming ResetAsyncCompleteAsync and extracting shared state-reset logic.
  • Enhanced WorkflowActionExecutorTest helpers to support executing chained executors and selectively asserting discrete action events.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/ObjectModel/WorkflowActionExecutorTest.cs Adds helper overloads to execute single/multiple executors and optionally assert discrete action events.
dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/ObjectModel/ForeachExecutorTest.cs New unit tests for ForeachExecutor execution paths and loop behaviors.
dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/ForeachTemplateTest.cs Updates codegen test expectation from ResetAsync to CompleteAsync.
dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/ObjectModel/ForeachExecutor.cs Renames loop completion method and factors out shared reset logic; adjusts initialization behavior.
dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/WorkflowTemplateVisitor.cs Updates generated workflow template naming to reference CompleteAsync.
dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/WorkflowActionVisitor.cs Updates workflow graph wiring to invoke CompleteAsync at loop end.

@crickman crickman moved this from In Progress to In Review in Agent Framework Feb 11, 2026
…ts/ObjectModel/ForeachExecutorTest.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ts/ObjectModel/ForeachExecutorTest.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

declarative-workflow .NET v1.0 Features being tracked for the version 1.0 GA workflows Related to Workflows in agent-framework

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

4 participants