44
55using Xunit ;
66using System ;
7+ using System . Diagnostics ;
78using System . Globalization ;
89using System . IO ;
910using System . Text ;
1011using System . Threading . Tasks ;
1112
1213namespace System . IO . Tests
1314{
14- public partial class StringWriterTests
15+ public partial class StringWriterTests : RemoteExecutorTestBase
1516 {
1617 static int [ ] iArrInvalidValues = new int [ ] { - 1 , - 2 , - 100 , - 1000 , - 10000 , - 100000 , - 1000000 , - 10000000 , - 100000000 , - 1000000000 , int . MinValue , short . MinValue } ;
1718 static int [ ] iArrLargeValues = new int [ ] { int . MaxValue , int . MaxValue - 1 , int . MaxValue / 2 , int . MaxValue / 10 , int . MaxValue / 100 } ;
@@ -291,10 +292,9 @@ public static void GetEncoding()
291292 [ Fact ]
292293 public static void TestWriteMisc ( )
293294 {
294- CultureInfo old = CultureInfo . CurrentCulture ;
295- CultureInfo . CurrentCulture = new CultureInfo ( "en-US" ) ; // floating-point formatting comparison depends on culture
296- try
295+ RemoteInvoke ( ( ) =>
297296 {
297+ CultureInfo . CurrentCulture = new CultureInfo ( "en-US" ) ; // floating-point formatting comparison depends on culture
298298 var sw = new StringWriter ( ) ;
299299
300300 sw . Write ( true ) ;
@@ -308,11 +308,7 @@ public static void TestWriteMisc()
308308 sw . Write ( ( ulong ) ulong . MaxValue ) ;
309309
310310 Assert . Equal ( "Truea1234.013452342.0123456-92233720368547758081234.5429496729518446744073709551615" , sw . ToString ( ) ) ;
311- }
312- finally
313- {
314- CultureInfo . CurrentCulture = old ;
315- }
311+ } ) ;
316312 }
317313
318314 [ Fact ]
@@ -326,10 +322,9 @@ public static void TestWriteObject()
326322 [ Fact ]
327323 public static void TestWriteLineMisc ( )
328324 {
329- CultureInfo old = CultureInfo . CurrentCulture ;
330- CultureInfo . CurrentCulture = new CultureInfo ( "en-US" ) ; // floating-point formatting comparison depends on culture
331- try
325+ RemoteInvoke ( ( ) =>
332326 {
327+ CultureInfo . CurrentCulture = new CultureInfo ( "en-US" ) ; // floating-point formatting comparison depends on culture
333328 var sw = new StringWriter ( ) ;
334329 sw . WriteLine ( ( bool ) false ) ;
335330 sw . WriteLine ( ( char ) 'B' ) ;
@@ -342,11 +337,7 @@ public static void TestWriteLineMisc()
342337 Assert . Equal (
343338 string . Format ( "False{0}B{0}987{0}875634{0}1.23457{0}45634563{0}18446744073709551615{0}" , Environment . NewLine ) ,
344339 sw . ToString ( ) ) ;
345- }
346- finally
347- {
348- CultureInfo . CurrentCulture = old ;
349- }
340+ } ) ;
350341 }
351342
352343 [ Fact ]
0 commit comments