Files
agent-framework/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Extensions/DeclarativeWorkflowOptionsExtensionsTests.cs
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

70 lines
2.0 KiB
C#

// Copyright (c) Microsoft. All rights reserved.
using Microsoft.Agents.AI.Workflows.Declarative.Extensions;
using Microsoft.PowerFx;
using Moq;
namespace Microsoft.Agents.AI.Workflows.Declarative.UnitTests.Extensions;
public sealed class DeclarativeWorkflowOptionsExtensionsTests
{
[Fact]
public void NullContext_UsesDefaultMaximumExpressionLength()
{
// Arrange
DeclarativeWorkflowOptions? options = null;
// Act
RecalcEngine engine = options.CreateRecalcEngine();
// Assert
Assert.NotNull(engine);
Assert.Equal(10000, engine.Config.MaximumExpressionLength);
}
[Fact]
public void OptionsWithoutLimits_UsesDefaults()
{
// Arrange
DeclarativeWorkflowOptions options = CreateOptions();
// Act
RecalcEngine engine = options.CreateRecalcEngine();
// Assert
Assert.NotNull(engine);
Assert.Equal(10000, engine.Config.MaximumExpressionLength);
Assert.True(engine.Config.MaxCallDepth >= 0);
}
[Fact]
public void OptionsWithBothLimits()
{
// Arrange
const int ExpectedLength = 5000;
const int ExpectedDepth = 12;
DeclarativeWorkflowOptions context = CreateOptions(ExpectedLength, ExpectedDepth);
// Act
RecalcEngine engine = context.CreateRecalcEngine();
// Assert
Assert.Equal(ExpectedLength, engine.Config.MaximumExpressionLength);
Assert.Equal(ExpectedDepth, engine.Config.MaxCallDepth);
}
// Factory for creating options and mock provider
private static DeclarativeWorkflowOptions CreateOptions(
int? maximumExpressionLength = null,
int? maximumCallDepth = null)
{
Mock<WorkflowAgentProvider> providerMock = new(MockBehavior.Strict);
return
new(providerMock.Object)
{
MaximumExpressionLength = maximumExpressionLength,
MaximumCallDepth = maximumCallDepth
};
}
}