-
Notifications
You must be signed in to change notification settings - Fork 1.1k
.NET: Improve unit test coverage for Microsoft.Agents.AI.Abstractions #3381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: rogerbarreto <19890735+rogerbarreto@users.noreply.github.com>
|
Address format issues below |
Co-authored-by: rogerbarreto <19890735+rogerbarreto@users.noreply.github.com>
There was a problem hiding this 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 (
AIAgentMetadataTestsandChatMessageStoreExtensionsTests) - 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 |
dotnet/tests/Microsoft.Agents.AI.Abstractions.UnitTests/ChatMessageStoreExtensionsTests.cs
Outdated
Show resolved
Hide resolved
|
@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 |
…esley's work Co-authored-by: rogerbarreto <19890735+rogerbarreto@users.noreply.github.com>
Removed |
…nto copilot/improve-unit-test-coverage-again
AIAgentMetadata- now covered (new test file)Add tests for- Removed to avoid duplication with Wesley's workChatMessageStoreExtensionsAgentResponseExtensions.AsChatResponseandAsChatResponseUpdateAgentResponseExtensions.AsChatResponseUpdatesAsyncAgentResponseUpdate.UserInputRequests- empty paths coveredAgentResponse.UserInputRequests- empty paths coveredAgentResponse.ToAgentResponseUpdates- no messages and usage/additional props only casesAgentResponse.Deserialize- null deserialization error caseAIAgentName and Description propertiesAIContextProvider.InvokingContext.RequestMessagessetterAIContextProvider.InvokedContextproperties (setter tests)DelegatingAIAgent.DeserializeThreadAsyncInMemoryChatMessageStore.InvokedAsyncwith exception (early return)InMemoryChatMessageStore.InvokingAsyncwith null contextChatMessageStore.InvokingContextandChatMessageStore.InvokedContextSummary
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
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.