Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 22, 2026

  • Analyze existing code coverage and identify non-covered paths
  • Add tests for AIAgentMetadata - now covered (new test file)
  • Add tests for ChatMessageStoreExtensions - Removed to avoid duplication with Wesley's work
  • Add tests for AgentResponseExtensions.AsChatResponse and AsChatResponseUpdate
  • Add tests for AgentResponseExtensions.AsChatResponseUpdatesAsync
  • Add tests for AgentResponseUpdate.UserInputRequests - empty paths covered
  • Add tests for AgentResponse.UserInputRequests - empty paths covered
  • Add tests for AgentResponse.ToAgentResponseUpdates - no messages and usage/additional props only cases
  • Add tests for AgentResponse.Deserialize - null deserialization error case
  • Add tests for AIAgent Name and Description properties
  • Add tests for AIContextProvider.InvokingContext.RequestMessages setter
  • Add tests for AIContextProvider.InvokedContext properties (setter tests)
  • Add tests for DelegatingAIAgent.DeserializeThreadAsync
  • Add tests for InMemoryChatMessageStore.InvokedAsync with exception (early return)
  • Add tests for InMemoryChatMessageStore.InvokingAsync with null context
  • Add tests for ChatMessageStore.InvokingContext and ChatMessageStore.InvokedContext
  • Run tests and verify coverage improvement
  • Run code review - passed
  • Fix file encoding (add UTF-8 BOM) and naming rule violations
  • Remove ChatMessageStoreExtensionsTests.cs to avoid duplication with Wesley's PR

Summary

This PR adds unit tests to improve code coverage for Microsoft.Agents.AI.Abstractions.

All 265 tests pass successfully on .NET 10.0.

Original prompt

This section details on the original issue you should resolve

<issue_title>.NET: Improve unit test coverage for Microsoft.Agents.AI.Abstractions</issue_title>
<issue_description>85% code coverage in required, currently at 82.9%

</issue_description>

<agent_instructions>Please analyze the Cobertura Coverage information related to the Microsoft.Agents.AI.Abstractions and lets improve its coverage on non-covered paths.

Please keep the same patterns used for UnitTests existing into the Microsoft.Agents.AI.Abstractions.UnitTests.

Use our repository guidelines regarding UnitTests code as well as use our existing File approach for the UnitTests generatino, only creating new ones if the file being covered have not being covered yet.

Ensure the coverage only covers non-covered paths without duplicating paths that are already covered.

Ensure all existing tests are working on top of the new added ones. This change should only be focused in UnitTests not changing any functionality.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ 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: rogerbarreto <19890735+rogerbarreto@users.noreply.github.com>
Copilot AI changed the title [WIP] Improve unit test coverage for Microsoft.Agents.AI.Abstractions .NET: Improve unit test coverage for Microsoft.Agents.AI.Abstractions Jan 22, 2026
Copilot AI requested a review from rogerbarreto January 22, 2026 18:10
@rogerbarreto
Copy link
Member

@copilot

Address format issues below

