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