mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
aaa91954c5
* AgentFactory abstractions and ChatClient implementation * Add a getitng started sample * Update to latest M.B.OM * Add some additional samples * Work in progress * Merge latest from main * Start to add support for using different kinds of connections * Remove IsSupported * Remove IsSupported * Refactor code to create clients to support DI * Add some unit tests * Update based on the latest code review feedback * Add support for OOB tools when using persistent agent sdk * Fix sample naming * Fix error based on latest MEAI * Update M.B.OM package to latest * Update to the latest M.B.OM release * Remove some obsolete helper methods * Update to the latest M.B.OM version * Fix broken unit test * Update MCP sample * Bump to latest M.B.OM release * Update to latest M.B.OM release * Update to latest M.B.OM release * Switch to using ExternalModel * Update to latest M.B.OM * Resolve merge conflicts * All tests pass * All tests pass * Start to clean up the code * Start to clean up the code * More clean up * More clean up * More clean up * Fix apiType checks * Run dotnet format * Fix typo * Address code review feedback * Add all properties for MCP tool * Address code review feedback * Address code review feedback * Fix merge * Undo warnings * Undo test change * More copilot feedback * Make class sealed * Address additional core review feedback --------- Co-authored-by: Mark Wallace <markwallace@microsoft.com>
82 lines
2.4 KiB
C#
82 lines
2.4 KiB
C#
// Copyright (c) Microsoft. All rights reserved.
|
|
|
|
using System;
|
|
using System.Reflection;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Shared.IntegrationTests;
|
|
using Xunit.Abstractions;
|
|
|
|
namespace Microsoft.Agents.AI.Declarative.IntegrationTests;
|
|
|
|
/// <summary>
|
|
/// Base class for integration tests.
|
|
/// </summary>
|
|
public abstract class BaseIntegrationTest : IDisposable
|
|
{
|
|
private IConfigurationRoot? _configuration;
|
|
private AzureAIConfiguration? _foundryConfiguration;
|
|
private OpenAIConfiguration? _openAIConfiguration;
|
|
private FoundryProjectConfiguration? _foundryProjectConfiguration;
|
|
|
|
protected IConfigurationRoot Configuration => this._configuration ??= InitializeConfig();
|
|
|
|
internal AzureAIConfiguration FoundryConfiguration
|
|
{
|
|
get
|
|
{
|
|
this._foundryConfiguration ??= this.Configuration.GetSection("AzureAI").Get<AzureAIConfiguration>();
|
|
Assert.NotNull(this._foundryConfiguration);
|
|
return this._foundryConfiguration;
|
|
}
|
|
}
|
|
|
|
internal OpenAIConfiguration OpenAIConfiguration
|
|
{
|
|
get
|
|
{
|
|
this._openAIConfiguration ??= this.Configuration.GetSection("OpenAI").Get<OpenAIConfiguration>();
|
|
Assert.NotNull(this._openAIConfiguration);
|
|
return this._openAIConfiguration;
|
|
}
|
|
}
|
|
|
|
internal FoundryProjectConfiguration FoundryProjectConfiguration
|
|
{
|
|
get
|
|
{
|
|
this._foundryProjectConfiguration ??= this.Configuration.GetSection("FoundryProject").Get<FoundryProjectConfiguration>();
|
|
Assert.NotNull(this._foundryProjectConfiguration);
|
|
return this._foundryProjectConfiguration;
|
|
}
|
|
}
|
|
|
|
public TestOutputAdapter Output { get; }
|
|
|
|
protected BaseIntegrationTest(ITestOutputHelper output)
|
|
{
|
|
this.Output = new TestOutputAdapter(output);
|
|
Console.SetOut(this.Output);
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
this.Dispose(isDisposing: true);
|
|
GC.SuppressFinalize(this);
|
|
}
|
|
|
|
protected virtual void Dispose(bool isDisposing)
|
|
{
|
|
if (isDisposing)
|
|
{
|
|
this.Output.Dispose();
|
|
}
|
|
}
|
|
|
|
private static IConfigurationRoot InitializeConfig() =>
|
|
new ConfigurationBuilder()
|
|
.AddJsonFile("appsettings.Development.json", true)
|
|
.AddEnvironmentVariables()
|
|
.AddUserSecrets(Assembly.GetExecutingAssembly())
|
|
.Build();
|
|
}
|