Files
agent-framework/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Framework/IntegrationTest.cs
T
Chris 6d0f28eb9b .NET Workflows - Re-enable Declarative Integration Tests (#1080)
* Investigate

* Next

* Update initialization

* Should be ok

* Agent definition dx

* Link agent definitions

* Link agent definitions

* Path resolution #2

* Fix path resolution

* Another pass

* Another

* Better

* One more

* Whoopsie

* Update dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Framework/AgentFactory.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Namespace

* Cleanup

* Temp config for pipeline

* Another temp workaround

* Test config: Bing Grounding Tool

* Update template

* Next pass

* Ok now

* Cleanup

* Test note

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-01 22:21:45 +00:00

57 lines
1.5 KiB
C#

// Copyright (c) Microsoft. All rights reserved.
using System;
using System.Reflection;
using Microsoft.Agents.AI.Workflows.Declarative.PowerFx;
using Microsoft.Bot.ObjectModel;
using Microsoft.Extensions.Configuration;
using Xunit.Abstractions;
namespace Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests.Framework;
/// <summary>
/// Base class for workflow tests.
/// </summary>
public abstract class IntegrationTest : IDisposable
{
public TestOutputAdapter Output { get; }
protected IntegrationTest(ITestOutputHelper output)
{
this.Output = new TestOutputAdapter(output);
Console.SetOut(this.Output);
SetProduct();
}
public void Dispose()
{
this.Dispose(isDisposing: true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool isDisposing)
{
if (isDisposing)
{
this.Output.Dispose();
}
}
protected static void SetProduct()
{
if (!ProductContext.IsLocalScopeSupported())
{
ProductContext.SetContext(Product.Foundry);
}
}
internal static string FormatVariablePath(string variableName, string? scope = null) => $"{scope ?? WorkflowFormulaState.DefaultScopeName}.{variableName}";
protected static IConfigurationRoot InitializeConfig() =>
new ConfigurationBuilder()
.AddJsonFile("appsettings.Development.json", true)
.AddEnvironmentVariables()
.AddUserSecrets(Assembly.GetExecutingAssembly())
.Build();
}