db620d33df
CodeQL / Analyze (csharp) (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run
dotnet-build-and-test / dotnet-test-functions (push) Has been cancelled
dotnet-build-and-test / paths-filter (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Debug, windows-latest, net9.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Release, ubuntu-latest, net10.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Release, ubuntu-latest, net8.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Release, windows-latest, net472) (push) Has been cancelled
dotnet-build-and-test / dotnet-test (Release, integration, true, ubuntu-latest, net10.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-test (Release, integration, true, windows-latest, net472) (push) Has been cancelled
dotnet-build-and-test / dotnet-foundry-hosted-it (push) Has been cancelled
dotnet-build-and-test / dotnet-build-and-test-check (push) Has been cancelled
dotnet-build-and-test / Integration Test Report (push) Has been cancelled
45 lines
1.3 KiB
C#
45 lines
1.3 KiB
C#
// Copyright (c) Microsoft. All rights reserved.
|
|
|
|
using System.Collections.Generic;
|
|
using Microsoft.Extensions.AI;
|
|
using Moq;
|
|
|
|
namespace Microsoft.Agents.AI.Valkey.UnitTests;
|
|
|
|
internal sealed class TestAgentSession : AgentSession
|
|
{
|
|
public TestAgentSession()
|
|
{
|
|
this.StateBag = new AgentSessionStateBag();
|
|
}
|
|
}
|
|
|
|
internal static class TestHelpers
|
|
{
|
|
internal static readonly AIAgent MockAgent = new Mock<AIAgent>().Object;
|
|
|
|
internal static ChatHistoryProvider.InvokingContext CreateChatHistoryInvokingContext(
|
|
IEnumerable<ChatMessage>? requestMessages = null)
|
|
{
|
|
#pragma warning disable MAAI001
|
|
return new ChatHistoryProvider.InvokingContext(
|
|
MockAgent,
|
|
new TestAgentSession(),
|
|
requestMessages ?? [new ChatMessage(ChatRole.User, "test")]);
|
|
#pragma warning restore MAAI001
|
|
}
|
|
|
|
internal static ChatHistoryProvider.InvokedContext CreateChatHistoryInvokedContext(
|
|
IEnumerable<ChatMessage> requestMessages,
|
|
IEnumerable<ChatMessage> responseMessages)
|
|
{
|
|
#pragma warning disable MAAI001
|
|
return new ChatHistoryProvider.InvokedContext(
|
|
MockAgent,
|
|
new TestAgentSession(),
|
|
requestMessages,
|
|
responseMessages);
|
|
#pragma warning restore MAAI001
|
|
}
|
|
}
|