Skip to content
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

#2708 add Add a judgment to the graph constructor #2709

Merged
merged 8 commits into from
Jun 25, 2024
4 changes: 2 additions & 2 deletions dotnet/AutoGen.sln
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.8.34322.80
Expand Down Expand Up @@ -206,4 +206,4 @@ Global
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {93384647-528D-46C8-922C-8DB36A382F0B}
EndGlobalSection
EndGlobal
EndGlobal
11 changes: 9 additions & 2 deletions dotnet/src/AutoGen.Core/GroupChat/Graph.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,16 @@ public class Graph
{
private readonly List<Transition> transitions = new List<Transition>();

public Graph(IEnumerable<Transition> transitions)
public Graph()
{
this.transitions.AddRange(transitions);
}

public Graph(IEnumerable<Transition>? transitions)
JeffreySu marked this conversation as resolved.
Show resolved Hide resolved
{
if (transitions != null)
{
this.transitions.AddRange(transitions);
}
}

public void AddTransition(Transition transition)
Expand Down
18 changes: 18 additions & 0 deletions dotnet/test/AutoGen.Tests/GroupChat/GraphTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

using Xunit;

namespace AutoGen.Tests
{
public class GraphTests
{
[Fact]
public void GraphTest()
{
var graph1 = new Graph();
Assert.NotNull(graph1);

var graph2 = new Graph(null);
Assert.NotNull(graph2);
}
}
}
Loading