@@ -6,8 +6,10 @@ namespace StyleCop.Analyzers.Test.LightJson
66 using System ;
77 using global ::LightJson ;
88 using global ::LightJson . Serialization ;
9+ using StyleCop . Analyzers . Test . Helpers ;
910 using Xunit ;
1011
12+ [ UseCulture ( "en-US" ) ]
1113 public class JsonValueTests
1214 {
1315 [ Fact ]
@@ -106,18 +108,35 @@ public void TestAsNumber()
106108 Assert . Equal ( 0.0 , new JsonValue ( new JsonArray ( ) ) . AsNumber ) ;
107109 }
108110
111+ [ Fact ]
112+ [ WorkItem ( 2440 , "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/2440" ) ]
113+ [ UseCulture ( "sv-SE" ) ]
114+ public void TestAsNumbersUsingCultureWithNonStandardNumberFormat ( )
115+ {
116+ Assert . Equal ( 1.0 , new JsonValue ( "1.0" ) . AsNumber ) ;
117+ }
118+
109119 [ Fact ]
110120 public void TestAsString ( )
111121 {
112122 Assert . Equal ( "false" , new JsonValue ( false ) . AsString ) ;
113123 Assert . Equal ( "true" , new JsonValue ( true ) . AsString ) ;
124+ Assert . Equal ( "0.5" , new JsonValue ( 0.5 ) . AsString ) ;
114125 Assert . Equal ( "1" , new JsonValue ( 1.0 ) . AsString ) ;
115126 Assert . Equal ( "text" , new JsonValue ( "text" ) . AsString ) ;
116127 Assert . Null ( new JsonValue ( new JsonObject ( ) ) . AsString ) ;
117128 Assert . Null ( new JsonValue ( default ( JsonObject ) ) . AsString ) ;
118129 Assert . Null ( new JsonValue ( new JsonArray ( ) ) . AsString ) ;
119130 }
120131
132+ [ Fact ]
133+ [ WorkItem ( 2440 , "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/2440" ) ]
134+ [ UseCulture ( "sv-SE" ) ]
135+ public void TestAsStringUsingCultureWithNonStandardNumberFormat ( )
136+ {
137+ Assert . Equal ( "0.5" , new JsonValue ( 0.5 ) . AsString ) ;
138+ }
139+
121140 [ Fact ]
122141 public void TestAsJsonObject ( )
123142 {
0 commit comments