-
Notifications
You must be signed in to change notification settings - Fork 1.1k
.NET Workflows - Add unit tests for DefaultActionExecutor (Declarative Workflows) #3836
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+50
−0
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
87c80fe
Initial plan
Copilot f0722f3
Add comprehensive unit tests for DefaultActionExecutor with 100% code…
Copilot 203c791
Address code review feedback: Add explicit Xunit using and improve va…
Copilot 7f01c85
Merge branch 'main' into copilot/add-default-action-executor-tests
crickman 1f58b03
Streamlined tests
crickman 4e5f1df
Merge branch 'main' into copilot/add-default-action-executor-tests
crickman 412e532
Update dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTes…
crickman 35c8916
Restore all 4 test cases and remove redundant event assertions
Copilot c0dfca1
Merge branch 'main' into copilot/add-default-action-executor-tests
crickman 9067559
Remove redudant tests
crickman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
...rosoft.Agents.AI.Workflows.Declarative.UnitTests/ObjectModel/DefaultActionExecutorTest.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| // 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="DefaultActionExecutor"/>. | ||
| /// </summary> | ||
| public sealed class DefaultActionExecutorTest(ITestOutputHelper output) : WorkflowActionExecutorTest(output) | ||
| { | ||
| [Fact] | ||
| public async Task ExecuteDefaultActionAsync() | ||
| { | ||
| // Arrange, Act & Assert | ||
| await this.ExecuteTestAsync( | ||
| this.FormatDisplayName(nameof(ExecuteDefaultActionAsync))); | ||
| } | ||
|
|
||
| private async Task ExecuteTestAsync(string displayName) | ||
| { | ||
| // Arrange | ||
| ResetVariable model = this.CreateModel(displayName); | ||
|
|
||
| // Act | ||
| DefaultActionExecutor action = new(model, this.State); | ||
| WorkflowEvent[] events = await this.ExecuteAsync(action); | ||
|
|
||
| // Assert | ||
| VerifyModel(model, action); | ||
| Assert.NotEmpty(events); | ||
| } | ||
|
|
||
| private ResetVariable CreateModel(string displayName) | ||
| { | ||
| // Use a simple concrete action type since DialogAction.Builder is abstract | ||
| ResetVariable.Builder actionBuilder = | ||
| new() | ||
| { | ||
| Id = this.CreateActionId(), | ||
| DisplayName = this.FormatDisplayName(displayName), | ||
| Variable = PropertyPath.Create(FormatVariablePath("TestVariable")), | ||
| }; | ||
|
|
||
| return AssignParent<ResetVariable>(actionBuilder); | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.