@@ -10,6 +10,7 @@ public class SepWriterColTest
1010 const string ColName = "A" ;
1111 const int ColValue = 123456 ;
1212 const string ColText = "123456" ;
13+ static readonly string ColTextLong = new ( 'a' , 2048 ) ;
1314
1415 static readonly string NL = Environment . NewLine ;
1516
@@ -31,12 +32,24 @@ public void SepWriterColTest_Set_String()
3132 Run ( col => col . Set ( ColText ) ) ;
3233 }
3334
35+ [ TestMethod ]
36+ public void SepWriterColTest_Set_String_Long ( )
37+ {
38+ Run ( col => col . Set ( ColTextLong ) , ColTextLong ) ;
39+ }
40+
3441 [ TestMethod ]
3542 public void SepWriterColTest_Set_Span ( )
3643 {
3744 Run ( col => col . Set ( ColText . AsSpan ( ) ) ) ;
3845 }
3946
47+ [ TestMethod ]
48+ public void SepWriterColTest_Set_Span_Long ( )
49+ {
50+ Run ( col => col . Set ( ColTextLong . AsSpan ( ) ) , ColTextLong ) ;
51+ }
52+
4053 [ TestMethod ]
4154 public void SepWriterColTest_Set_InterpolatedString ( )
4255 {
@@ -61,6 +74,18 @@ public void SepWriterColTest_Set_InterpolatedString_F2_CultureInfoAsParam()
6174 Run ( col => col . Set ( CultureInfo . GetCultureInfo ( "da-DK" ) , $ "{ ColValue : F2} ") , ColText + ",00" ) ;
6275 }
6376
77+ [ TestMethod ]
78+ public void SepWriterColTest_Set_InterpolatedString_F2_CultureInfoAsConfig_Null ( )
79+ {
80+ Run ( col => col . Set ( $ "{ ColValue : F2} ") , ColText + ".00" , null ) ;
81+ }
82+
83+ [ TestMethod ]
84+ public void SepWriterColTest_Set_InterpolatedString_F2_CultureInfoAsParam_Null ( )
85+ {
86+ Run ( col => col . Set ( provider : null , $ "{ ColValue : F2} ") , ColText + ".00" ) ;
87+ }
88+
6489 [ TestMethod ]
6590 public void SepWriterColTest_Set_InterpolatedString_AppendLiteral ( )
6691 {
@@ -111,6 +136,26 @@ public void SepWriterColTest_Format()
111136 Run ( col => col . Format ( ColValue ) ) ;
112137 }
113138
139+ [ TestMethod ]
140+ public void SepWriterColTest_Format_Long ( )
141+ {
142+ var f = new LongSpanFormattable ( ) ;
143+ Run ( col => col . Format ( f ) , f . Text ) ;
144+ }
145+
146+ public class LongSpanFormattable : ISpanFormattable
147+ {
148+ public string Text { get ; } = ColTextLong ;
149+
150+ public string ToString ( string ? format , IFormatProvider ? formatProvider ) => Text ;
151+
152+ public bool TryFormat ( Span < char > destination , out int charsWritten , ReadOnlySpan < char > format , IFormatProvider ? provider )
153+ {
154+ charsWritten = Text . Length ;
155+ return Text . TryCopyTo ( destination ) ;
156+ }
157+ }
158+
114159 // No escaping needed
115160 [ DataRow ( "" , "" ) ]
116161 [ DataRow ( " " , " " ) ]
0 commit comments