mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
75a8335af5
* Builds locally and tests pass * Fix typo * Reverted nuget config change to remove internal feed and map to new public object model package with renames. * Renaming Bot object model in additional sample. --------- Co-authored-by: Peter Ibekwe <peibekwe@microsoft.com>
52 lines
1.6 KiB
C#
52 lines
1.6 KiB
C#
// Copyright (c) Microsoft. All rights reserved.
|
|
|
|
using System.Threading.Tasks;
|
|
using Microsoft.Agents.AI.Workflows.Declarative.ObjectModel;
|
|
using Microsoft.Agents.ObjectModel;
|
|
using Xunit.Abstractions;
|
|
|
|
namespace Microsoft.Agents.AI.Workflows.Declarative.UnitTests.ObjectModel;
|
|
|
|
/// <summary>
|
|
/// Tests for <see cref="SendActivityExecutor"/>.
|
|
/// </summary>
|
|
public sealed class SendActivityExecutorTest(ITestOutputHelper output) : WorkflowActionExecutorTest(output)
|
|
{
|
|
[Fact]
|
|
public async Task CaptureActivityAsync()
|
|
{
|
|
// Arrange
|
|
SendActivity model =
|
|
this.CreateModel(
|
|
this.FormatDisplayName(nameof(CaptureActivityAsync)),
|
|
"Test activity message");
|
|
|
|
// Act
|
|
SendActivityExecutor action = new(model, this.State);
|
|
WorkflowEvent[] events = await this.ExecuteAsync(action);
|
|
|
|
// Assert
|
|
VerifyModel(model, action);
|
|
Assert.Contains(events, e => e is MessageActivityEvent);
|
|
}
|
|
|
|
private SendActivity CreateModel(string displayName, string activityMessage, string? summary = null)
|
|
{
|
|
MessageActivityTemplate.Builder activityBuilder =
|
|
new()
|
|
{
|
|
Summary = summary,
|
|
Text = { TemplateLine.Parse(activityMessage) },
|
|
};
|
|
SendActivity.Builder actionBuilder =
|
|
new()
|
|
{
|
|
Id = this.CreateActionId(),
|
|
DisplayName = this.FormatDisplayName(displayName),
|
|
Activity = activityBuilder.Build(),
|
|
};
|
|
|
|
return AssignParent<SendActivity>(actionBuilder);
|
|
}
|
|
}
|