Skip to content

Commit dd05e0f

Browse files
committed
don't use toString when comparing dates
1 parent 6d78733 commit dd05e0f

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

RestSharp.Tests/JsonTests.cs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ public void Can_Deserialize_Elements_to_Nullable_Values()
190190
Assert.Equal(123, output.Id);
191191
Assert.NotNull(output.StartDate);
192192
Assert.Equal(
193-
new DateTime(2010, 2, 21, 9, 35, 00, DateTimeKind.Utc).ToString("u"),
194-
output.StartDate.Value.ToString("u"));
193+
new DateTime(2010, 2, 21, 9, 35, 00, DateTimeKind.Utc),
194+
output.StartDate.Value);
195195
Assert.Equal(new Guid(GuidString), output.UniqueId);
196196
}
197197

@@ -465,8 +465,8 @@ public void Can_Deserialize_JsonNet_Dates()
465465
var person = GetPayLoad<PersonForJson>("person.json.txt");
466466

467467
Assert.Equal(
468-
new DateTime(2011, 6, 30, 8, 15, 46, DateTimeKind.Utc).ToString("u"),
469-
person.StartDate.ToString("u"));
468+
new DateTime(2011, 6, 30, 8, 15, 46, 929, DateTimeKind.Utc),
469+
person.StartDate);
470470
}
471471

472472
[Fact]
@@ -475,8 +475,8 @@ public void Can_Deserialize_DateTime()
475475
var payload = GetPayLoad<DateTimeTestStructure>("datetimes.txt");
476476

477477
Assert.Equal(
478-
new DateTime(2011, 6, 30, 8, 15, 46, DateTimeKind.Utc).ToString("u"),
479-
payload.DateTime.ToString("u"));
478+
new DateTime(2011, 6, 30, 8, 15, 46, 929, DateTimeKind.Utc),
479+
payload.DateTime);
480480
}
481481

482482
[Fact]
@@ -486,8 +486,8 @@ public void Can_Deserialize_Nullable_DateTime_With_Value()
486486

487487
Assert.NotNull(payload.NullableDateTimeWithValue);
488488
Assert.Equal(
489-
new DateTime(2011, 6, 30, 8, 15, 46, DateTimeKind.Utc).ToString("u"),
490-
payload.NullableDateTimeWithValue.Value.ToString("u"));
489+
new DateTime(2011, 6, 30, 8, 15, 46, 929, DateTimeKind.Utc),
490+
payload.NullableDateTimeWithValue.Value);
491491
}
492492

493493
[Fact]
@@ -504,8 +504,8 @@ public void Can_Deserialize_DateTimeOffset()
504504
var payload = GetPayLoad<DateTimeTestStructure>("datetimes.txt");
505505

506506
Assert.Equal(
507-
new DateTime(2011, 6, 30, 8, 15, 46, DateTimeKind.Utc).ToString("u"),
508-
payload.DateTimeOffset.ToString("u"));
507+
new DateTime(2011, 6, 30, 8, 15, 46, 929, DateTimeKind.Utc),
508+
payload.DateTimeOffset);
509509
}
510510

511511
[Fact]
@@ -514,8 +514,8 @@ public void Can_Deserialize_Iso8601DateTimeLocal()
514514
var payload = GetPayLoad<Iso8601DateTimeTestStructure>("iso8601datetimes.txt");
515515

516516
Assert.Equal(
517-
new DateTime(2012, 7, 19, 10, 23, 25, DateTimeKind.Utc).ToString("u"),
518-
payload.DateTimeLocal.ToString("u"));
517+
new DateTime(2012, 7, 19, 10, 23, 25, DateTimeKind.Utc),
518+
payload.DateTimeLocal);
519519
}
520520

521521
[Fact]
@@ -524,8 +524,8 @@ public void Can_Deserialize_Iso8601DateTimeZulu()
524524
var payload = GetPayLoad<Iso8601DateTimeTestStructure>("iso8601datetimes.txt");
525525

526526
Assert.Equal(
527-
new DateTime(2012, 7, 19, 10, 23, 25, DateTimeKind.Utc).ToString("u"),
528-
payload.DateTimeUtc.ToUniversalTime().ToString("u"));
527+
new DateTime(2012, 7, 19, 10, 23, 25, 544, DateTimeKind.Utc),
528+
payload.DateTimeUtc.ToUniversalTime());
529529
}
530530

531531
[Fact]
@@ -534,8 +534,8 @@ public void Can_Deserialize_Iso8601DateTimeWithOffset()
534534
var payload = GetPayLoad<Iso8601DateTimeTestStructure>("iso8601datetimes.txt");
535535

536536
Assert.Equal(
537-
new DateTime(2012, 7, 19, 10, 23, 25, DateTimeKind.Utc).ToString("u"),
538-
payload.DateTimeWithOffset.ToUniversalTime().ToString("u"));
537+
new DateTime(2012, 7, 19, 10, 23, 25, 544, DateTimeKind.Utc),
538+
payload.DateTimeWithOffset.ToUniversalTime());
539539
}
540540

541541
[Fact]
@@ -545,8 +545,8 @@ public void Can_Deserialize_Nullable_DateTimeOffset_With_Value()
545545

546546
Assert.NotNull(payload.NullableDateTimeOffsetWithValue);
547547
Assert.Equal(
548-
new DateTime(2011, 6, 30, 8, 15, 46, DateTimeKind.Utc).ToString("u"),
549-
payload.NullableDateTimeOffsetWithValue.Value.ToString("u"));
548+
new DateTime(2011, 6, 30, 8, 15, 46, 929, DateTimeKind.Utc),
549+
payload.NullableDateTimeOffsetWithValue);
550550
}
551551

552552
[Fact]

0 commit comments

Comments
 (0)