From ab7e4e0c0a0c5dd164fcd9c5d75ea9cbcb2f7970 Mon Sep 17 00:00:00 2001 From: David Wedgbury Date: Mon, 20 Mar 2023 11:34:01 +0000 Subject: [PATCH 1/2] Use constructor rather than parsing en-US string --- .../DateTimeOffsetSupport/DateTimeOffsetController.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.AspNetCore.OData.E2E.Tests/DateTimeOffsetSupport/DateTimeOffsetController.cs b/test/Microsoft.AspNetCore.OData.E2E.Tests/DateTimeOffsetSupport/DateTimeOffsetController.cs index cc0ba0455..2a9c315e2 100644 --- a/test/Microsoft.AspNetCore.OData.E2E.Tests/DateTimeOffsetSupport/DateTimeOffsetController.cs +++ b/test/Microsoft.AspNetCore.OData.E2E.Tests/DateTimeOffsetSupport/DateTimeOffsetController.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Linq; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; @@ -64,8 +65,8 @@ public IActionResult Post([FromBody]File file) { // Special test case for property name case-insensitive Assert.Equal("abc", file.Name); - Assert.Equal(DateTimeOffset.Parse("10/28/2021 9:33:26 PM +08:00"), file.CreatedDate); - Assert.Equal(DateTimeOffset.Parse("11/1/2021 10:48:12 AM +08:00"), file.DeleteDate); + Assert.Equal(new DateTimeOffset(2021, 10, 28, 21, 33, 26, TimeSpan.FromHours(8)), file.CreatedDate); + Assert.Equal(new DateTimeOffset(2021, 11, 01, 10, 48, 12, TimeSpan.FromHours(8)), file.DeleteDate); // special string used to verify at test case. return Ok("PropertyCaseInsensitive"); From ed10d326c335feacb85e1cd264342557ecf0552b Mon Sep 17 00:00:00 2001 From: David Wedgbury Date: Mon, 20 Mar 2023 11:35:19 +0000 Subject: [PATCH 2/2] Remove unused using --- .../DateTimeOffsetSupport/DateTimeOffsetController.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/test/Microsoft.AspNetCore.OData.E2E.Tests/DateTimeOffsetSupport/DateTimeOffsetController.cs b/test/Microsoft.AspNetCore.OData.E2E.Tests/DateTimeOffsetSupport/DateTimeOffsetController.cs index 2a9c315e2..5a428090f 100644 --- a/test/Microsoft.AspNetCore.OData.E2E.Tests/DateTimeOffsetSupport/DateTimeOffsetController.cs +++ b/test/Microsoft.AspNetCore.OData.E2E.Tests/DateTimeOffsetSupport/DateTimeOffsetController.cs @@ -7,7 +7,6 @@ using System; using System.Collections.Generic; -using System.Globalization; using System.Linq; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc;