mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
74879489a4
* Checkpoint * Update workflows/DeepResearch.yaml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Comment * Fix comment * Update package version * Fix nuget haxx * Checkpoint * Code complete * Testing * Message content workaround * Add sequential flow * Checkpoint * Integration test project * Checkpoint * Checkpoint cleanup * Complete * Update package --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
54 lines
1.6 KiB
C#
54 lines
1.6 KiB
C#
// Copyright (c) Microsoft. All rights reserved.
|
|
|
|
using System.Threading.Tasks;
|
|
using Microsoft.Agents.Workflows.Declarative.ObjectModel;
|
|
using Microsoft.Bot.ObjectModel;
|
|
using Xunit.Abstractions;
|
|
|
|
namespace Microsoft.Agents.Workflows.Declarative.UnitTests.ObjectModel;
|
|
|
|
/// <summary>
|
|
/// Tests for <see cref="SendActivityExecutor"/>.
|
|
/// </summary>
|
|
public sealed class SendActivityExecutorTest(ITestOutputHelper output) : WorkflowActionExecutorTest(output)
|
|
{
|
|
[Fact]
|
|
public async Task CaptureActivity()
|
|
{
|
|
// Arrange
|
|
SendActivity model =
|
|
this.CreateModel(
|
|
this.FormatDisplayName(nameof(CaptureActivity)),
|
|
"Test activity message");
|
|
|
|
// Act
|
|
SendActivityExecutor action = new(model, this.GetState());
|
|
WorkflowEvent[] events = await this.Execute(action);
|
|
|
|
// Assert
|
|
this.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(),
|
|
};
|
|
|
|
SendActivity model = this.AssignParent<SendActivity>(actionBuilder);
|
|
|
|
return model;
|
|
}
|
|
}
|