@@ -261,6 +261,60 @@ public void CreateOptionsWithNullAgentNameTest()
261261 Assert . Equal ( "UnnamedAgent" , options . EndUserId ) ; // Null name should fallback to "UnnamedAgent"
262262 }
263263
264+ /// <summary>
265+ /// Verify response options creation with kernel plugin and default response options.
266+ /// </summary>
267+ [ Fact ]
268+ public void CreateOptionsWithKernelPluginAndDefaultOptionsTest ( )
269+ {
270+ // Arrange
271+ var mockAgent = CreateMockAgent ( "Test Agent" , "You are a helpful assistant." , storeEnabled : false ) ;
272+ var mockThread = CreateMockAgentThread ( null ) ;
273+ mockAgent . Kernel . Plugins . AddFromObject ( new TestPlugin ( ) ) ;
274+
275+ // Act
276+ var options = ResponseCreationOptionsFactory . CreateOptions ( mockAgent , mockThread . Object , null ) ;
277+
278+ // Assert
279+ Assert . NotNull ( options ) ;
280+ Assert . Single ( options . Tools ) ;
281+ Assert . NotNull ( options . ToolChoice ) ;
282+ Assert . Equal ( ResponseToolChoiceKind . Auto , options . ToolChoice . Kind ) ;
283+ Assert . Null ( options . ParallelToolCallsEnabled ) ;
284+ }
285+
286+ /// <summary>
287+ /// Verify response options creation with kernel plugin and custom response options.
288+ /// </summary>
289+ [ Fact ]
290+ public void CreateOptionsWithKernelPluginAndCustomOptionsTest ( )
291+ {
292+ // Arrange
293+ var mockAgent = CreateMockAgent ( "Test Agent" , "You are a helpful assistant." , storeEnabled : false ) ;
294+ var mockThread = CreateMockAgentThread ( null ) ;
295+ mockAgent . Kernel . Plugins . AddFromObject ( new TestPlugin ( ) ) ;
296+
297+ // Custom invoke options should be respected
298+ var invokeOptions = new OpenAIResponseAgentInvokeOptions
299+ {
300+ ResponseCreationOptions = new ResponseCreationOptions
301+ {
302+ ToolChoice = ResponseToolChoice . CreateNoneChoice ( ) ,
303+ ParallelToolCallsEnabled = false
304+ }
305+ } ;
306+
307+ // Act
308+ var options = ResponseCreationOptionsFactory . CreateOptions ( mockAgent , mockThread . Object , invokeOptions ) ;
309+
310+ // Assert
311+ Assert . NotNull ( options ) ;
312+ Assert . Single ( options . Tools ) ;
313+ Assert . NotNull ( options . ToolChoice ) ;
314+ Assert . Equal ( ResponseToolChoiceKind . None , options . ToolChoice . Kind ) ;
315+ Assert . False ( options . ParallelToolCallsEnabled ) ;
316+ }
317+
264318 private static OpenAIResponseAgent CreateMockAgent ( string ? name , string ? instructions , bool storeEnabled )
265319 {
266320 var mockClient = new Mock < OpenAIResponseClient > ( ) ;
@@ -281,4 +335,11 @@ private static Mock<AgentThread> CreateMockAgentThread(string? threadId)
281335 mockThread . Setup ( t => t . Id ) . Returns ( threadId ) ;
282336 return mockThread ;
283337 }
338+
339+ private sealed class TestPlugin
340+ {
341+ [ KernelFunction ]
342+ public void TestFunction ( )
343+ { }
344+ }
284345}
0 commit comments