Files
Copilot e8902c0d11 .NET: Improve unit test coverage for Microsoft.Agents.AI.Abstractions (#3381)
* Initial plan

* Add unit tests to improve coverage for Microsoft.Agents.AI.Abstractions

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

* Fix file encoding and naming rule violation in new test files

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

* Remove ChatMessageStoreExtensionsTests.cs to avoid duplication with Wesley's work

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

* Fix AgentThread to AgentSession rename in unit tests

Update MockAgentWithName in AIAgentTests.cs and DelegatingAIAgentTests.cs
to use the renamed AgentSession class and corresponding methods:
- AgentThread -> AgentSession
- GetNewThreadAsync -> GetNewSessionAsync
- DeserializeThreadAsync -> DeserializeSessionAsync
- thread parameter -> session parameter

* Fix: Rename GetNewSessionAsync to CreateSessionAsync to match API changes

* Fix: Add SerializeSession override and remove async from DeserializeSessionAsync

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: rogerbarreto <19890735+rogerbarreto@users.noreply.github.com>
2026-02-04 17:43:31 +00:00

43 lines
992 B
C#

// Copyright (c) Microsoft. All rights reserved.
namespace Microsoft.Agents.AI.Abstractions.UnitTests;
/// <summary>
/// Unit tests for the <see cref="AIAgentMetadata"/> class.
/// </summary>
public class AIAgentMetadataTests
{
[Fact]
public void Constructor_WithNoArguments_SetsProviderNameToNull()
{
// Arrange & Act
AIAgentMetadata metadata = new();
// Assert
Assert.Null(metadata.ProviderName);
}
[Fact]
public void Constructor_WithProviderName_SetsProperty()
{
// Arrange
const string ProviderName = "TestProvider";
// Act
AIAgentMetadata metadata = new(ProviderName);
// Assert
Assert.Equal(ProviderName, metadata.ProviderName);
}
[Fact]
public void Constructor_WithNullProviderName_SetsProviderNameToNull()
{
// Arrange & Act
AIAgentMetadata metadata = new(null);
// Assert
Assert.Null(metadata.ProviderName);
}
}