@@ -389,4 +389,259 @@ public void Agent_Should_Not_Have_MipOptOut_Property()
389389 }
390390
391391 #endregion
392+
393+ #region Tags Tests
394+
395+ [ Test ]
396+ public void SettingsSchema_Tags_Should_Have_Default_Value_Null ( )
397+ {
398+ // Arrange & Act
399+ var settings = new SettingsSchema ( ) ;
400+
401+ // Assert
402+ using ( new AssertionScope ( ) )
403+ {
404+ settings . Tags . Should ( ) . BeNull ( ) ;
405+ }
406+ }
407+
408+ [ Test ]
409+ public void SettingsSchema_Tags_Should_Be_Settable ( )
410+ {
411+ // Arrange & Act
412+ var settings = new SettingsSchema
413+ {
414+ Tags = new List < string > { "test" , "demo" , "agent" }
415+ } ;
416+
417+ // Assert
418+ using ( new AssertionScope ( ) )
419+ {
420+ settings . Tags . Should ( ) . NotBeNull ( ) ;
421+ settings . Tags . Should ( ) . HaveCount ( 3 ) ;
422+ settings . Tags . Should ( ) . Contain ( "test" ) ;
423+ settings . Tags . Should ( ) . Contain ( "demo" ) ;
424+ settings . Tags . Should ( ) . Contain ( "agent" ) ;
425+ }
426+ }
427+
428+ [ Test ]
429+ public void SettingsSchema_Tags_Should_Serialize_To_Json_Array ( )
430+ {
431+ // Arrange
432+ var settings = new SettingsSchema
433+ {
434+ Tags = new List < string > { "production" , "voice-bot" , "customer-service" }
435+ } ;
436+
437+ // Act
438+ var result = settings . ToString ( ) ;
439+
440+ // Assert
441+ using ( new AssertionScope ( ) )
442+ {
443+ result . Should ( ) . NotBeNull ( ) ;
444+ result . Should ( ) . Contain ( "tags" ) ;
445+ result . Should ( ) . Contain ( "[" ) ;
446+ result . Should ( ) . Contain ( "]" ) ;
447+ result . Should ( ) . Contain ( "production" ) ;
448+ result . Should ( ) . Contain ( "voice-bot" ) ;
449+ result . Should ( ) . Contain ( "customer-service" ) ;
450+
451+ // Verify it's valid JSON by parsing it
452+ var parsed = JsonDocument . Parse ( result ) ;
453+ var tagsArray = parsed . RootElement . GetProperty ( "tags" ) ;
454+ tagsArray . ValueKind . Should ( ) . Be ( JsonValueKind . Array ) ;
455+ tagsArray . GetArrayLength ( ) . Should ( ) . Be ( 3 ) ;
456+
457+ var tagsList = new List < string > ( ) ;
458+ foreach ( var tag in tagsArray . EnumerateArray ( ) )
459+ {
460+ tagsList . Add ( tag . GetString ( ) ! ) ;
461+ }
462+ tagsList . Should ( ) . Contain ( "production" ) ;
463+ tagsList . Should ( ) . Contain ( "voice-bot" ) ;
464+ tagsList . Should ( ) . Contain ( "customer-service" ) ;
465+ }
466+ }
467+
468+ [ Test ]
469+ public void SettingsSchema_Tags_Empty_List_Should_Serialize_As_Empty_Array ( )
470+ {
471+ // Arrange
472+ var settings = new SettingsSchema
473+ {
474+ Tags = new List < string > ( )
475+ } ;
476+
477+ // Act
478+ var result = settings . ToString ( ) ;
479+
480+ // Assert
481+ using ( new AssertionScope ( ) )
482+ {
483+ result . Should ( ) . NotBeNull ( ) ;
484+ result . Should ( ) . Contain ( "tags" ) ;
485+ result . Should ( ) . Contain ( "[]" ) ;
486+
487+ // Verify it's valid JSON by parsing it
488+ var parsed = JsonDocument . Parse ( result ) ;
489+ var tagsArray = parsed . RootElement . GetProperty ( "tags" ) ;
490+ tagsArray . ValueKind . Should ( ) . Be ( JsonValueKind . Array ) ;
491+ tagsArray . GetArrayLength ( ) . Should ( ) . Be ( 0 ) ;
492+ }
493+ }
494+
495+ [ Test ]
496+ public void SettingsSchema_Tags_Null_Should_Not_Serialize ( )
497+ {
498+ // Arrange
499+ var settings = new SettingsSchema
500+ {
501+ Tags = null
502+ } ;
503+
504+ // Act
505+ var result = settings . ToString ( ) ;
506+
507+ // Assert
508+ using ( new AssertionScope ( ) )
509+ {
510+ result . Should ( ) . NotBeNull ( ) ;
511+ result . Should ( ) . NotContain ( "tags" ) ;
512+
513+ // Verify it's valid JSON by parsing it
514+ var parsed = JsonDocument . Parse ( result ) ;
515+ parsed . RootElement . TryGetProperty ( "tags" , out _ ) . Should ( ) . BeFalse ( ) ;
516+ }
517+ }
518+
519+ [ Test ]
520+ public void SettingsSchema_With_Tags_Should_Serialize_With_Other_Properties ( )
521+ {
522+ // Arrange
523+ var settings = new SettingsSchema
524+ {
525+ Experimental = true ,
526+ MipOptOut = true ,
527+ Tags = new List < string > { "test-tag" , "integration" }
528+ } ;
529+
530+ // Act
531+ var result = settings . ToString ( ) ;
532+
533+ // Assert
534+ using ( new AssertionScope ( ) )
535+ {
536+ result . Should ( ) . NotBeNull ( ) ;
537+ result . Should ( ) . Contain ( "experimental" ) ;
538+ result . Should ( ) . Contain ( "mip_opt_out" ) ;
539+ result . Should ( ) . Contain ( "tags" ) ;
540+
541+ // Verify it's valid JSON by parsing it
542+ var parsed = JsonDocument . Parse ( result ) ;
543+ parsed . RootElement . GetProperty ( "experimental" ) . GetBoolean ( ) . Should ( ) . BeTrue ( ) ;
544+ parsed . RootElement . GetProperty ( "mip_opt_out" ) . GetBoolean ( ) . Should ( ) . BeTrue ( ) ;
545+
546+ var tagsArray = parsed . RootElement . GetProperty ( "tags" ) ;
547+ tagsArray . ValueKind . Should ( ) . Be ( JsonValueKind . Array ) ;
548+ tagsArray . GetArrayLength ( ) . Should ( ) . Be ( 2 ) ;
549+ }
550+ }
551+
552+ [ Test ]
553+ public void SettingsSchema_Tags_Should_Support_Special_Characters ( )
554+ {
555+ // Arrange
556+ var settings = new SettingsSchema
557+ {
558+ Tags = new List < string > { "test-with-dashes" , "test_with_underscores" , "test with spaces" , "test.with.dots" }
559+ } ;
560+
561+ // Act
562+ var result = settings . ToString ( ) ;
563+
564+ // Assert
565+ using ( new AssertionScope ( ) )
566+ {
567+ result . Should ( ) . NotBeNull ( ) ;
568+
569+ // Verify it's valid JSON by parsing it
570+ var parsed = JsonDocument . Parse ( result ) ;
571+ var tagsArray = parsed . RootElement . GetProperty ( "tags" ) ;
572+ tagsArray . ValueKind . Should ( ) . Be ( JsonValueKind . Array ) ;
573+ tagsArray . GetArrayLength ( ) . Should ( ) . Be ( 4 ) ;
574+
575+ var tagsList = new List < string > ( ) ;
576+ foreach ( var tag in tagsArray . EnumerateArray ( ) )
577+ {
578+ tagsList . Add ( tag . GetString ( ) ! ) ;
579+ }
580+ tagsList . Should ( ) . Contain ( "test-with-dashes" ) ;
581+ tagsList . Should ( ) . Contain ( "test_with_underscores" ) ;
582+ tagsList . Should ( ) . Contain ( "test with spaces" ) ;
583+ tagsList . Should ( ) . Contain ( "test.with.dots" ) ;
584+ }
585+ }
586+
587+ [ Test ]
588+ public void SettingsSchema_Tags_Schema_Should_Match_API_Specification ( )
589+ {
590+ // Arrange - Test various scenarios as per API specification
591+ var settingsWithTags = new SettingsSchema { Tags = new List < string > { "search-filter" , "analytics" , "production" } } ;
592+ var settingsWithoutTags = new SettingsSchema { Tags = null } ;
593+ var settingsWithEmptyTags = new SettingsSchema { Tags = new List < string > ( ) } ;
594+
595+ // Act
596+ var withTagsResult = settingsWithTags . ToString ( ) ;
597+ var withoutTagsResult = settingsWithoutTags . ToString ( ) ;
598+ var emptyTagsResult = settingsWithEmptyTags . ToString ( ) ;
599+
600+ // Assert
601+ using ( new AssertionScope ( ) )
602+ {
603+ // With tags should serialize array
604+ var withTagsParsed = JsonDocument . Parse ( withTagsResult ) ;
605+ var tagsArray = withTagsParsed . RootElement . GetProperty ( "tags" ) ;
606+ tagsArray . ValueKind . Should ( ) . Be ( JsonValueKind . Array ) ;
607+ tagsArray . GetArrayLength ( ) . Should ( ) . Be ( 3 ) ;
608+
609+ // Without tags should not include tags property
610+ var withoutTagsParsed = JsonDocument . Parse ( withoutTagsResult ) ;
611+ withoutTagsParsed . RootElement . TryGetProperty ( "tags" , out _ ) . Should ( ) . BeFalse ( ) ;
612+
613+ // Empty tags should serialize as empty array
614+ var emptyTagsParsed = JsonDocument . Parse ( emptyTagsResult ) ;
615+ var emptyTagsArray = emptyTagsParsed . RootElement . GetProperty ( "tags" ) ;
616+ emptyTagsArray . ValueKind . Should ( ) . Be ( JsonValueKind . Array ) ;
617+ emptyTagsArray . GetArrayLength ( ) . Should ( ) . Be ( 0 ) ;
618+ }
619+ }
620+
621+ [ Test ]
622+ public void Agent_Should_Not_Have_Tags_Property ( )
623+ {
624+ // Arrange
625+ var agent = new Agent
626+ {
627+ Language = "en" ,
628+ Greeting = "Hello, I'm your agent"
629+ } ;
630+
631+ // Act
632+ var result = agent . ToString ( ) ;
633+
634+ // Assert
635+ using ( new AssertionScope ( ) )
636+ {
637+ result . Should ( ) . NotBeNull ( ) ;
638+ result . Should ( ) . NotContain ( "tags" ) ;
639+
640+ // Verify it's valid JSON by parsing it
641+ var parsed = JsonDocument . Parse ( result ) ;
642+ parsed . RootElement . TryGetProperty ( "tags" , out _ ) . Should ( ) . BeFalse ( ) ;
643+ }
644+ }
645+
646+ #endregion
392647}
0 commit comments