mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
e7441ee29e
* Add agent hosting package and update sample * Review feedback and cleanup * Include the narrator * wip * wip * Remove workaround for empty state writes. * Handle changes to AgentThread. * One more. * Fix. --------- Co-authored-by: Aditya Mandaleeka <adityam@microsoft.com>
36 lines
1.1 KiB
C#
36 lines
1.1 KiB
C#
// Copyright (c) Microsoft. All rights reserved.
|
|
|
|
using System.Threading.Tasks;
|
|
using Microsoft.Extensions.AI.Agents.Runtime;
|
|
using Microsoft.Extensions.Logging;
|
|
using Microsoft.Extensions.Logging.Abstractions;
|
|
using Moq;
|
|
|
|
namespace Microsoft.Extensions.AI.Agents.Hosting.UnitTests;
|
|
|
|
/// <summary>
|
|
/// Unit tests for <see cref="AgentActor"/>.
|
|
/// </summary>
|
|
public class AgentActorTests
|
|
{
|
|
/// <summary>
|
|
/// Verifies that calling DisposeAsync completes successfully without throwing an exception.
|
|
/// </summary>
|
|
[Fact]
|
|
public async Task DisposeAsync_NoException_CompletesSuccessfullyAsync()
|
|
{
|
|
// Arrange
|
|
var mockAgent = new Mock<AIAgent>();
|
|
var mockContext = new Mock<IActorRuntimeContext>();
|
|
var mockLogger = NullLoggerFactory.Instance.CreateLogger<AgentActor>();
|
|
var actor = new AgentActor(mockAgent.Object, mockContext.Object, mockLogger);
|
|
|
|
// Act
|
|
var valueTask = actor.DisposeAsync();
|
|
|
|
// Assert
|
|
Assert.True(valueTask.IsCompleted, "DisposeAsync should return a completed ValueTask.");
|
|
await valueTask;
|
|
}
|
|
}
|