@@ -127,5 +127,44 @@ public async Task ScheduleNewOrchestrationInstanceAsync_ValidDedupeStatus_DoesNo
127127 var exception = await act . Should ( ) . ThrowAsync < Exception > ( ) ;
128128 exception . Which . Should ( ) . NotBeOfType < ArgumentException > ( ) ;
129129 }
130+
131+ [ Fact ]
132+ public async Task PurgeAllInstancesAsync_NegativeTimeout_ThrowsArgumentOutOfRangeException ( )
133+ {
134+ // Arrange
135+ var client = this . CreateClient ( ) ;
136+ var filter = new PurgeInstancesFilter { Timeout = TimeSpan . FromSeconds ( - 1 ) } ;
137+
138+ // Act & Assert
139+ Func < Task > act = async ( ) => await client . PurgeAllInstancesAsync ( filter ) ;
140+ var exception = await act . Should ( ) . ThrowAsync < ArgumentOutOfRangeException > ( ) ;
141+ exception . Which . Message . Should ( ) . Contain ( "Timeout must be a positive TimeSpan." ) ;
142+ }
143+
144+ [ Fact ]
145+ public async Task PurgeAllInstancesAsync_ZeroTimeout_ThrowsArgumentOutOfRangeException ( )
146+ {
147+ // Arrange
148+ var client = this . CreateClient ( ) ;
149+ var filter = new PurgeInstancesFilter { Timeout = TimeSpan . Zero } ;
150+
151+ // Act & Assert
152+ Func < Task > act = async ( ) => await client . PurgeAllInstancesAsync ( filter ) ;
153+ var exception = await act . Should ( ) . ThrowAsync < ArgumentOutOfRangeException > ( ) ;
154+ exception . Which . Message . Should ( ) . Contain ( "Timeout must be a positive TimeSpan." ) ;
155+ }
156+
157+ [ Fact ]
158+ public async Task PurgeAllInstancesAsync_PositiveTimeout_DoesNotThrowValidationError ( )
159+ {
160+ // Arrange
161+ var client = this . CreateClient ( ) ;
162+ var filter = new PurgeInstancesFilter { Timeout = TimeSpan . FromSeconds ( 30 ) } ;
163+
164+ // Act & Assert - validation should pass; the call will fail at gRPC level, not validation
165+ Func < Task > act = async ( ) => await client . PurgeAllInstancesAsync ( filter ) ;
166+ var exception = await act . Should ( ) . ThrowAsync < Exception > ( ) ;
167+ exception . Which . Should ( ) . NotBeOfType < ArgumentOutOfRangeException > ( ) ;
168+ }
130169}
131170
0 commit comments