-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
251 changed files
with
4,980 additions
and
1,863 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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,51 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// AgentBaseTests.cs | ||
|
||
using FluentAssertions; | ||
using Google.Protobuf.Reflection; | ||
using Microsoft.AutoGen.Abstractions; | ||
using Moq; | ||
using Xunit; | ||
|
||
namespace Microsoft.AutoGen.Agents.Tests; | ||
|
||
public class AgentBaseTests | ||
{ | ||
[Fact] | ||
public async Task ItInvokeRightHandlerTestAsync() | ||
{ | ||
var mockContext = new Mock<IAgentContext>(); | ||
var agent = new TestAgent(mockContext.Object, new EventTypes(TypeRegistry.Empty, [], [])); | ||
|
||
await agent.HandleObject("hello world"); | ||
await agent.HandleObject(42); | ||
|
||
agent.ReceivedItems.Should().HaveCount(2); | ||
agent.ReceivedItems[0].Should().Be("hello world"); | ||
agent.ReceivedItems[1].Should().Be(42); | ||
} | ||
|
||
/// <summary> | ||
/// The test agent is a simple agent that is used for testing purposes. | ||
/// </summary> | ||
public class TestAgent : AgentBase, IHandle<string>, IHandle<int> | ||
{ | ||
public TestAgent(IAgentContext context, EventTypes eventTypes) : base(context, eventTypes) | ||
{ | ||
} | ||
|
||
public Task Handle(string item) | ||
{ | ||
ReceivedItems.Add(item); | ||
return Task.CompletedTask; | ||
} | ||
|
||
public Task Handle(int item) | ||
{ | ||
ReceivedItems.Add(item); | ||
return Task.CompletedTask; | ||
} | ||
|
||
public List<object> ReceivedItems { get; private set; } = []; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
dotnet/Microsoft.AutoGen.Agents.Tests/Microsoft.AutoGen.Agents.Tests.csproj
This file contains 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,14 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>$(TestTargetFrameworks)</TargetFrameworks> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<IsTestProject>True</IsTestProject> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\src\Microsoft.AutoGen\Agents\Microsoft.AutoGen.Agents.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains 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
1 change: 1 addition & 0 deletions
1
dotnet/samples/AutoGen.BasicSamples/CodeSnippet/AgentCodeSnippet.cs
This file contains 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
1 change: 1 addition & 0 deletions
1
dotnet/samples/AutoGen.BasicSamples/CodeSnippet/UserProxyAgentCodeSnippet.cs
This file contains 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
Oops, something went wrong.