11// Licensed to the .NET Foundation under one or more agreements.
2- // The .NET Foundation licenses this file to you under the MIT license.
2+ // The .NET Foundation licenses this file to you under the MIT license.utf8Bytes, utf8Bytes.Length
33
44using System . Collections . Generic ;
55using System . Text ;
@@ -24,62 +24,63 @@ public static IEnumerable<object[]> ValidBase64Strings_WithCharsThatMustBeIgnore
2424 // One will have 1 char, another will have 3
2525
2626 // Line feed
27- yield return new object [ ] { GetBase64StringWithPassedCharInsertedInTheMiddle ( Convert . ToChar ( 9 ) , 1 ) , utf8Bytes } ;
28- yield return new object [ ] { GetBase64StringWithPassedCharInsertedInTheMiddle ( Convert . ToChar ( 9 ) , 3 ) , utf8Bytes } ;
27+ yield return new object [ ] { GetBase64StringWithPassedCharInsertedInTheMiddle ( Convert . ToChar ( 9 ) , 1 ) , utf8Bytes , utf8Bytes . Length + 4 } ;
28+ yield return new object [ ] { GetBase64StringWithPassedCharInsertedInTheMiddle ( Convert . ToChar ( 9 ) , 3 ) , utf8Bytes , utf8Bytes . Length + 6 } ;
2929
3030 // Horizontal tab
31- yield return new object [ ] { GetBase64StringWithPassedCharInsertedInTheMiddle ( Convert . ToChar ( 10 ) , 1 ) , utf8Bytes } ;
32- yield return new object [ ] { GetBase64StringWithPassedCharInsertedInTheMiddle ( Convert . ToChar ( 10 ) , 3 ) , utf8Bytes } ;
31+ yield return new object [ ] { GetBase64StringWithPassedCharInsertedInTheMiddle ( Convert . ToChar ( 10 ) , 1 ) , utf8Bytes , utf8Bytes . Length + 4 } ;
32+ yield return new object [ ] { GetBase64StringWithPassedCharInsertedInTheMiddle ( Convert . ToChar ( 10 ) , 3 ) , utf8Bytes , utf8Bytes . Length + 6 } ;
3333
3434 // Carriage return
35- yield return new object [ ] { GetBase64StringWithPassedCharInsertedInTheMiddle ( Convert . ToChar ( 13 ) , 1 ) , utf8Bytes } ;
36- yield return new object [ ] { GetBase64StringWithPassedCharInsertedInTheMiddle ( Convert . ToChar ( 13 ) , 3 ) , utf8Bytes } ;
35+ yield return new object [ ] { GetBase64StringWithPassedCharInsertedInTheMiddle ( Convert . ToChar ( 13 ) , 1 ) , utf8Bytes , utf8Bytes . Length + 4 } ;
36+ yield return new object [ ] { GetBase64StringWithPassedCharInsertedInTheMiddle ( Convert . ToChar ( 13 ) , 3 ) , utf8Bytes , utf8Bytes . Length + 6 } ;
3737
3838 // Space
39- yield return new object [ ] { GetBase64StringWithPassedCharInsertedInTheMiddle ( Convert . ToChar ( 32 ) , 1 ) , utf8Bytes } ;
40- yield return new object [ ] { GetBase64StringWithPassedCharInsertedInTheMiddle ( Convert . ToChar ( 32 ) , 3 ) , utf8Bytes } ;
39+ yield return new object [ ] { GetBase64StringWithPassedCharInsertedInTheMiddle ( Convert . ToChar ( 32 ) , 1 ) , utf8Bytes , utf8Bytes . Length + 4 } ;
40+ yield return new object [ ] { GetBase64StringWithPassedCharInsertedInTheMiddle ( Convert . ToChar ( 32 ) , 3 ) , utf8Bytes , utf8Bytes . Length + 6 } ;
4141
4242 string GetBase64StringWithPassedCharInsertedInTheMiddle ( char charToInsert , int numberOfTimesToInsert ) => $ "{ firstSegment } { new string ( charToInsert , numberOfTimesToInsert ) } { secondSegment } ";
4343
4444 // Insert ignored chars at the start of the base 64 string
4545 // One will have 1 char, another will have 3
4646
4747 // Line feed
48- yield return new object [ ] { GetBase64StringWithPassedCharInsertedAtTheStart ( Convert . ToChar ( 9 ) , 1 ) , utf8Bytes } ;
49- yield return new object [ ] { GetBase64StringWithPassedCharInsertedAtTheStart ( Convert . ToChar ( 9 ) , 3 ) , utf8Bytes } ;
48+ yield return new object [ ] { GetBase64StringWithPassedCharInsertedAtTheStart ( Convert . ToChar ( 9 ) , 1 ) , utf8Bytes , utf8Bytes . Length + 4 } ;
49+ yield return new object [ ] { GetBase64StringWithPassedCharInsertedAtTheStart ( Convert . ToChar ( 9 ) , 3 ) , utf8Bytes , utf8Bytes . Length + 6 } ;
5050
5151 // Horizontal tab
52- yield return new object [ ] { GetBase64StringWithPassedCharInsertedAtTheStart ( Convert . ToChar ( 10 ) , 1 ) , utf8Bytes } ;
53- yield return new object [ ] { GetBase64StringWithPassedCharInsertedAtTheStart ( Convert . ToChar ( 10 ) , 3 ) , utf8Bytes } ;
52+ yield return new object [ ] { GetBase64StringWithPassedCharInsertedAtTheStart ( Convert . ToChar ( 10 ) , 1 ) , utf8Bytes , utf8Bytes . Length + 4 } ;
53+ yield return new object [ ] { GetBase64StringWithPassedCharInsertedAtTheStart ( Convert . ToChar ( 10 ) , 3 ) , utf8Bytes , utf8Bytes . Length + 6 } ;
5454
5555 // Carriage return
56- yield return new object [ ] { GetBase64StringWithPassedCharInsertedAtTheStart ( Convert . ToChar ( 13 ) , 1 ) , utf8Bytes } ;
57- yield return new object [ ] { GetBase64StringWithPassedCharInsertedAtTheStart ( Convert . ToChar ( 13 ) , 3 ) , utf8Bytes } ;
56+ yield return new object [ ] { GetBase64StringWithPassedCharInsertedAtTheStart ( Convert . ToChar ( 13 ) , 1 ) , utf8Bytes , utf8Bytes . Length + 4 } ;
57+ yield return new object [ ] { GetBase64StringWithPassedCharInsertedAtTheStart ( Convert . ToChar ( 13 ) , 3 ) , utf8Bytes , utf8Bytes . Length + 6 } ;
5858
5959 // Space
60- yield return new object [ ] { GetBase64StringWithPassedCharInsertedAtTheStart ( Convert . ToChar ( 32 ) , 1 ) , utf8Bytes } ;
61- yield return new object [ ] { GetBase64StringWithPassedCharInsertedAtTheStart ( Convert . ToChar ( 32 ) , 3 ) , utf8Bytes } ;
60+ yield return new object [ ] { GetBase64StringWithPassedCharInsertedAtTheStart ( Convert . ToChar ( 32 ) , 1 ) , utf8Bytes , utf8Bytes . Length + 4 } ;
61+ yield return new object [ ] { GetBase64StringWithPassedCharInsertedAtTheStart ( Convert . ToChar ( 32 ) , 3 ) , utf8Bytes , utf8Bytes . Length + 6 } ;
6262
6363 string GetBase64StringWithPassedCharInsertedAtTheStart ( char charToInsert , int numberOfTimesToInsert ) => $ "{ new string ( charToInsert , numberOfTimesToInsert ) } { firstSegment } { secondSegment } ";
6464
6565 // Insert ignored chars at the end of the base 64 string
6666 // One will have 1 char, another will have 3
67+ // Whitespace after end/padding is not included in consumed bytes
6768
6869 // Line feed
69- yield return new object [ ] { GetBase64StringWithPassedCharInsertedAtTheEnd ( Convert . ToChar ( 9 ) , 1 ) , utf8Bytes } ;
70- yield return new object [ ] { GetBase64StringWithPassedCharInsertedAtTheEnd ( Convert . ToChar ( 9 ) , 3 ) , utf8Bytes } ;
70+ yield return new object [ ] { GetBase64StringWithPassedCharInsertedAtTheEnd ( Convert . ToChar ( 9 ) , 1 ) , utf8Bytes , utf8Bytes . Length + 3 } ;
71+ yield return new object [ ] { GetBase64StringWithPassedCharInsertedAtTheEnd ( Convert . ToChar ( 9 ) , 3 ) , utf8Bytes , utf8Bytes . Length + 3 } ;
7172
7273 // Horizontal tab
73- yield return new object [ ] { GetBase64StringWithPassedCharInsertedAtTheEnd ( Convert . ToChar ( 10 ) , 1 ) , utf8Bytes } ;
74- yield return new object [ ] { GetBase64StringWithPassedCharInsertedAtTheEnd ( Convert . ToChar ( 10 ) , 3 ) , utf8Bytes } ;
74+ yield return new object [ ] { GetBase64StringWithPassedCharInsertedAtTheEnd ( Convert . ToChar ( 10 ) , 1 ) , utf8Bytes , utf8Bytes . Length + 3 } ;
75+ yield return new object [ ] { GetBase64StringWithPassedCharInsertedAtTheEnd ( Convert . ToChar ( 10 ) , 3 ) , utf8Bytes , utf8Bytes . Length + 3 } ;
7576
7677 // Carriage return
77- yield return new object [ ] { GetBase64StringWithPassedCharInsertedAtTheEnd ( Convert . ToChar ( 13 ) , 1 ) , utf8Bytes } ;
78- yield return new object [ ] { GetBase64StringWithPassedCharInsertedAtTheEnd ( Convert . ToChar ( 13 ) , 3 ) , utf8Bytes } ;
78+ yield return new object [ ] { GetBase64StringWithPassedCharInsertedAtTheEnd ( Convert . ToChar ( 13 ) , 1 ) , utf8Bytes , utf8Bytes . Length + 3 } ;
79+ yield return new object [ ] { GetBase64StringWithPassedCharInsertedAtTheEnd ( Convert . ToChar ( 13 ) , 3 ) , utf8Bytes , utf8Bytes . Length + 3 } ;
7980
8081 // Space
81- yield return new object [ ] { GetBase64StringWithPassedCharInsertedAtTheEnd ( Convert . ToChar ( 32 ) , 1 ) , utf8Bytes } ;
82- yield return new object [ ] { GetBase64StringWithPassedCharInsertedAtTheEnd ( Convert . ToChar ( 32 ) , 3 ) , utf8Bytes } ;
82+ yield return new object [ ] { GetBase64StringWithPassedCharInsertedAtTheEnd ( Convert . ToChar ( 32 ) , 1 ) , utf8Bytes , utf8Bytes . Length + 3 } ;
83+ yield return new object [ ] { GetBase64StringWithPassedCharInsertedAtTheEnd ( Convert . ToChar ( 32 ) , 3 ) , utf8Bytes , utf8Bytes . Length + 3 } ;
8384
8485 string GetBase64StringWithPassedCharInsertedAtTheEnd ( char charToInsert , int numberOfTimesToInsert ) => $ "{ firstSegment } { secondSegment } { new string ( charToInsert , numberOfTimesToInsert ) } ";
8586 }
0 commit comments