Files
semantic-kernel/dotnet/samples/KernelSyntaxExamples/BaseTest.cs
T
Yan LiandDmytro Struk afa187db9a .Net: Update FlowOrchestrator to use yaml plugins and reliability improvement (#4665)
### Motivation and Context

1. Update FlowOrchestrator to use yaml plugin definitions
2. Necessary changes to allow non-chat AI Service for ReAct, for better
reliability
3. Some bug fix for repeatable steps

### Description
as above

### Contribution Checklist

<!-- Before submitting this PR, please make sure: -->

- [x] The code builds clean without any errors or warnings
- [x] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [x] All unit tests pass, and I have added new tests where possible
- [x] I didn't break anyone 😄

---------

Co-authored-by: Dmytro Struk <[email protected]>
2024-01-24 15:58:40 +00:00

53 lines
1.5 KiB
C#

// Copyright (c) Microsoft. All rights reserved.
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using RepoUtils;
using Xunit.Abstractions;
namespace Examples;
public abstract class BaseTest
{
protected ITestOutputHelper Output { get; }
protected ILoggerFactory LoggerFactory { get; }
protected BaseTest(ITestOutputHelper output)
{
this.Output = output;
this.LoggerFactory = new XunitLogger<object>(output);
LoadUserSecrets();
}
private static void LoadUserSecrets()
{
IConfigurationRoot configRoot = new ConfigurationBuilder()
.AddJsonFile("appsettings.Development.json", true)
.AddEnvironmentVariables()
.AddUserSecrets<Env>()
.Build();
TestConfiguration.Initialize(configRoot);
}
/// <summary>
/// This method can be substituted by Console.WriteLine when used in Console apps.
/// </summary>
/// <param name="target">Target object to write</param>
protected void WriteLine(object? target = null)
{
this.Output.WriteLine(target ?? string.Empty);
}
/// <summary>
/// Current interface ITestOutputHelper does not have a Write method. This extension method adds it to make it analogous to Console.Write when used in Console apps.
/// </summary>
/// <param name="target">Target object to write</param>
protected void Write(object? target = null)
{
this.Output.WriteLine(target ?? string.Empty);
}
}