File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed
dotnet/tests/Microsoft.Agents.AI.Abstractions.UnitTests Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,22 @@ public void InvokingContext_Constructor_ThrowsForNullMessages()
3434 Assert . Throws < ArgumentNullException > ( ( ) => new AIContextProvider . InvokingContext ( null ! ) ) ;
3535 }
3636
37+ [ Fact ]
38+ public void InvokingContext_Constructor_DoesNotThrowForEmptyMessages ( )
39+ {
40+ var context = new AIContextProvider . InvokingContext ( [ ] ) ;
41+ Assert . Empty ( context . RequestMessages ) ;
42+ }
43+
44+ [ Fact ]
45+ public void InvokingContext_Constructor_DoesNotThrowForSingleMessages ( )
46+ {
47+ var expected = new ChatMessage ( ChatRole . User , "Message content" ) ;
48+ var context = new AIContextProvider . InvokingContext ( [ expected ] ) ;
49+ var actual = Assert . Single ( context . RequestMessages ) ;
50+ Assert . Equal ( expected , actual ) ;
51+ }
52+
3753 [ Fact ]
3854 public void InvokedContext_Constructor_ThrowsForNullMessages ( )
3955 {
Original file line number Diff line number Diff line change @@ -39,6 +39,28 @@ public void CloningConstructorCopiesProperties()
3939 Assert . Equal ( 42 , clone . AdditionalProperties [ "key2" ] ) ;
4040 }
4141
42+ [ Fact ]
43+ public void CloningConstructorWithNullProperties ( )
44+ {
45+ // Arrange
46+ var options = new AgentRunOptions
47+ {
48+ ContinuationToken = new object ( ) ,
49+ AllowBackgroundResponses = true ,
50+ AdditionalProperties = null ,
51+ } ;
52+
53+ // Act
54+ var clone = new AgentRunOptions ( options ) ;
55+
56+ // Assert
57+ Assert . NotNull ( clone ) ;
58+ Assert . Same ( options . ContinuationToken , clone . ContinuationToken ) ;
59+ Assert . Equal ( options . AllowBackgroundResponses , clone . AllowBackgroundResponses ) ;
60+ Assert . Null ( clone . AdditionalProperties ) ;
61+ Assert . Null ( options . AdditionalProperties ) ;
62+ }
63+
4264 [ Fact ]
4365 public void CloningConstructorThrowsIfNull ( ) =>
4466 // Act & Assert
You can’t perform that action at this time.
0 commit comments