Files
agent-framework/dotnet/tests/Microsoft.Agents.AI.A2A.UnitTests/A2AAgentSessionTests.cs
westey a3a9147e61 .NET: [BREAKING] Rename AgentThread to AgentSession (#3430)
* Rename AgentThread to AgentSession

* Add more renames

* Update readme files

* Revert nullable variable change and further fixes.

* Revert change in header name

* Fix some comments and tests

* Update changelog.

* Address PR feedback.

* Fixing code review comments.

* Fix new errors after merging latest code.
2026-01-26 16:30:25 +00:00

31 lines
872 B
C#

// Copyright (c) Microsoft. All rights reserved.
using System.Text.Json;
namespace Microsoft.Agents.AI.A2A.UnitTests;
/// <summary>
/// Unit tests for the <see cref="A2AAgentSession"/> class.
/// </summary>
public sealed class A2AAgentSessionTests
{
[Fact]
public void Constructor_RoundTrip_SerializationPreservesState()
{
// Arrange
const string ContextId = "context-rt-001";
const string TaskId = "task-rt-002";
A2AAgentSession originalSession = new() { ContextId = ContextId, TaskId = TaskId };
// Act
JsonElement serialized = originalSession.Serialize();
A2AAgentSession deserializedSession = new(serialized);
// Assert
Assert.Equal(originalSession.ContextId, deserializedSession.ContextId);
Assert.Equal(originalSession.TaskId, deserializedSession.TaskId);
}
}