Files
Copilot c72455508b .NET: Add comprehensive test classes for extension methods in Microsoft.Agents.AI.Workflows.Declarative (#1555)
* Initial plan

* Add test classes for extension methods

Co-authored-by: crickman <66376200+crickman@users.noreply.github.com>

* Fix test issues and document bug in ExpandoObjectExtensions

Co-authored-by: crickman <66376200+crickman@users.noreply.github.com>

* Address code review feedback - shorten Skip messages and add explanatory comments

Co-authored-by: crickman <66376200+crickman@users.noreply.github.com>

* Replace Fields.ToDictionary with GetField calls and fix ExpandoObjectExtensions bug

Co-authored-by: crickman <66376200+crickman@users.noreply.github.com>

* Update dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Extensions/DataValueExtensionsTests.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Extensions/DataValueExtensionsTests.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Remove unused using statement from DialogBaseExtensionsTests

Co-authored-by: crickman <66376200+crickman@users.noreply.github.com>

* Add proper WrapWithBot tests using AdaptiveDialog and OnActivity

Co-authored-by: crickman <66376200+crickman@users.noreply.github.com>

* Cleanup

* Better

* Better

* One more test

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: crickman <66376200+crickman@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Chris Rickman <crickman@microsoft.com>
2025-10-20 15:21:46 +00:00

46 lines
1.2 KiB
C#

// Copyright (c) Microsoft. All rights reserved.
using Microsoft.Agents.AI.Workflows.Declarative.Extensions;
using Microsoft.Bot.ObjectModel;
namespace Microsoft.Agents.AI.Workflows.Declarative.UnitTests.Extensions;
/// <summary>
/// Tests for <see cref="DialogBaseExtensions"/>.
/// </summary>
public sealed class DialogBaseExtensionsTests
{
[Fact]
public void WrapWithBotCreatesValidBotDefinition()
{
// Arrange
AdaptiveDialog dialog = new AdaptiveDialog.Builder()
{
BeginDialog = new OnActivity.Builder()
{
Id = "test_dialog",
},
}.Build();
// Assert
Assert.False(dialog.HasSchemaName);
// Act
AdaptiveDialog wrappedDialog = dialog.WrapWithBot();
// Assert
VerifyWrappedDialog(wrappedDialog);
// Act & Assert
VerifyWrappedDialog(wrappedDialog.WrapWithBot());
}
private static void VerifyWrappedDialog(AdaptiveDialog wrappedDialog)
{
Assert.NotNull(wrappedDialog);
Assert.NotNull(wrappedDialog.BeginDialog);
Assert.Equal("test_dialog", wrappedDialog.BeginDialog.Id);
Assert.True(wrappedDialog.HasSchemaName);
}
}