Skip to content

.NET: add AgentSession StateBag edge case coverage#5838

Open
challaravinath wants to merge 1 commit into
microsoft:mainfrom
challaravinath:challaravinath-agentsession-tests
Open

.NET: add AgentSession StateBag edge case coverage#5838
challaravinath wants to merge 1 commit into
microsoft:mainfrom
challaravinath:challaravinath-agentsession-tests

Conversation

@challaravinath
Copy link
Copy Markdown

Motivation and Context

AgentSession.StateBag had only one existing test covering a basic set/get roundtrip.
Edge cases such as empty initial state, independent multi-key storage, and value overwrite behavior were not tested through the AgentSession layer, even though they are critical for session state correctness.

Description

  • Add test to verify AgentSession.StateBag is empty on initialization
  • Add test to verify multiple keys store and retrieve independently without interference
  • Add test to verify overwriting an existing key returns the updated value

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
  • dotnet test — 1141 tests, 0 failed
  • Is this a breaking change? No — this PR only adds new tests, no production code was modified.

Copilot AI review requested due to automatic review settings May 14, 2026 04:40
@moonbox3 moonbox3 added the .NET label May 14, 2026
@github-actions github-actions Bot changed the title add AgentSession StateBag edge case coverage .NET: add AgentSession StateBag edge case coverage May 14, 2026
Copy link
Copy Markdown
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

Adds three unit tests to cover previously untested edge cases of AgentSession.StateBag: default-empty state, independent multi-key storage, and value overwriting.

Changes:

  • Add StateBag_Default_IsEmpty test
  • Add StateBag_MultipleKeys_StoreAndRetrieveIndependently test
  • Add StateBag_OverwriteValue_ReturnsUpdatedValue test

@challaravinath
Copy link
Copy Markdown
Author

@challaravinath please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@microsoft-github-policy-service agree

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