Skip to content

.NET: Add unit tests for RequestExternalInputExecutor#3891

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/add-request-external-input-tests
Draft

.NET: Add unit tests for RequestExternalInputExecutor#3891
Copilot wants to merge 4 commits intomainfrom
copilot/add-request-external-input-tests

Conversation

Copy link
Contributor

Copilot AI commented Feb 12, 2026

Motivation and Context

Unit test coverage was missing for RequestExternalInputExecutor. The executor has two public methods (ExecuteAsync and CaptureResponseAsync) that required different testing approaches due to extension method usage.

Description

Added 7 unit tests achieving 100% line and branch coverage:

ExecuteAsync tests (4 tests) - Standard workflow execution pattern:

  • Naming convention validation for Steps.Input() and Steps.Capture()
  • Execution with/without variable assignment
  • Verification of IsDiscreteAction=false and EmitResultEvent=false

CaptureResponseAsync tests (3 tests) - Direct method invocation pattern:

  • Capturing response without workflow conversation (variable assignment only)
  • Capturing single message with conversation (calls WorkflowAgentProvider.CreateMessageAsync)
  • Capturing multiple messages with conversation (iterates all messages)

Key technique: Extension methods (SetLastMessageAsync, GetWorkflowConversation, QueueStateUpdateAsync) work naturally by wrapping mock IWorkflowContext with WorkflowFormulaState:

Mock<IWorkflowContext> mockBaseContext = new(MockBehavior.Loose);
DeclarativeWorkflowContext context = new(mockBaseContext.Object, this.State);
await action.CaptureResponseAsync(context, response, CancellationToken.None);

This eliminates complex mocking of extension methods - they use the framework's existing implementation.

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.

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: crickman <66376200+crickman@users.noreply.github.com>
Copilot AI changed the title [WIP] Add unit test class for RequestExternalInputExecutor Add unit tests for RequestExternalInputExecutor Feb 12, 2026
Copilot AI requested a review from crickman February 12, 2026 18:53
Co-authored-by: crickman <66376200+crickman@users.noreply.github.com>
@github-actions github-actions bot changed the title Add unit tests for RequestExternalInputExecutor .NET: Add unit tests for RequestExternalInputExecutor Feb 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants