-Fixed NZ culture tests on Windows 10
This commit is contained in:
@@ -130,7 +130,11 @@ namespace Newtonsoft.Json.Tests.Converters
|
||||
[Test]
|
||||
public void SerializeFormattedDateTimeNewZealandCulture()
|
||||
{
|
||||
IsoDateTimeConverter converter = new IsoDateTimeConverter() { DateTimeFormat = "F", Culture = CultureInfo.GetCultureInfo("en-NZ") };
|
||||
CultureInfo culture = new CultureInfo("en-NZ");
|
||||
culture.DateTimeFormat.AMDesignator = "a.m.";
|
||||
culture.DateTimeFormat.PMDesignator = "p.m.";
|
||||
|
||||
IsoDateTimeConverter converter = new IsoDateTimeConverter() { DateTimeFormat = "F", Culture = culture };
|
||||
|
||||
DateTime d = new DateTime(2000, 12, 15, 22, 11, 3, 0, DateTimeKind.Utc);
|
||||
string result;
|
||||
|
||||
@@ -1237,11 +1237,15 @@ _____'propertyName': NaN,
|
||||
[Test]
|
||||
public void Culture()
|
||||
{
|
||||
CultureInfo culture = new CultureInfo("en-NZ");
|
||||
culture.DateTimeFormat.AMDesignator = "a.m.";
|
||||
culture.DateTimeFormat.PMDesignator = "p.m.";
|
||||
|
||||
StringWriter sw = new StringWriter();
|
||||
JsonTextWriter writer = new JsonTextWriter(sw);
|
||||
writer.Formatting = Formatting.Indented;
|
||||
writer.DateFormatString = "yyyy tt";
|
||||
writer.Culture = new CultureInfo("en-NZ");
|
||||
writer.Culture = culture;
|
||||
writer.QuoteChar = '\'';
|
||||
|
||||
writer.WriteStartArray();
|
||||
|
||||
@@ -8060,6 +8060,10 @@ Path '', line 1, position 1.");
|
||||
[Test]
|
||||
public void DateFormatString()
|
||||
{
|
||||
CultureInfo culture = new CultureInfo("en-NZ");
|
||||
culture.DateTimeFormat.AMDesignator = "a.m.";
|
||||
culture.DateTimeFormat.PMDesignator = "p.m.";
|
||||
|
||||
IList<object> dates = new List<object>
|
||||
{
|
||||
new DateTime(2000, 12, 12, 12, 12, 12, DateTimeKind.Utc),
|
||||
@@ -8069,7 +8073,7 @@ Path '', line 1, position 1.");
|
||||
string json = JsonConvert.SerializeObject(dates, Formatting.Indented, new JsonSerializerSettings
|
||||
{
|
||||
DateFormatString = "yyyy tt",
|
||||
Culture = new CultureInfo("en-NZ")
|
||||
Culture = culture
|
||||
});
|
||||
|
||||
StringAssert.AreEqual(@"[
|
||||
@@ -8101,6 +8105,10 @@ Path '', line 1, position 1.");
|
||||
[Test]
|
||||
public void JsonSerializerDateFormatString()
|
||||
{
|
||||
CultureInfo culture = new CultureInfo("en-NZ");
|
||||
culture.DateTimeFormat.AMDesignator = "a.m.";
|
||||
culture.DateTimeFormat.PMDesignator = "p.m.";
|
||||
|
||||
IList<object> dates = new List<object>
|
||||
{
|
||||
new DateTime(2000, 12, 12, 12, 12, 12, DateTimeKind.Utc),
|
||||
@@ -8113,7 +8121,7 @@ Path '', line 1, position 1.");
|
||||
JsonSerializer serializer = JsonSerializer.Create(new JsonSerializerSettings
|
||||
{
|
||||
DateFormatString = "yyyy tt",
|
||||
Culture = new CultureInfo("en-NZ"),
|
||||
Culture = culture,
|
||||
Formatting = Formatting.Indented
|
||||
});
|
||||
serializer.Serialize(jsonWriter, dates);
|
||||
|
||||
Reference in New Issue
Block a user