/app/dotnet/tests/Microsoft.Agents.AI.Abstractions.UnitTests/AIAgentMetadataTests.cs(1,1): error CHARSET: Fix file encoding. [/app/dotnet/tests/Microsoft.Agents.AI.Abstractions.UnitTests/Microsoft.Agents.AI.Abstractions.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Abstractions.UnitTests/ChatMessageStoreExtensionsTests.cs(1,1): error CHARSET: Fix file encoding. [/app/dotnet/tests/Microsoft.Agents.AI.Abstractions.UnitTests/Microsoft.Agents.AI.Abstractions.UnitTests.csproj]
Running Code Style analysis.
Determining diagnostics...
Running 30 analyzers on Microsoft.Agents.AI.Abstractions.UnitTests(net10.0).
Running 30 analyzers on Microsoft.Agents.AI.Abstractions.UnitTests(net472).
/app/dotnet/tests/Microsoft.Agents.AI.Abstractions.UnitTests/AIAgentMetadataTests.cs(24,22): error IDE1006: Naming rule violation: These words must begin with upper case characters: providerName [/app/dotnet/tests/Microsoft.Agents.AI.Abstractions.UnitTests/Microsoft.Agents.AI.Abstractions.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Abstractions.UnitTests/AIAgentMetadataTests.cs(24,22): error IDE1006: Naming rule violation: These words must begin with upper case characters: providerName [/app/dotnet/tests/Microsoft.Agents.AI.Abstractions.UnitTests/Microsoft.Agents.AI.Abstractions.UnitTests.csproj]

Co-authored-by: rogerbarreto <19890735+rogerbarreto@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 23, 2026

@copilot

Address format issues below
...

Fixed in commit 5b3ff58:

  • Added UTF-8 BOM to both AIAgentMetadataTests.cs and ChatMessageStoreExtensionsTests.cs
  • Fixed naming rule violation by renaming providerName constant to ProviderName and removing the named parameter syntax

@rogerbarreto rogerbarreto marked this pull request as ready for review January 23, 2026 12:20
Copilot AI review requested due to automatic review settings January 23, 2026 12:20
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 the Microsoft.Agents.AI.Abstractions library to meet the 85% code coverage requirement. The coverage improved from 82.9% to 97.06% (line coverage from 87.76% to 97.06%, branch coverage from 79.67% to 91.20%).

Changes:

  • Added 47 new unit tests across 10 test files to cover previously untested code paths
  • Created 2 new test files for previously untested classes (AIAgentMetadataTests and ChatMessageStoreExtensionsTests)
  • Enhanced existing test files with additional tests for edge cases and property setters

Reviewed changes

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

Show a summary per file
File Description
AIAgentMetadataTests.cs New test file covering all constructors and properties of AIAgentMetadata class
ChatMessageStoreExtensionsTests.cs New test file covering WithMessageFilters and WithAIContextProviderMessageRemoval extension methods
InMemoryChatMessageStoreTests.cs Added tests for exception handling in InvokedAsync and null context validation in InvokingAsync
DelegatingAIAgentTests.cs Added test for DeserializeThreadAsync delegation to inner agent
ChatMessageStoreTests.cs Added comprehensive tests for InvokingContext and InvokedContext property setters and validation
AgentResponseUpdateTests.cs Added tests for UserInputRequests property with empty scenarios
AgentResponseUpdateExtensionsTests.cs Added tests for AsChatResponse, AsChatResponseUpdate, and AsChatResponseUpdatesAsync conversion methods
AgentResponseTests.cs Added tests for UserInputRequests, ToAgentResponseUpdates edge cases, and Deserialize null handling
AIContextProviderTests.cs Added tests for InvokingContext and InvokedContext property setters and validation
AIAgentTests.cs Added tests for Name and Description properties with new MockAgentWithName helper class

@rogerbarreto
Copy link
Member

@copilot Please attempt to resolve the conflict issues giving preference for the remote changes that potentially are related to the renaming of the ChatMessageStore.

And also have a look on the ChatMessageStoreExtensionsTests and avoid adding any duplicates there as wesley also added his covering potentially similar scenarios (giving preference for his implementations if any duplicate is found).

…esley's work

Co-authored-by: rogerbarreto <19890735+rogerbarreto@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 26, 2026

@copilot Please attempt to resolve the conflict issues giving preference for the remote changes that potentially are related to the renaming of the ChatMessageStore.

And also have a look on the `Ch...

Removed ChatMessageStoreExtensionsTests.cs in commit b1e4643 to avoid duplication with Wesley's work. All 265 remaining tests pass.

…nto copilot/improve-unit-test-coverage-again
@rogerbarreto rogerbarreto added this pull request to the merge queue Jan 26, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 26, 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.

.NET: Improve unit test coverage for Microsoft.Agents.AI.Abstractions

5 participants