@@ -2147,9 +2147,22 @@ This is technically the third part.
2147
2147
Assert . That ( body . Headers [ HeaderId . ContentType ] , Is . EqualTo ( "text/plain; charset=utf-8" ) ) ;
2148
2148
Assert . That ( body . ContentType . Charset , Is . EqualTo ( "utf-8" ) ) ;
2149
2149
Assert . That ( body . Text , Is . EqualTo ( "This is technically the third part." + Environment . NewLine ) ) ;
2150
+
2151
+ #if false // TODO: Bring MimeParser up to par with ExperimentalMimeParser
2152
+ using ( var memory = new MemoryStream ( ) ) {
2153
+ var options = FormatOptions . Default . Clone ( ) ;
2154
+ options . NewLineFormat = NewLineFormat . Unix ;
2155
+
2156
+ message . WriteTo ( options , memory ) ;
2157
+
2158
+ var output = Encoding . ASCII . GetString ( memory . GetBuffer ( ) , 0 , ( int ) memory . Length ) ;
2159
+ Assert . That ( output , Is . EqualTo ( text ) ) ;
2160
+ }
2161
+ #endif
2150
2162
}
2151
2163
2152
- using ( var stream = new MemoryStream ( Encoding . ASCII . GetBytes ( text . Replace ( "\n " , "\r \n " ) ) , false ) ) {
2164
+ text = text . Replace ( "\n " , "\r \n " ) ;
2165
+ using ( var stream = new MemoryStream ( Encoding . ASCII . GetBytes ( text ) , false ) ) {
2153
2166
var parser = new MimeParser ( stream , MimeFormat . Entity ) ;
2154
2167
var message = parser . ParseMessage ( ) ;
2155
2168
@@ -2169,6 +2182,18 @@ This is technically the third part.
2169
2182
Assert . That ( body . Headers [ HeaderId . ContentType ] , Is . EqualTo ( "text/plain; charset=utf-8" ) ) ;
2170
2183
Assert . That ( body . ContentType . Charset , Is . EqualTo ( "utf-8" ) ) ;
2171
2184
Assert . That ( body . Text , Is . EqualTo ( "This is technically the third part." + Environment . NewLine ) ) ;
2185
+
2186
+ #if false // TODO: Bring MimeParser up to par with ExperimentalMimeParser
2187
+ using ( var memory = new MemoryStream ( ) ) {
2188
+ var options = FormatOptions . Default . Clone ( ) ;
2189
+ options . NewLineFormat = NewLineFormat . Dos ;
2190
+
2191
+ message . WriteTo ( options , memory ) ;
2192
+
2193
+ var output = Encoding . ASCII . GetString ( memory . GetBuffer ( ) , 0 , ( int ) memory . Length ) ;
2194
+ Assert . That ( output , Is . EqualTo ( text ) ) ;
2195
+ }
2196
+ #endif
2172
2197
}
2173
2198
}
2174
2199
@@ -2220,9 +2245,22 @@ This is technically the third part.
2220
2245
Assert . That ( body . Headers [ HeaderId . ContentType ] , Is . EqualTo ( "text/plain; charset=utf-8" ) ) ;
2221
2246
Assert . That ( body . ContentType . Charset , Is . EqualTo ( "utf-8" ) ) ;
2222
2247
Assert . That ( body . Text , Is . EqualTo ( "This is technically the third part." + Environment . NewLine ) ) ;
2248
+
2249
+ #if false // TODO: Bring MimeParser up to par with ExperimentalMimeParser
2250
+ using ( var memory = new MemoryStream ( ) ) {
2251
+ var options = FormatOptions . Default . Clone ( ) ;
2252
+ options . NewLineFormat = NewLineFormat . Unix ;
2253
+
2254
+ await message . WriteToAsync ( options , memory ) ;
2255
+
2256
+ var output = Encoding . ASCII . GetString ( memory . GetBuffer ( ) , 0 , ( int ) memory . Length ) ;
2257
+ Assert . That ( output , Is . EqualTo ( text ) ) ;
2258
+ }
2259
+ #endif
2223
2260
}
2224
2261
2225
- using ( var stream = new MemoryStream ( Encoding . ASCII . GetBytes ( text . Replace ( "\n " , "\r \n " ) ) , false ) ) {
2262
+ text . Replace ( "\n " , "\r \n " ) ;
2263
+ using ( var stream = new MemoryStream ( Encoding . ASCII . GetBytes ( text ) , false ) ) {
2226
2264
var parser = new MimeParser ( stream , MimeFormat . Entity ) ;
2227
2265
var message = await parser . ParseMessageAsync ( ) ;
2228
2266
@@ -2242,6 +2280,18 @@ This is technically the third part.
2242
2280
Assert . That ( body . Headers [ HeaderId . ContentType ] , Is . EqualTo ( "text/plain; charset=utf-8" ) ) ;
2243
2281
Assert . That ( body . ContentType . Charset , Is . EqualTo ( "utf-8" ) ) ;
2244
2282
Assert . That ( body . Text , Is . EqualTo ( "This is technically the third part." + Environment . NewLine ) ) ;
2283
+
2284
+ #if false // TODO: Bring MimeParser up to par with ExperimentalMimeParser
2285
+ using ( var memory = new MemoryStream ( ) ) {
2286
+ var options = FormatOptions . Default . Clone ( ) ;
2287
+ options . NewLineFormat = NewLineFormat . Dos ;
2288
+
2289
+ await message . WriteToAsync ( options , memory ) ;
2290
+
2291
+ var output = Encoding . ASCII . GetString ( memory . GetBuffer ( ) , 0 , ( int ) memory . Length ) ;
2292
+ Assert . That ( output , Is . EqualTo ( text ) ) ;
2293
+ }
2294
+ #endif
2245
2295
}
2246
2296
}
2247
2297
0 commit comments