mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
a3a9147e61
* 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.
31 lines
872 B
C#
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);
|
|
}
|
|
}
|