diff --git a/dotnet/AutoGen.sln b/dotnet/AutoGen.sln index 5ecfe193887..cd1d683406c 100644 --- a/dotnet/AutoGen.sln +++ b/dotnet/AutoGen.sln @@ -1,4 +1,4 @@ - + Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.8.34322.80 @@ -206,4 +206,4 @@ Global GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {93384647-528D-46C8-922C-8DB36A382F0B} EndGlobalSection -EndGlobal +EndGlobal \ No newline at end of file diff --git a/dotnet/src/AutoGen.Core/GroupChat/Graph.cs b/dotnet/src/AutoGen.Core/GroupChat/Graph.cs index 02f4da50bae..d6b71e2a3f1 100644 --- a/dotnet/src/AutoGen.Core/GroupChat/Graph.cs +++ b/dotnet/src/AutoGen.Core/GroupChat/Graph.cs @@ -12,9 +12,16 @@ public class Graph { private readonly List transitions = new List(); - public Graph(IEnumerable transitions) + public Graph() { - this.transitions.AddRange(transitions); + } + + public Graph(IEnumerable? transitions) + { + if (transitions != null) + { + this.transitions.AddRange(transitions); + } } public void AddTransition(Transition transition) diff --git a/dotnet/test/AutoGen.Tests/GroupChat/GraphTests.cs b/dotnet/test/AutoGen.Tests/GroupChat/GraphTests.cs new file mode 100644 index 00000000000..77e2c99dcd1 --- /dev/null +++ b/dotnet/test/AutoGen.Tests/GroupChat/GraphTests.cs @@ -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); + } + } +}