@@ -191,7 +191,7 @@ public void SelfDiagnosticsEventListener_EncodeInBuffer_EnoughSpace()
191191
192192 // '\n' will be appended to the original string "abc" after EncodeInBuffer is called.
193193 // The byte where '\n' will be placed should not be touched within EncodeInBuffer, so it stays as '\0'.
194- byte [ ] expected = Encoding . UTF8 . GetBytes ( "abc\0 " ) ;
194+ byte [ ] expected = "abc\0 "u8 . ToArray ( ) ;
195195 AssertBufferOutput ( expected , buffer , startPos , endPos + 1 ) ;
196196 }
197197
@@ -204,7 +204,7 @@ public void SelfDiagnosticsEventListener_EncodeInBuffer_NotEnoughSpaceForFullStr
204204 // It's a quick estimate by assumption that most Unicode characters takes up to 2 16-bit UTF-16 chars,
205205 // which can be up to 4 bytes when encoded in UTF-8.
206206 int endPos = SelfDiagnosticsEventListener . EncodeInBuffer ( "abc" , false , buffer , startPos ) ;
207- byte [ ] expected = Encoding . UTF8 . GetBytes ( "ab...\0 " ) ;
207+ byte [ ] expected = "ab...\0 "u8 . ToArray ( ) ;
208208 AssertBufferOutput ( expected , buffer , startPos , endPos + 1 ) ;
209209 }
210210
@@ -214,7 +214,7 @@ public void SelfDiagnosticsEventListener_EncodeInBuffer_NotEvenSpaceForTruncated
214214 byte [ ] buffer = new byte [ 20 ] ;
215215 int startPos = buffer . Length - Ellipses . Length ; // Just enough space for "...\n".
216216 int endPos = SelfDiagnosticsEventListener . EncodeInBuffer ( "abc" , false , buffer , startPos ) ;
217- byte [ ] expected = Encoding . UTF8 . GetBytes ( "...\0 " ) ;
217+ byte [ ] expected = "...\0 "u8 . ToArray ( ) ;
218218 AssertBufferOutput ( expected , buffer , startPos , endPos + 1 ) ;
219219 }
220220
@@ -233,7 +233,7 @@ public void SelfDiagnosticsEventListener_EncodeInBuffer_IsParameter_EnoughSpace(
233233 byte [ ] buffer = new byte [ 20 ] ;
234234 int startPos = buffer . Length - EllipsesWithBrackets . Length - 6 ; // Just enough space for "abc" even if "...\n" need to be added.
235235 int endPos = SelfDiagnosticsEventListener . EncodeInBuffer ( "abc" , true , buffer , startPos ) ;
236- byte [ ] expected = Encoding . UTF8 . GetBytes ( "{abc}\0 " ) ;
236+ byte [ ] expected = "{abc}\0 "u8 . ToArray ( ) ;
237237 AssertBufferOutput ( expected , buffer , startPos , endPos + 1 ) ;
238238 }
239239
@@ -243,7 +243,7 @@ public void SelfDiagnosticsEventListener_EncodeInBuffer_IsParameter_NotEnoughSpa
243243 byte [ ] buffer = new byte [ 20 ] ;
244244 int startPos = buffer . Length - EllipsesWithBrackets . Length - 5 ; // Just not space for "...\n".
245245 int endPos = SelfDiagnosticsEventListener . EncodeInBuffer ( "abc" , true , buffer , startPos ) ;
246- byte [ ] expected = Encoding . UTF8 . GetBytes ( "{ab...}\0 " ) ;
246+ byte [ ] expected = "{ab...}\0 "u8 . ToArray ( ) ;
247247 AssertBufferOutput ( expected , buffer , startPos , endPos + 1 ) ;
248248 }
249249
@@ -253,7 +253,7 @@ public void SelfDiagnosticsEventListener_EncodeInBuffer_IsParameter_NotEvenSpace
253253 byte [ ] buffer = new byte [ 20 ] ;
254254 int startPos = buffer . Length - EllipsesWithBrackets . Length ; // Just enough space for "{...}\n".
255255 int endPos = SelfDiagnosticsEventListener . EncodeInBuffer ( "abc" , true , buffer , startPos ) ;
256- byte [ ] expected = Encoding . UTF8 . GetBytes ( "{...}\0 " ) ;
256+ byte [ ] expected = "{...}\0 "u8 . ToArray ( ) ;
257257 AssertBufferOutput ( expected , buffer , startPos , endPos + 1 ) ;
258258 }
259259
0 commit comments