// Copyright (c) Microsoft. All rights reserved.
using System;
using System.Threading.Tasks;
using AgentConformanceTests;
using Microsoft.Extensions.AI;
namespace AgentConformance.IntegrationTests;
///
/// Conformance tests for run methods on agents.
///
/// The type of test fixture used by the concrete test implementation.
/// Function to create the test fixture with.
public abstract class RunAsyncTests(Func createAgentFixture) : AgentTests(createAgentFixture)
where TAgentFixture : AgentFixture
{
[RetryFact(3, 5000)]
public virtual async Task RunReturnsResultAsync()
{
// Arrange
var agent = this.Fixture.Agent;
var thread = agent.GetNewThread();
// Act
var chatResponse = await agent.RunAsync(new ChatMessage(ChatRole.User, "What is the capital of France."), thread);
// Assert
Assert.NotNull(chatResponse);
Assert.Single(chatResponse.Messages);
Assert.Contains("Paris", chatResponse.Text);
}
}