Fixed dotnet tests

This commit is contained in:
Dmytro Struk
2025-09-11 16:55:28 -07:00
Unverified
parent a6322c1116
commit 6a17cb867a
2 changed files with 10 additions and 19 deletions
@@ -16,28 +16,16 @@ internal static class ActivityProcessor
{
await foreach (IActivity activity in activities.ConfigureAwait(false))
{
switch (activity.Type)
if (!string.IsNullOrWhiteSpace(activity.Text))
{
case "message":
// For streaming scenarios, we sometimes receive intermediate text via "typing" activities, but not always.
// In some cases the response is also returned multiple times via "typing" activities, so the only reliable
// way to get the final response is to wait for a "message" activity.
// TODO: Prototype a custom AIContent type for CardActions, where the user is instructed to
// pick from a list of actions.
// The activity text doesn't make sense without the actions, as the message
// is often instructing the user to pick from the provided list of actions.
if ((activity.Type == "message" && !streaming) || (activity.Type == "typing" && streaming))
{
yield return CreateChatMessageFromActivity(activity, [new TextContent(activity.Text)]);
break;
case "typing":
case "event":
// TODO: Revisit usage of TextReasoningContent here, to evaluate whether all are really reasoning
// or whether simply an AIContent base type would be more appropriate.
yield return CreateChatMessageFromActivity(activity, [new TextReasoningContent(activity.Text)]);
break;
default:
}
else
{
logger.LogWarning("Unknown activity type '{ActivityType}' received.", activity.Type);
break;
}
}
}
}
@@ -44,6 +44,7 @@ public abstract class RunTests<TAgentFixture>(Func<TAgentFixture> createAgentFix
// Assert
Assert.NotNull(response);
Assert.Single(response.Messages);
Assert.Contains("Paris", response.Text);
Assert.Equal(agent.Id, response.AgentId);
}
@@ -61,6 +62,7 @@ public abstract class RunTests<TAgentFixture>(Func<TAgentFixture> createAgentFix
// Assert
Assert.NotNull(response);
Assert.Single(response.Messages);
Assert.Contains("Paris", response.Text);
}
@@ -82,6 +84,7 @@ public abstract class RunTests<TAgentFixture>(Func<TAgentFixture> createAgentFix
// Assert
Assert.NotNull(response);
Assert.Single(response.Messages);
Assert.Contains("Paris", response.Text);
}