diff --git a/dotnet/samples/04-hosting/FoundryResponsesHosting/Program.cs b/dotnet/samples/04-hosting/FoundryResponsesHosting/Program.cs index 59fa723949..55e462e9a7 100644 --- a/dotnet/samples/04-hosting/FoundryResponsesHosting/Program.cs +++ b/dotnet/samples/04-hosting/FoundryResponsesHosting/Program.cs @@ -19,8 +19,8 @@ using System.ComponentModel; using Azure.AI.OpenAI; using Azure.Identity; using Microsoft.Agents.AI; -using Microsoft.Agents.AI.Hosting; using Microsoft.Agents.AI.Foundry.Hosting; +using Microsoft.Agents.AI.Hosting; using Microsoft.Agents.AI.Workflows; using Microsoft.Extensions.AI; using ModelContextProtocol.Client; diff --git a/dotnet/tests/Microsoft.Agents.AI.Foundry.UnitTests/Hosting/AgentFrameworkResponseHandlerTests.cs b/dotnet/tests/Microsoft.Agents.AI.Foundry.UnitTests/Hosting/AgentFrameworkResponseHandlerTests.cs index eac5c60263..78bccc62a8 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Foundry.UnitTests/Hosting/AgentFrameworkResponseHandlerTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Foundry.UnitTests/Hosting/AgentFrameworkResponseHandlerTests.cs @@ -7,9 +7,9 @@ using System.Runtime.CompilerServices; using System.Text.Json; using System.Threading; using System.Threading.Tasks; -using Microsoft.Agents.AI.Foundry.Hosting; using Azure.AI.AgentServer.Responses; using Azure.AI.AgentServer.Responses.Models; +using Microsoft.Agents.AI.Foundry.Hosting; using Microsoft.Extensions.AI; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -22,7 +22,7 @@ namespace Microsoft.Agents.AI.Foundry.UnitTests.Hosting; public class AgentFrameworkResponseHandlerTests { [Fact] - public async Task CreateAsync_WithDefaultAgent_ProducesStreamEvents() + public async Task CreateAsync_WithDefaultAgent_ProducesStreamEventsAsync() { // Arrange var agent = CreateTestAgent("Hello from the agent!"); @@ -60,7 +60,7 @@ public class AgentFrameworkResponseHandlerTests } [Fact] - public async Task CreateAsync_WithKeyedAgent_ResolvesCorrectAgent() + public async Task CreateAsync_WithKeyedAgent_ResolvesCorrectAgentAsync() { // Arrange var agent = CreateTestAgent("Keyed agent response"); @@ -98,7 +98,7 @@ public class AgentFrameworkResponseHandlerTests } [Fact] - public async Task CreateAsync_NoAgentRegistered_ThrowsInvalidOperationException() + public async Task CreateAsync_NoAgentRegistered_ThrowsInvalidOperationExceptionAsync() { // Arrange var services = new ServiceCollection(); @@ -144,7 +144,7 @@ public class AgentFrameworkResponseHandlerTests } [Fact] - public async Task CreateAsync_ResolvesAgentByModelField() + public async Task CreateAsync_ResolvesAgentByModelFieldAsync() { // Arrange var agent = CreateTestAgent("model agent"); @@ -180,7 +180,7 @@ public class AgentFrameworkResponseHandlerTests } [Fact] - public async Task CreateAsync_ResolvesAgentByEntityIdMetadata() + public async Task CreateAsync_ResolvesAgentByEntityIdMetadataAsync() { // Arrange var agent = CreateTestAgent("entity agent"); @@ -219,7 +219,7 @@ public class AgentFrameworkResponseHandlerTests } [Fact] - public async Task CreateAsync_NamedAgentNotFound_FallsBackToDefault() + public async Task CreateAsync_NamedAgentNotFound_FallsBackToDefaultAsync() { // Arrange var agent = CreateTestAgent("default agent"); @@ -257,7 +257,7 @@ public class AgentFrameworkResponseHandlerTests } [Fact] - public async Task CreateAsync_NoAgentFound_ErrorMessageIncludesAgentName() + public async Task CreateAsync_NoAgentFound_ErrorMessageIncludesAgentNameAsync() { // Arrange var services = new ServiceCollection(); @@ -292,7 +292,7 @@ public class AgentFrameworkResponseHandlerTests } [Fact] - public async Task CreateAsync_NoAgentNoName_ErrorMessageIsGeneric() + public async Task CreateAsync_NoAgentNoName_ErrorMessageIsGenericAsync() { // Arrange var services = new ServiceCollection(); @@ -325,7 +325,7 @@ public class AgentFrameworkResponseHandlerTests } [Fact] - public async Task CreateAsync_AgentResolvedBeforeEmitCreated_ExceptionHasNoEvents() + public async Task CreateAsync_AgentResolvedBeforeEmitCreated_ExceptionHasNoEventsAsync() { // Arrange var services = new ServiceCollection(); @@ -367,7 +367,7 @@ public class AgentFrameworkResponseHandlerTests } [Fact] - public async Task CreateAsync_WithHistory_PrependsHistoryToMessages() + public async Task CreateAsync_WithHistory_PrependsHistoryToMessagesAsync() { // Arrange var agent = new CapturingAgent(); @@ -414,7 +414,7 @@ public class AgentFrameworkResponseHandlerTests } [Fact] - public async Task CreateAsync_WithInputItems_UsesResolvedInputItems() + public async Task CreateAsync_WithInputItems_UsesResolvedInputItemsAsync() { // Arrange var agent = new CapturingAgent(); @@ -456,7 +456,7 @@ public class AgentFrameworkResponseHandlerTests } [Fact] - public async Task CreateAsync_NoInputItems_FallsBackToRawRequestInput() + public async Task CreateAsync_NoInputItems_FallsBackToRawRequestInputAsync() { // Arrange var agent = new CapturingAgent(); @@ -494,7 +494,7 @@ public class AgentFrameworkResponseHandlerTests } [Fact] - public async Task CreateAsync_PassesInstructionsToAgent() + public async Task CreateAsync_PassesInstructionsToAgentAsync() { // Arrange var agent = new CapturingAgent(); @@ -533,7 +533,7 @@ public class AgentFrameworkResponseHandlerTests } [Fact] - public async Task CreateAsync_AgentThrows_EmitsFailedEventWithErrorMessage() + public async Task CreateAsync_AgentThrows_EmitsFailedEventWithErrorMessageAsync() { // Arrange var agent = new ThrowingAgent(new InvalidOperationException("Agent crashed")); @@ -571,7 +571,7 @@ public class AgentFrameworkResponseHandlerTests } [Fact] - public async Task CreateAsync_MultipleKeyedAgents_ResolvesCorrectOne() + public async Task CreateAsync_MultipleKeyedAgents_ResolvesCorrectOneAsync() { // Arrange var agent1 = CreateTestAgent("Agent 1 response"); @@ -611,7 +611,7 @@ public class AgentFrameworkResponseHandlerTests } [Fact] - public async Task CreateAsync_CancellationDuringExecution_PropagatesOperationCanceledException() + public async Task CreateAsync_CancellationDuringExecution_PropagatesOperationCanceledExceptionAsync() { // Arrange var agent = new CancellationCheckingAgent(); diff --git a/dotnet/tests/Microsoft.Agents.AI.Foundry.UnitTests/Hosting/InputConverterTests.cs b/dotnet/tests/Microsoft.Agents.AI.Foundry.UnitTests/Hosting/InputConverterTests.cs index 48c1a22ee8..491b1400e5 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Foundry.UnitTests/Hosting/InputConverterTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Foundry.UnitTests/Hosting/InputConverterTests.cs @@ -1,10 +1,10 @@ -// Copyright (c) Microsoft. All rights reserved. +// Copyright (c) Microsoft. All rights reserved. using System; using System.Linq; -using Microsoft.Agents.AI.Foundry.Hosting; using Azure.AI.AgentServer.Responses; using Azure.AI.AgentServer.Responses.Models; +using Microsoft.Agents.AI.Foundry.Hosting; using Microsoft.Extensions.AI; using MeaiTextContent = Microsoft.Extensions.AI.TextContent; diff --git a/dotnet/tests/Microsoft.Agents.AI.Foundry.UnitTests/Hosting/OutputConverterTests.cs b/dotnet/tests/Microsoft.Agents.AI.Foundry.UnitTests/Hosting/OutputConverterTests.cs index 330312d2b4..876339ea2c 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Foundry.UnitTests/Hosting/OutputConverterTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Foundry.UnitTests/Hosting/OutputConverterTests.cs @@ -1,13 +1,13 @@ -// Copyright (c) Microsoft. All rights reserved. +// Copyright (c) Microsoft. All rights reserved. using System; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; -using Microsoft.Agents.AI.Foundry.Hosting; using Azure.AI.AgentServer.Responses; using Azure.AI.AgentServer.Responses.Models; +using Microsoft.Agents.AI.Foundry.Hosting; using Microsoft.Agents.AI.Workflows; using Microsoft.Extensions.AI; using Moq; @@ -26,7 +26,7 @@ public class OutputConverterTests } [Fact] - public async Task ConvertUpdatesToEventsAsync_EmptyStream_EmitsCompleted() + public async Task ConvertUpdatesToEventsAsync_EmptyStream_EmitsCompletedAsync() { var (stream, _) = CreateTestStream(); var updates = ToAsync(Array.Empty()); @@ -42,7 +42,7 @@ public class OutputConverterTests } [Fact] - public async Task ConvertUpdatesToEventsAsync_SingleTextUpdate_EmitsMessageAndCompleted() + public async Task ConvertUpdatesToEventsAsync_SingleTextUpdate_EmitsMessageAndCompletedAsync() { var (stream, _) = CreateTestStream(); var update = new AgentResponseUpdate @@ -64,7 +64,7 @@ public class OutputConverterTests } [Fact] - public async Task ConvertUpdatesToEventsAsync_MultipleTextUpdates_EmitsStreamingDeltas() + public async Task ConvertUpdatesToEventsAsync_MultipleTextUpdates_EmitsStreamingDeltasAsync() { var (stream, _) = CreateTestStream(); var updates = new[] @@ -85,7 +85,7 @@ public class OutputConverterTests } [Fact] - public async Task ConvertUpdatesToEventsAsync_FunctionCall_EmitsFunctionCallEvents() + public async Task ConvertUpdatesToEventsAsync_FunctionCall_EmitsFunctionCallEventsAsync() { var (stream, _) = CreateTestStream(); var update = new AgentResponseUpdate @@ -107,7 +107,7 @@ public class OutputConverterTests } [Fact] - public async Task ConvertUpdatesToEventsAsync_ErrorContent_EmitsFailed() + public async Task ConvertUpdatesToEventsAsync_ErrorContent_EmitsFailedAsync() { var (stream, _) = CreateTestStream(); var update = new AgentResponseUpdate @@ -125,7 +125,7 @@ public class OutputConverterTests } [Fact] - public async Task ConvertUpdatesToEventsAsync_ErrorContent_DoesNotEmitCompleted() + public async Task ConvertUpdatesToEventsAsync_ErrorContent_DoesNotEmitCompletedAsync() { var (stream, _) = CreateTestStream(); var update = new AgentResponseUpdate @@ -143,7 +143,7 @@ public class OutputConverterTests } [Fact] - public async Task ConvertUpdatesToEventsAsync_UsageContent_IncludesUsageInCompleted() + public async Task ConvertUpdatesToEventsAsync_UsageContent_IncludesUsageInCompletedAsync() { var (stream, _) = CreateTestStream(); var updates = new[] @@ -175,7 +175,7 @@ public class OutputConverterTests } [Fact] - public async Task ConvertUpdatesToEventsAsync_ReasoningContent_EmitsReasoningEvents() + public async Task ConvertUpdatesToEventsAsync_ReasoningContent_EmitsReasoningEventsAsync() { var (stream, _) = CreateTestStream(); var update = new AgentResponseUpdate @@ -195,7 +195,7 @@ public class OutputConverterTests } [Fact] - public async Task ConvertUpdatesToEventsAsync_CancellationRequested_Throws() + public async Task ConvertUpdatesToEventsAsync_CancellationRequested_ThrowsAsync() { var (stream, _) = CreateTestStream(); using var cts = new CancellationTokenSource(); @@ -214,7 +214,7 @@ public class OutputConverterTests // F-03 [Fact] - public async Task ConvertUpdatesToEventsAsync_EmptyTextContent_NoTextDeltaEmitted() + public async Task ConvertUpdatesToEventsAsync_EmptyTextContent_NoTextDeltaEmittedAsync() { var (stream, _) = CreateTestStream(); var update = new AgentResponseUpdate { MessageId = "msg_1", Contents = [new MeaiTextContent("")] }; @@ -231,7 +231,7 @@ public class OutputConverterTests // F-04 [Fact] - public async Task ConvertUpdatesToEventsAsync_NullTextContent_NoTextDeltaEmitted() + public async Task ConvertUpdatesToEventsAsync_NullTextContent_NoTextDeltaEmittedAsync() { var (stream, _) = CreateTestStream(); var update = new AgentResponseUpdate { MessageId = "msg_1", Contents = [new MeaiTextContent(null!)] }; @@ -248,7 +248,7 @@ public class OutputConverterTests // F-07 [Fact] - public async Task ConvertUpdatesToEventsAsync_DifferentMessageIds_CreatesMultipleMessages() + public async Task ConvertUpdatesToEventsAsync_DifferentMessageIds_CreatesMultipleMessagesAsync() { var (stream, _) = CreateTestStream(); var updates = new[] @@ -268,7 +268,7 @@ public class OutputConverterTests // F-08 [Fact] - public async Task ConvertUpdatesToEventsAsync_NullMessageIds_TreatedAsSameMessage() + public async Task ConvertUpdatesToEventsAsync_NullMessageIds_TreatedAsSameMessageAsync() { var (stream, _) = CreateTestStream(); var updates = new[] @@ -288,7 +288,7 @@ public class OutputConverterTests // G-02 [Fact] - public async Task ConvertUpdatesToEventsAsync_FunctionCallClosesOpenMessage() + public async Task ConvertUpdatesToEventsAsync_FunctionCallClosesOpenMessageAsync() { var (stream, _) = CreateTestStream(); var updates = new[] @@ -310,7 +310,7 @@ public class OutputConverterTests // G-03 [Fact] - public async Task ConvertUpdatesToEventsAsync_FunctionCallWithNullArguments_EmitsEmptyJson() + public async Task ConvertUpdatesToEventsAsync_FunctionCallWithNullArguments_EmitsEmptyJsonAsync() { var (stream, _) = CreateTestStream(); var update = new AgentResponseUpdate @@ -329,7 +329,7 @@ public class OutputConverterTests // G-04 [Fact] - public async Task ConvertUpdatesToEventsAsync_FunctionCallWithEmptyCallId_GeneratesCallId() + public async Task ConvertUpdatesToEventsAsync_FunctionCallWithEmptyCallId_GeneratesCallIdAsync() { var (stream, _) = CreateTestStream(); var update = new AgentResponseUpdate @@ -348,7 +348,7 @@ public class OutputConverterTests // G-05 [Fact] - public async Task ConvertUpdatesToEventsAsync_MultipleFunctionCalls_EmitsSeparateBuilders() + public async Task ConvertUpdatesToEventsAsync_MultipleFunctionCalls_EmitsSeparateBuildersAsync() { var (stream, _) = CreateTestStream(); var updates = new[] @@ -368,7 +368,7 @@ public class OutputConverterTests // H-02 [Fact] - public async Task ConvertUpdatesToEventsAsync_ReasoningWithNullText_EmitsEmptyString() + public async Task ConvertUpdatesToEventsAsync_ReasoningWithNullText_EmitsEmptyStringAsync() { var (stream, _) = CreateTestStream(); var update = new AgentResponseUpdate { Contents = [new TextReasoningContent(null)] }; @@ -385,7 +385,7 @@ public class OutputConverterTests // H-03 [Fact] - public async Task ConvertUpdatesToEventsAsync_ReasoningClosesOpenMessage() + public async Task ConvertUpdatesToEventsAsync_ReasoningClosesOpenMessageAsync() { var (stream, _) = CreateTestStream(); var updates = new[] @@ -405,7 +405,7 @@ public class OutputConverterTests // I-02 [Fact] - public async Task ConvertUpdatesToEventsAsync_ErrorContentWithNullMessage_UsesDefaultMessage() + public async Task ConvertUpdatesToEventsAsync_ErrorContentWithNullMessage_UsesDefaultMessageAsync() { var (stream, _) = CreateTestStream(); var update = new AgentResponseUpdate { Contents = [new ErrorContent(null!)] }; @@ -421,7 +421,7 @@ public class OutputConverterTests // I-03 [Fact] - public async Task ConvertUpdatesToEventsAsync_ErrorContentClosesOpenMessage() + public async Task ConvertUpdatesToEventsAsync_ErrorContentClosesOpenMessageAsync() { var (stream, _) = CreateTestStream(); var updates = new[] @@ -442,7 +442,7 @@ public class OutputConverterTests // I-06 [Fact] - public async Task ConvertUpdatesToEventsAsync_ErrorAfterPartialText_ClosesMessageThenFails() + public async Task ConvertUpdatesToEventsAsync_ErrorAfterPartialText_ClosesMessageThenFailsAsync() { var (stream, _) = CreateTestStream(); var updates = new[] @@ -464,7 +464,7 @@ public class OutputConverterTests // J-02 [Fact] - public async Task ConvertUpdatesToEventsAsync_MultipleUsageUpdates_AccumulatesTokens() + public async Task ConvertUpdatesToEventsAsync_MultipleUsageUpdates_AccumulatesTokensAsync() { var (stream, _) = CreateTestStream(); var updates = new[] @@ -485,7 +485,7 @@ public class OutputConverterTests // J-03 [Fact] - public async Task ConvertUpdatesToEventsAsync_UsageWithZeroTokens_StillCompletes() + public async Task ConvertUpdatesToEventsAsync_UsageWithZeroTokens_StillCompletesAsync() { var (stream, _) = CreateTestStream(); var update = new AgentResponseUpdate @@ -504,7 +504,7 @@ public class OutputConverterTests // K-01 [Fact] - public async Task ConvertUpdatesToEventsAsync_DataContent_IsSkippedWithNoEvents() + public async Task ConvertUpdatesToEventsAsync_DataContent_IsSkippedWithNoEventsAsync() { var (stream, _) = CreateTestStream(); var update = new AgentResponseUpdate { Contents = [new DataContent("data:image/png;base64,aWNv", "image/png")] }; @@ -521,7 +521,7 @@ public class OutputConverterTests // K-02 [Fact] - public async Task ConvertUpdatesToEventsAsync_UriContent_IsSkippedWithNoEvents() + public async Task ConvertUpdatesToEventsAsync_UriContent_IsSkippedWithNoEventsAsync() { var (stream, _) = CreateTestStream(); var update = new AgentResponseUpdate { Contents = [new UriContent("https://example.com/file.txt", "text/plain")] }; @@ -538,7 +538,7 @@ public class OutputConverterTests // K-03 [Fact] - public async Task ConvertUpdatesToEventsAsync_FunctionResultContent_IsSkippedWithNoEvents() + public async Task ConvertUpdatesToEventsAsync_FunctionResultContent_IsSkippedWithNoEventsAsync() { var (stream, _) = CreateTestStream(); var update = new AgentResponseUpdate { Contents = [new FunctionResultContent("call_1", "result data")] }; @@ -555,7 +555,7 @@ public class OutputConverterTests // L-01 [Fact] - public async Task ConvertUpdatesToEventsAsync_ExecutorInvokedEvent_EmitsWorkflowActionItem() + public async Task ConvertUpdatesToEventsAsync_ExecutorInvokedEvent_EmitsWorkflowActionItemAsync() { var (stream, _) = CreateTestStream(); var update = new AgentResponseUpdate { RawRepresentation = new ExecutorInvokedEvent("executor_1", "invoked") }; @@ -573,7 +573,7 @@ public class OutputConverterTests // L-02 [Fact] - public async Task ConvertUpdatesToEventsAsync_ExecutorCompletedEvent_EmitsCompletedWorkflowAction() + public async Task ConvertUpdatesToEventsAsync_ExecutorCompletedEvent_EmitsCompletedWorkflowActionAsync() { var (stream, _) = CreateTestStream(); var update = new AgentResponseUpdate { RawRepresentation = new ExecutorCompletedEvent("executor_1", null) }; @@ -591,7 +591,7 @@ public class OutputConverterTests // L-03 [Fact] - public async Task ConvertUpdatesToEventsAsync_ExecutorFailedEvent_EmitsFailedWorkflowAction() + public async Task ConvertUpdatesToEventsAsync_ExecutorFailedEvent_EmitsFailedWorkflowActionAsync() { var (stream, _) = CreateTestStream(); var update = new AgentResponseUpdate { RawRepresentation = new ExecutorFailedEvent("executor_1", new InvalidOperationException("test error")) }; @@ -609,7 +609,7 @@ public class OutputConverterTests // L-04 [Fact] - public async Task ConvertUpdatesToEventsAsync_WorkflowEventClosesOpenMessage() + public async Task ConvertUpdatesToEventsAsync_WorkflowEventClosesOpenMessageAsync() { var (stream, _) = CreateTestStream(); var updates = new[] @@ -629,7 +629,7 @@ public class OutputConverterTests // L-06 [Fact] - public async Task ConvertUpdatesToEventsAsync_InterleavedWorkflowAndTextEvents() + public async Task ConvertUpdatesToEventsAsync_InterleavedWorkflowAndTextEventsAsync() { var (stream, _) = CreateTestStream(); var updates = new[] @@ -651,7 +651,7 @@ public class OutputConverterTests // M-01 [Fact] - public async Task ConvertUpdatesToEventsAsync_TextThenFunctionCallThenText_ProducesCorrectSequence() + public async Task ConvertUpdatesToEventsAsync_TextThenFunctionCallThenText_ProducesCorrectSequenceAsync() { var (stream, _) = CreateTestStream(); var updates = new[] @@ -672,7 +672,7 @@ public class OutputConverterTests // M-02 [Fact] - public async Task ConvertUpdatesToEventsAsync_ReasoningThenText_ProducesCorrectSequence() + public async Task ConvertUpdatesToEventsAsync_ReasoningThenText_ProducesCorrectSequenceAsync() { var (stream, _) = CreateTestStream(); var updates = new[] @@ -692,7 +692,7 @@ public class OutputConverterTests // M-03 [Fact] - public async Task ConvertUpdatesToEventsAsync_TextThenError_EmitsMessageThenFailed() + public async Task ConvertUpdatesToEventsAsync_TextThenError_EmitsMessageThenFailedAsync() { var (stream, _) = CreateTestStream(); var updates = new[] @@ -714,7 +714,7 @@ public class OutputConverterTests // M-04 [Fact] - public async Task ConvertUpdatesToEventsAsync_FunctionCallThenTextThenFunctionCall_ProducesThreeItems() + public async Task ConvertUpdatesToEventsAsync_FunctionCallThenTextThenFunctionCall_ProducesThreeItemsAsync() { var (stream, _) = CreateTestStream(); var updates = new[] @@ -739,7 +739,7 @@ public class OutputConverterTests // W-01: Multi-executor text output — different MessageIds cause separate messages [Fact] - public async Task ConvertUpdatesToEventsAsync_MultiExecutorTextOutput_CreatesSeparateMessages() + public async Task ConvertUpdatesToEventsAsync_MultiExecutorTextOutput_CreatesSeparateMessagesAsync() { var (stream, _) = CreateTestStream(); var updates = new[] @@ -773,7 +773,7 @@ public class OutputConverterTests // W-02: Workflow error via ErrorContent (as produced by WorkflowSession for WorkflowErrorEvent) [Fact] - public async Task ConvertUpdatesToEventsAsync_WorkflowErrorAsContent_EmitsFailed() + public async Task ConvertUpdatesToEventsAsync_WorkflowErrorAsContent_EmitsFailedAsync() { var (stream, _) = CreateTestStream(); var updates = new[] @@ -798,7 +798,7 @@ public class OutputConverterTests // W-03: Function call from workflow executor (e.g. handoff agent calling transfer_to_agent) [Fact] - public async Task ConvertUpdatesToEventsAsync_WorkflowFunctionCall_EmitsFunctionCallEvents() + public async Task ConvertUpdatesToEventsAsync_WorkflowFunctionCall_EmitsFunctionCallEventsAsync() { var (stream, _) = CreateTestStream(); var updates = new[] @@ -831,7 +831,7 @@ public class OutputConverterTests // W-04: Informational events (superstep, workflow started) are silently skipped [Fact] - public async Task ConvertUpdatesToEventsAsync_InformationalWorkflowEvents_AreSkipped() + public async Task ConvertUpdatesToEventsAsync_InformationalWorkflowEvents_AreSkippedAsync() { var (stream, _) = CreateTestStream(); var updates = new[] @@ -856,7 +856,7 @@ public class OutputConverterTests // W-05: Warning events are silently skipped [Fact] - public async Task ConvertUpdatesToEventsAsync_WorkflowWarningEvent_IsSkipped() + public async Task ConvertUpdatesToEventsAsync_WorkflowWarningEvent_IsSkippedAsync() { var (stream, _) = CreateTestStream(); var updates = new[] @@ -877,7 +877,7 @@ public class OutputConverterTests // W-06: Streaming text from multiple workflow turns (same executor, different message IDs) [Fact] - public async Task ConvertUpdatesToEventsAsync_MultiTurnSameExecutor_CreatesSeparateMessages() + public async Task ConvertUpdatesToEventsAsync_MultiTurnSameExecutor_CreatesSeparateMessagesAsync() { var (stream, _) = CreateTestStream(); var updates = new[] @@ -904,7 +904,7 @@ public class OutputConverterTests // W-07: Executor failure mid-stream with partial text [Fact] - public async Task ConvertUpdatesToEventsAsync_ExecutorFailureAfterPartialText_ClosesMessageAndEmitsFailure() + public async Task ConvertUpdatesToEventsAsync_ExecutorFailureAfterPartialText_ClosesMessageAndEmitsFailureAsync() { var (stream, _) = CreateTestStream(); var updates = new[] @@ -929,7 +929,7 @@ public class OutputConverterTests // W-08: Full handoff pattern — triage → function call → target agent text [Fact] - public async Task ConvertUpdatesToEventsAsync_FullHandoffPattern_ProducesCorrectEventSequence() + public async Task ConvertUpdatesToEventsAsync_FullHandoffPattern_ProducesCorrectEventSequenceAsync() { var (stream, _) = CreateTestStream(); var updates = new[] @@ -973,7 +973,7 @@ public class OutputConverterTests // W-09: SubworkflowErrorEvent treated as informational (error content comes separately) [Fact] - public async Task ConvertUpdatesToEventsAsync_SubworkflowErrorEvent_IsSkipped() + public async Task ConvertUpdatesToEventsAsync_SubworkflowErrorEvent_IsSkippedAsync() { var (stream, _) = CreateTestStream(); var updates = new[] @@ -995,7 +995,7 @@ public class OutputConverterTests // W-10: Mixed content types from workflow — reasoning + text [Fact] - public async Task ConvertUpdatesToEventsAsync_WorkflowReasoningThenText_ProducesCorrectSequence() + public async Task ConvertUpdatesToEventsAsync_WorkflowReasoningThenText_ProducesCorrectSequenceAsync() { var (stream, _) = CreateTestStream(); var updates = new[] @@ -1021,7 +1021,7 @@ public class OutputConverterTests // W-11: Usage content accumulated across workflow executors [Fact] - public async Task ConvertUpdatesToEventsAsync_WorkflowUsageAcrossExecutors_AccumulatesCorrectly() + public async Task ConvertUpdatesToEventsAsync_WorkflowUsageAcrossExecutors_AccumulatesCorrectlyAsync() { var (stream, _) = CreateTestStream(); var updates = new[] @@ -1048,7 +1048,7 @@ public class OutputConverterTests // W-12: Empty workflow — only lifecycle events, no content [Fact] - public async Task ConvertUpdatesToEventsAsync_EmptyWorkflowOnlyLifecycle_EmitsOnlyCompleted() + public async Task ConvertUpdatesToEventsAsync_EmptyWorkflowOnlyLifecycle_EmitsOnlyCompletedAsync() { var (stream, _) = CreateTestStream(); var updates = new[] diff --git a/dotnet/tests/Microsoft.Agents.AI.Foundry.UnitTests/Hosting/ServiceCollectionExtensionsTests.cs b/dotnet/tests/Microsoft.Agents.AI.Foundry.UnitTests/Hosting/ServiceCollectionExtensionsTests.cs index d3fffaed5a..1833ea9198 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Foundry.UnitTests/Hosting/ServiceCollectionExtensionsTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Foundry.UnitTests/Hosting/ServiceCollectionExtensionsTests.cs @@ -1,9 +1,9 @@ -// Copyright (c) Microsoft. All rights reserved. +// Copyright (c) Microsoft. All rights reserved. using System; using System.Linq; -using Microsoft.Agents.AI.Foundry.Hosting; using Azure.AI.AgentServer.Responses; +using Microsoft.Agents.AI.Foundry.Hosting; using Microsoft.Extensions.DependencyInjection; using Moq; diff --git a/dotnet/tests/Microsoft.Agents.AI.Foundry.UnitTests/Hosting/WorkflowIntegrationTests.cs b/dotnet/tests/Microsoft.Agents.AI.Foundry.UnitTests/Hosting/WorkflowIntegrationTests.cs index be78f8046d..ad6722a549 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Foundry.UnitTests/Hosting/WorkflowIntegrationTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Foundry.UnitTests/Hosting/WorkflowIntegrationTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All rights reserved. +// Copyright (c) Microsoft. All rights reserved. using System; using System.Collections.Generic; @@ -31,7 +31,7 @@ public class WorkflowIntegrationTests // ===== Sequential Workflow Tests ===== [Fact] - public async Task SequentialWorkflow_SingleAgent_ProducesTextOutput() + public async Task SequentialWorkflow_SingleAgent_ProducesTextOutputAsync() { // Arrange: single-agent sequential workflow var echoAgent = new StreamingTextAgent("echo", "Hello from the workflow!"); @@ -59,7 +59,7 @@ public class WorkflowIntegrationTests } [Fact] - public async Task SequentialWorkflow_TwoAgents_ProducesOutputFromBoth() + public async Task SequentialWorkflow_TwoAgents_ProducesOutputFromBothAsync() { // Arrange: two agents in sequence var agent1 = new StreamingTextAgent("agent1", "First agent says hello"); @@ -90,7 +90,7 @@ public class WorkflowIntegrationTests // ===== Workflow Error Propagation ===== [Fact] - public async Task Workflow_AgentThrowsException_ProducesErrorOutput() + public async Task Workflow_AgentThrowsException_ProducesErrorOutputAsync() { // Arrange: workflow with an agent that throws var throwingAgent = new ThrowingStreamingAgent("thrower", new InvalidOperationException("Agent crashed")); @@ -120,7 +120,7 @@ public class WorkflowIntegrationTests // ===== Workflow Action Lifecycle Events ===== [Fact] - public async Task Workflow_ExecutorEvents_ProduceWorkflowActionItems() + public async Task Workflow_ExecutorEvents_ProduceWorkflowActionItemsAsync() { // Arrange var agent = new StreamingTextAgent("test-agent", "Result"); @@ -144,7 +144,7 @@ public class WorkflowIntegrationTests // ===== Keyed Workflow Registration ===== [Fact] - public async Task WorkflowAgent_RegisteredWithKey_ResolvesCorrectly() + public async Task WorkflowAgent_RegisteredWithKey_ResolvesCorrectlyAsync() { // Arrange: workflow agent registered with a keyed service name var agent = new StreamingTextAgent("inner", "Keyed workflow response"); @@ -177,7 +177,7 @@ public class WorkflowIntegrationTests // These test the OutputConverter directly with update patterns that mirror real workflows. [Fact] - public async Task OutputConverter_SequentialWorkflowPattern_ProducesCorrectEvents() + public async Task OutputConverter_SequentialWorkflowPattern_ProducesCorrectEventsAsync() { // Simulate what WorkflowSession produces for a 2-agent sequential workflow var (stream, _) = CreateTestStream(); @@ -210,7 +210,7 @@ public class WorkflowIntegrationTests } [Fact] - public async Task OutputConverter_GroupChatPattern_ProducesCorrectEvents() + public async Task OutputConverter_GroupChatPattern_ProducesCorrectEventsAsync() { // Simulate round-robin group chat: agent1 → agent2 → agent1 → terminate var (stream, _) = CreateTestStream(); @@ -246,7 +246,7 @@ public class WorkflowIntegrationTests } [Fact] - public async Task OutputConverter_CodeExecutorPattern_ProducesCorrectEvents() + public async Task OutputConverter_CodeExecutorPattern_ProducesCorrectEventsAsync() { // Simulate a code-based FunctionExecutor: invoked → completed, no text content // (code executors don't produce AgentResponseUpdateEvent, just executor lifecycle) @@ -278,7 +278,7 @@ public class WorkflowIntegrationTests } [Fact] - public async Task OutputConverter_SubworkflowPattern_ProducesCorrectEvents() + public async Task OutputConverter_SubworkflowPattern_ProducesCorrectEventsAsync() { // Simulate a parent workflow that invokes a sub-workflow executor var (stream, _) = CreateTestStream(); @@ -308,7 +308,7 @@ public class WorkflowIntegrationTests } [Fact] - public async Task OutputConverter_WorkflowWithMultipleContentTypes_HandlesAllCorrectly() + public async Task OutputConverter_WorkflowWithMultipleContentTypes_HandlesAllCorrectlyAsync() { // Simulate a workflow producing reasoning, text, function calls, and usage var (stream, _) = CreateTestStream();