@@ -113,7 +113,7 @@ public async Task WriteOpenApiFloatAsJsonWorksAsync(float input, bool produceTer
113
113
var json = await WriteAsJsonAsync ( floatValue , produceTerseOutput ) ;
114
114
115
115
// Assert
116
- Assert . Equal ( input . ToString ( ) , json ) ;
116
+ Assert . Equal ( input . ToString ( CultureInfo . InvariantCulture ) , json ) ;
117
117
}
118
118
119
119
public static IEnumerable < object [ ] > DoubleInputs
@@ -141,15 +141,15 @@ public async Task WriteOpenApiDoubleAsJsonWorksAsync(double input, bool produceT
141
141
var json = await WriteAsJsonAsync ( doubleValue , produceTerseOutput ) ;
142
142
143
143
// Assert
144
- Assert . Equal ( input . ToString ( ) , json ) ;
144
+ Assert . Equal ( input . ToString ( CultureInfo . InvariantCulture ) , json ) ;
145
145
}
146
146
147
147
public static IEnumerable < object [ ] > StringifiedDateTimes
148
148
{
149
149
get
150
150
{
151
151
return
152
- from input in new [ ] {
152
+ from input in new [ ] {
153
153
"2017-1-2" ,
154
154
"1999-01-02T12:10:22" ,
155
155
"1999-01-03" ,
@@ -178,7 +178,7 @@ public async Task WriteOpenApiDateTimeAsJsonWorksAsync(string inputString, bool
178
178
public static IEnumerable < object [ ] > BooleanInputs
179
179
{
180
180
get =>
181
- from input in new [ ] { true , false }
181
+ from input in new [ ] { true , false }
182
182
from shouldBeTerse in shouldProduceTerseOutputValues
183
183
select new object [ ] { input , shouldBeTerse } ;
184
184
}
@@ -258,7 +258,7 @@ private static async Task<string> WriteAsJsonAsync(JsonNode any, bool produceTer
258
258
// Arrange (continued)
259
259
using var stream = new MemoryStream ( ) ;
260
260
var writer = new OpenApiJsonWriter (
261
- new StreamWriter ( stream ) ,
261
+ new CultureInvariantStreamWriter ( stream ) ,
262
262
new ( ) { Terse = produceTerseOutput } ) ;
263
263
264
264
writer . WriteAny ( any ) ;
@@ -279,5 +279,15 @@ private static async Task<string> WriteAsJsonAsync(JsonNode any, bool produceTer
279
279
_ => value . MakeLineBreaksEnvironmentNeutral ( ) ,
280
280
} ;
281
281
}
282
+
283
+ private class CultureInvariantStreamWriter : StreamWriter
284
+ {
285
+ public CultureInvariantStreamWriter ( Stream stream ) : base ( stream )
286
+ {
287
+ }
288
+
289
+ public override IFormatProvider FormatProvider => CultureInfo . InvariantCulture ;
290
+ }
291
+
282
292
}
283
293
}
0 commit comments