22 * Copyright (c) Microsoft Corporation. All rights reserved.
33 *--------------------------------------------------------------------------------------------*/
44
5+ using GitHub . Copilot . SDK . Rpc ;
56using GitHub . Copilot . SDK . Test . Harness ;
67using Xunit ;
78using Xunit . Abstractions ;
@@ -104,10 +105,11 @@ public async Task Should_Return_Empty_List_When_No_Custom_Agents_Configured()
104105 [ Fact ]
105106 public async Task Should_Call_Agent_Reload ( )
106107 {
107- var session = await CreateSessionAsync ( new SessionConfig { CustomAgents = [ CreateReloadAgent ( ) ] } ) ;
108+ var reloadAgent = CreateReloadAgent ( $ "reload-test-agent-{ Guid . NewGuid ( ) : N} ") ;
109+ var session = await CreateSessionAsync ( new SessionConfig { CustomAgents = [ reloadAgent ] } ) ;
108110
109111 var before = await session . Rpc . Agent . ListAsync ( ) ;
110- Assert . Single ( before . Agents , agent => string . Equals ( agent . Name , "reload-test-agent" , StringComparison . Ordinal ) ) ;
112+ AssertReloadAgent ( before . Agents , reloadAgent ) ;
111113
112114 var result = await session . Rpc . Agent . ReloadAsync ( ) ;
113115 var current = await session . Rpc . Agent . ListAsync ( ) ;
@@ -120,6 +122,13 @@ public async Task Should_Call_Agent_Reload()
120122 current . Agents . Select ( agent => agent . DisplayName ) . OrderBy ( name => name , StringComparer . Ordinal ) ) ;
121123 }
122124
125+ private static void AssertReloadAgent ( IEnumerable < AgentInfo > agents , CustomAgentConfig expected )
126+ {
127+ var agent = Assert . Single ( agents , agent => string . Equals ( agent . Name , expected . Name , StringComparison . Ordinal ) ) ;
128+ Assert . Equal ( expected . DisplayName , agent . DisplayName ) ;
129+ Assert . Equal ( expected . Description , agent . Description ) ;
130+ }
131+
123132 private static List < CustomAgentConfig > CreateCustomAgents ( ) =>
124133 [
125134 new ( )
@@ -138,10 +147,10 @@ private static List<CustomAgentConfig> CreateCustomAgents() =>
138147 }
139148 ] ;
140149
141- private static CustomAgentConfig CreateReloadAgent ( ) =>
150+ private static CustomAgentConfig CreateReloadAgent ( string name ) =>
142151 new ( )
143152 {
144- Name = "reload-test-agent" ,
153+ Name = name ,
145154 DisplayName = "Reload Test Agent" ,
146155 Description = "Used by the agent reload RPC test." ,
147156 Prompt = "You are a reload test agent." ,
0 commit comments