.NET: Expand Workflow Unit Test Coverage#5390
Merged
Conversation
Contributor
There was a problem hiding this comment.
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
ChatForwardingExecutorandFunctionExecutor, plus a smoke test ensuring non-ChatProtocol workflows cannot be hosted as anAIAgent. - Updated
FunctionExecutorto 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
f9edd70 to
2f12d87
Compare
westey-m
approved these changes
Apr 21, 2026
SergeyMenshykh
approved these changes
Apr 21, 2026
peibekwe
reviewed
Apr 21, 2026
peibekwe
approved these changes
Apr 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
ChatForwardingExecutor,FunctionExecutorHandoffsWorkflowBuilder(obsolete name, all fuctionality covered by existing tests targetingHandoffWorkflowBuilder)Contribution Checklist