mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
bbde248839
* Add unit tests for create conversation executor * Update indentation and comment typo.
32 lines
918 B
C#
32 lines
918 B
C#
// Copyright (c) Microsoft. All rights reserved.
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using Moq;
|
|
|
|
namespace Microsoft.Agents.AI.Workflows.Declarative.UnitTests;
|
|
|
|
/// <summary>
|
|
/// Mock implementation of <see cref="WorkflowAgentProvider"/> for unit testing purposes.
|
|
/// </summary>
|
|
internal sealed class MockAgentProvider : Mock<WorkflowAgentProvider>
|
|
{
|
|
public IList<string> ExistingConversationIds { get; } = [];
|
|
|
|
public MockAgentProvider()
|
|
{
|
|
this.Setup(provider => provider.CreateConversationAsync(It.IsAny<CancellationToken>()))
|
|
.Returns(() => Task.FromResult(this.CreateConversationId()));
|
|
}
|
|
|
|
private string CreateConversationId()
|
|
{
|
|
string newConversationId = Guid.NewGuid().ToString("N");
|
|
this.ExistingConversationIds.Add(newConversationId);
|
|
|
|
return newConversationId;
|
|
}
|
|
}
|