Skip to content

.NET: Expand Workflow Unit Test Coverage#5390

Merged
lokitoth merged 9 commits intomainfrom
dev/dotnet_workflow/add_unit_tests
Apr 21, 2026
Merged

.NET: Expand Workflow Unit Test Coverage#5390
lokitoth merged 9 commits intomainfrom
dev/dotnet_workflow/add_unit_tests

Conversation

@lokitoth
Copy link
Copy Markdown
Member

@lokitoth lokitoth commented Apr 21, 2026

Description

  • Adds unit tests for ChatForwardingExecutor, FunctionExecutor
  • Adds test for failure when trying to host non-ChatProtocol workflow as an AIAgent
  • Remove dead code and suppress coverage for HandoffsWorkflowBuilder (obsolete name, all fuctionality covered by existing tests targeting HandoffWorkflowBuilder)
  • Obsolete unused attributes
  • Contributes to .NET: Improve unit test coverage for Microsoft.Agents.AI.Workflows #3342

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.

@lokitoth lokitoth self-assigned this Apr 21, 2026
Copilot AI review requested due to automatic review settings April 21, 2026 08:19
@lokitoth lokitoth added .NET workflows Related to Workflows in agent-framework labels Apr 21, 2026
Copy link
Copy Markdown
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

Expands .NET workflow unit test coverage (targeting the Workflows library) and removes/adjusts some legacy or dead code to help meet the required coverage threshold.

Changes:

  • Added new unit tests for ChatForwardingExecutor and FunctionExecutor, plus a smoke test ensuring non-ChatProtocol workflows cannot be hosted as an AIAgent.
  • Updated FunctionExecutor to correctly incorporate IO attributes ([SendsMessage] / [YieldsOutput]) for synchronous delegates.
  • Removed unused public attributes / helper code and excluded an obsolete builder type from code coverage.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/WorkflowHostSmokeTests.cs Adds a regression test that hosting a non-ChatProtocol workflow as an agent fails.
dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/FunctionExecutorTests.cs New tests validating delegate invocation and protocol registration behavior for FunctionExecutor.
dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/ChatForwardingExecutorTests.cs New tests validating forwarding behavior across supported message shapes and string-role configuration.
dotnet/src/Microsoft.Agents.AI.Workflows/StreamsMessageAttribute.cs Removes an unused public attribute type.
dotnet/src/Microsoft.Agents.AI.Workflows/HandoffWorkflowBuilder.cs Excludes obsolete HandoffsWorkflowBuilder from coverage due to 1:1 equivalence with the preferred type.
dotnet/src/Microsoft.Agents.AI.Workflows/FunctionExecutor.cs Fixes sync-delegate constructors to capture IO attribute types for protocol declaration.
dotnet/src/Microsoft.Agents.AI.Workflows/ChatForwardingExecutor.cs Uses configured StringMessageChatRole when converting string inputs to ChatMessage.
dotnet/src/Microsoft.Agents.AI.Workflows/Attributes/YieldsMessageAttribute.cs Removes an unused public attribute type (legacy name vs YieldsOutputAttribute).
dotnet/src/Microsoft.Agents.AI.Workflows/AIAgentsAbstractionsExtensions.cs Removes an unused internal ToChatMessage conversion helper.
dotnet/src/Microsoft.Agents.AI.Workflows.Generators/Analysis/SemanticAnalyzer.cs Updates documentation comment to reflect .YieldsOutput protocol generation.

- the correct one to use is YieldsOutputAttribute
- fixes a comment that mistakenly refers to `.YieldsMessage()` which does not exist.
…ages

- make ChatForwardingExecutor use its configured role for string messages rather than always use ChatRole.User
- add ChatForwardingExecutor tests
- also fixes Send and YieldOutput type registration for synchronous output-returning delegates
- avoid hard-breaking change
- properly notify users that these attributes get ignored
@lokitoth lokitoth force-pushed the dev/dotnet_workflow/add_unit_tests branch from f9edd70 to 2f12d87 Compare April 21, 2026 14:41
@lokitoth lokitoth moved this to In Progress in Agent Framework Apr 21, 2026
@lokitoth lokitoth marked this pull request as ready for review April 21, 2026 14:57
@lokitoth lokitoth moved this from In Progress to In Review in Agent Framework Apr 21, 2026
@lokitoth lokitoth added this pull request to the merge queue Apr 21, 2026
Merged via the queue into main with commit 267351b Apr 21, 2026
21 checks passed
@github-project-automation github-project-automation Bot moved this from In Review to Done in Agent Framework Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

.NET workflows Related to Workflows in agent-framework

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants