Skip to content

.NET Workflows - Add unit tests for CopyConversationMessagesExecutor (Declarative Workflows)#3834

Merged
crickman merged 7 commits intomainfrom
copilot/add-unit-tests-for-copyconversationmessagesexecuto
Feb 11, 2026
Merged

.NET Workflows - Add unit tests for CopyConversationMessagesExecutor (Declarative Workflows)#3834
crickman merged 7 commits intomainfrom
copilot/add-unit-tests-for-copyconversationmessagesexecuto

Conversation

Copy link
Contributor

Copilot AI commented Feb 10, 2026

Motivation and Context

Adds test coverage for CopyConversationMessagesExecutor to validate message copying behavior across different input formats and conversation contexts.

Description

Test Coverage (7 test methods)

  • Message format variations: string → ChatMessage, single record, multiple messages in table
  • Expression types: literal values vs. PowerFx variable expressions
  • Conversation context: workflow (with AgentResponseEvent) vs. external (no event)
  • Edge case: blank/null messages (no-op)

Implementation

  • Created CopyConversationMessagesExecutorTest.cs in ObjectModel folder
  • Follows established patterns: ExecuteTestAsync and CreateModel helper methods
  • Uses MockAgentProvider for message capture and verification
  • Validates both message creation calls and conditional event generation

Achieves 100% code coverage of all execution paths including:

  • Constructor and model validation
  • ExecuteAsync: message iteration, conversation type detection, event generation
  • GetInputMessages: expression evaluation and message conversion

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.

Copilot AI and others added 2 commits February 11, 2026 00:06
Co-authored-by: crickman <66376200+crickman@users.noreply.github.com>
Co-authored-by: crickman <66376200+crickman@users.noreply.github.com>
Copilot AI changed the title [WIP] Add unit test class for CopyConversationMessagesExecutor Add unit tests for CopyConversationMessagesExecutor Feb 11, 2026
Copilot AI requested a review from crickman February 11, 2026 00:14
@crickman crickman added .NET workflows Related to Workflows in agent-framework declarative-workflow v1.0 Features being tracked for the version 1.0 GA labels Feb 11, 2026
@github-actions github-actions bot changed the title Add unit tests for CopyConversationMessagesExecutor .NET: Add unit tests for CopyConversationMessagesExecutor Feb 11, 2026
@crickman crickman moved this to In Progress in Agent Framework Feb 11, 2026
@crickman crickman changed the title .NET: Add unit tests for CopyConversationMessagesExecutor .NET Workflows - Add unit tests for CopyConversationMessagesExecutor (Declarative Workflows) Feb 11, 2026
@crickman crickman marked this pull request as ready for review February 11, 2026 16:37
Copilot AI review requested due to automatic review settings February 11, 2026 16:37
@crickman crickman enabled auto-merge February 11, 2026 16:38
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

This PR adds comprehensive unit test coverage for CopyConversationMessagesExecutor, a component that copies messages into agent conversations within the declarative workflows system. The tests validate message copying behavior across different input formats (string, single record, multiple messages in table), expression types (literal vs. PowerFx variable), conversation contexts (workflow vs. external), and edge cases (blank/null messages).

Changes:

  • Added CopyConversationMessagesExecutorTest.cs with 7 test methods covering all execution paths
  • Refactored GetInputMessages() in CopyConversationMessagesExecutor.cs to add explicit null validation using Throw.IfNull, removing conditional null handling

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
CopyConversationMessagesExecutorTest.cs New test class with 7 test methods following established patterns, using MockAgentProvider for message capture and verification
CopyConversationMessagesExecutor.cs Refactored GetInputMessages() to add explicit Throw.IfNull validation for required Messages property, simplifying control flow

@crickman crickman moved this from In Progress to In Review in Agent Framework Feb 11, 2026
@crickman crickman added this pull request to the merge queue Feb 11, 2026
Merged via the queue into main with commit 692fcd1 Feb 11, 2026
14 checks passed
@github-project-automation github-project-automation bot moved this from In Review to Done in Agent Framework Feb 11, 2026
@crickman crickman deleted the copilot/add-unit-tests-for-copyconversationmessagesexecuto branch February 11, 2026 21:56
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: Done

Development

Successfully merging this pull request may close these issues.

4 participants