@@ -198,4 +198,165 @@ public void InjectUserMessageSchema_ToString_Should_Return_Valid_Json()
198198 parsed . RootElement . GetProperty ( "content" ) . GetString ( ) . Should ( ) . Be ( "Hello! Can you hear me?" ) ;
199199 }
200200 }
201+
202+ #region MipOptOut Tests
203+
204+ [ Test ]
205+ public void Agent_MipOptOut_Should_Have_Default_Value_False ( )
206+ {
207+ // Arrange & Act
208+ var agent = new Agent ( ) ;
209+
210+ // Assert
211+ using ( new AssertionScope ( ) )
212+ {
213+ agent . MipOptOut . Should ( ) . BeFalse ( ) ;
214+ }
215+ }
216+
217+ [ Test ]
218+ public void Agent_MipOptOut_Should_Be_Settable ( )
219+ {
220+ // Arrange & Act
221+ var agent = new Agent
222+ {
223+ MipOptOut = true
224+ } ;
225+
226+ // Assert
227+ using ( new AssertionScope ( ) )
228+ {
229+ agent . MipOptOut . Should ( ) . BeTrue ( ) ;
230+ }
231+ }
232+
233+ [ Test ]
234+ public void Agent_MipOptOut_Should_Serialize_To_Snake_Case ( )
235+ {
236+ // Arrange
237+ var agent = new Agent
238+ {
239+ MipOptOut = true
240+ } ;
241+
242+ // Act
243+ var result = agent . ToString ( ) ;
244+
245+ // Assert
246+ using ( new AssertionScope ( ) )
247+ {
248+ result . Should ( ) . NotBeNull ( ) ;
249+ result . Should ( ) . Contain ( "mip_opt_out" ) ;
250+ result . Should ( ) . Contain ( "true" ) ;
251+
252+ // Verify it's valid JSON by parsing it
253+ var parsed = JsonDocument . Parse ( result ) ;
254+ parsed . RootElement . GetProperty ( "mip_opt_out" ) . GetBoolean ( ) . Should ( ) . BeTrue ( ) ;
255+ }
256+ }
257+
258+ [ Test ]
259+ public void Agent_MipOptOut_False_Should_Serialize_Correctly ( )
260+ {
261+ // Arrange
262+ var agent = new Agent
263+ {
264+ MipOptOut = false
265+ } ;
266+
267+ // Act
268+ var result = agent . ToString ( ) ;
269+
270+ // Assert
271+ using ( new AssertionScope ( ) )
272+ {
273+ result . Should ( ) . NotBeNull ( ) ;
274+ result . Should ( ) . Contain ( "mip_opt_out" ) ;
275+ result . Should ( ) . Contain ( "false" ) ;
276+
277+ // Verify it's valid JSON by parsing it
278+ var parsed = JsonDocument . Parse ( result ) ;
279+ parsed . RootElement . GetProperty ( "mip_opt_out" ) . GetBoolean ( ) . Should ( ) . BeFalse ( ) ;
280+ }
281+ }
282+
283+ [ Test ]
284+ public void Agent_MipOptOut_Null_Should_Not_Serialize ( )
285+ {
286+ // Arrange
287+ var agent = new Agent
288+ {
289+ MipOptOut = null
290+ } ;
291+
292+ // Act
293+ var result = agent . ToString ( ) ;
294+
295+ // Assert
296+ using ( new AssertionScope ( ) )
297+ {
298+ result . Should ( ) . NotBeNull ( ) ;
299+ result . Should ( ) . NotContain ( "mip_opt_out" ) ;
300+
301+ // Verify it's valid JSON by parsing it
302+ var parsed = JsonDocument . Parse ( result ) ;
303+ parsed . RootElement . TryGetProperty ( "mip_opt_out" , out _ ) . Should ( ) . BeFalse ( ) ;
304+ }
305+ }
306+
307+ [ Test ]
308+ public void Agent_With_MipOptOut_Should_Serialize_With_Other_Properties ( )
309+ {
310+ // Arrange
311+ var agent = new Agent
312+ {
313+ Language = "en" ,
314+ Greeting = "Hello, I'm your agent" ,
315+ MipOptOut = true
316+ } ;
317+
318+ // Act
319+ var result = agent . ToString ( ) ;
320+
321+ // Assert
322+ using ( new AssertionScope ( ) )
323+ {
324+ result . Should ( ) . NotBeNull ( ) ;
325+ result . Should ( ) . Contain ( "language" ) ;
326+ result . Should ( ) . Contain ( "greeting" ) ;
327+ result . Should ( ) . Contain ( "mip_opt_out" ) ;
328+
329+ // Verify it's valid JSON by parsing it
330+ var parsed = JsonDocument . Parse ( result ) ;
331+ parsed . RootElement . GetProperty ( "language" ) . GetString ( ) . Should ( ) . Be ( "en" ) ;
332+ parsed . RootElement . GetProperty ( "greeting" ) . GetString ( ) . Should ( ) . Be ( "Hello, I'm your agent" ) ;
333+ parsed . RootElement . GetProperty ( "mip_opt_out" ) . GetBoolean ( ) . Should ( ) . BeTrue ( ) ;
334+ }
335+ }
336+
337+ [ Test ]
338+ public void Agent_MipOptOut_Schema_Should_Match_API_Specification ( )
339+ {
340+ // Arrange - Test both default (false) and explicit true values
341+ var agentDefault = new Agent ( ) ;
342+ var agentOptOut = new Agent { MipOptOut = true } ;
343+
344+ // Act
345+ var defaultResult = agentDefault . ToString ( ) ;
346+ var optOutResult = agentOptOut . ToString ( ) ;
347+
348+ // Assert
349+ using ( new AssertionScope ( ) )
350+ {
351+ // Default should be false
352+ var defaultParsed = JsonDocument . Parse ( defaultResult ) ;
353+ defaultParsed . RootElement . GetProperty ( "mip_opt_out" ) . GetBoolean ( ) . Should ( ) . BeFalse ( ) ;
354+
355+ // Explicit true should be true
356+ var optOutParsed = JsonDocument . Parse ( optOutResult ) ;
357+ optOutParsed . RootElement . GetProperty ( "mip_opt_out" ) . GetBoolean ( ) . Should ( ) . BeTrue ( ) ;
358+ }
359+ }
360+
361+ #endregion
201362}
0 commit comments