Skip to content

Fix targeted activity integration tests - #660

Merged
Corina (corinagum) merged 4 commits into
mainfrom
corinagum-integration-test-failures
Aug 27, 2026
Merged

Fix targeted activity integration tests#660
Corina (corinagum) merged 4 commits into
mainfrom
corinagum-integration-test-failures

Conversation

@corinagum

Copy link
Copy Markdown
Collaborator

What changed

Fix CreateMessageActivity(text, recipient) silently dropping its recipient. The helper in ApiClientTests.cs accepted a ChannelAccount and then returned the activity without ever applying it, so targeted activities went out with no recipient. The service rejects those with 400 BadArgument: Recipient of Targeted Message cannot be null, which failed Activities_CreateTargetedAsync, Activities_UpdateTargetedAsync, and Activities_DeleteTargetedAsync. The helper now calls WithRecipient(..., isTargeted: true).

Add a regression test for targeted update payloads. UpdateActivityAsync_WithIsTargeted_DoesNotSendRecipient asserts that the serialized body omits recipient. C# already behaves correctly here, but only by caller convention: ConversationClient serializes the activity verbatim and does no stripping, so nothing was guarding the behavior. This closes a parity gap with the equivalent TypeScript coverage.

Testing

Integration suite run against a live canary tenant: the three targeted activity tests now pass, with no change to any other test outcome. The new unit test passes and was mutation-checked by injecting a recipient, which fails it as expected.

No product code changed.

Corina (corinagum) and others added 2 commits August 26, 2026 09:11
The same .runsettings ignore fix is being made in another branch. Dropping
it here keeps this PR limited to the targeted activity test changes.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: be5db5b3-3376-4b00-8f4d-51d1bf51d101
Copilot AI lite review requested due to automatic review settings August 26, 2026 18:48
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 fixes failing targeted-activity integration tests by ensuring the test helper correctly sets a recipient on targeted message activities, and adds a unit test to prevent targeted update requests from inadvertently including a recipient field in the JSON payload.

Changes:

  • Fix CreateMessageActivity(text, recipient) in integration tests to apply the provided recipient as a targeted recipient.
  • Add a unit test asserting ConversationClient.UpdateActivityAsync(..., isTargeted: true) does not send a top-level recipient property in the request body.
  • Add System.Text.Json usage in unit tests to validate request payload structure.

Reviewed changes

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

File Description
test/Microsoft.Teams.Core.UnitTests/ConversationClientTests.cs Adds a targeted-update regression test by parsing captured request JSON and asserting recipient is omitted.
test/IntegrationTests/ApiClientTests.cs Fixes targeted message test helper to include a targeted recipient so targeted activity integration tests don’t send null recipients.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread test/IntegrationTests/ApiClientTests.cs Outdated
Comment thread test/Microsoft.Teams.Core.UnitTests/ConversationClientTests.cs Outdated
Comment thread test/IntegrationTests/README.md
Comment thread test/IntegrationTests/README.md
@corinagum
Corina (corinagum) added this pull request to the merge queue Aug 26, 2026
Merged via the queue into main with commit f5034ac Aug 27, 2026
9 checks passed
@corinagum
Corina (corinagum) deleted the corinagum-integration-test-failures branch August 27, 2026 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants