File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -121,11 +121,17 @@ public void AnonymizeChannelName_WithInvalidChars_SanitizesWhenDisabled()
121121 {
122122 var service = new PrivacyService { IsEnabled = false } ;
123123
124- var result = service . AnonymizeChannelName ( "#test<>|" ) ;
125-
126- result . Should ( ) . NotContain ( "<" ) ;
127- result . Should ( ) . NotContain ( ">" ) ;
128- result . Should ( ) . NotContain ( "|" ) ;
124+ // Use characters that are invalid on all platforms
125+ var channelWithInvalidChars = "#test" + new string ( Path . GetInvalidFileNameChars ( ) . Take ( 3 ) . ToArray ( ) ) ;
126+ var result = service . AnonymizeChannelName ( channelWithInvalidChars ) ;
127+
128+ // Verify invalid chars are replaced with underscores
129+ var invalidChars = Path . GetInvalidFileNameChars ( ) ;
130+ foreach ( var invalidChar in invalidChars . Take ( 3 ) )
131+ {
132+ result . Should ( ) . NotContain ( invalidChar . ToString ( ) ) ;
133+ }
134+ result . Should ( ) . Contain ( "_" ) ; // Should have underscores as replacements
129135 }
130136
131137 [ Fact ]
You can’t perform that action at this time.
0 commit comments