From 2aec0ca25d4c600d289af4c15050be222f0651f8 Mon Sep 17 00:00:00 2001 From: Sean McCullough Date: Thu, 4 Jun 2020 12:01:02 -0500 Subject: [PATCH] Fixed minor Change Feed bug --- .../src/BlobChangeFeedExtensions.cs | 5 +++++ .../tests/BlobChangeFeedExtensionsTests.cs | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/sdk/storage/Azure.Storage.Blobs.ChangeFeed/src/BlobChangeFeedExtensions.cs b/sdk/storage/Azure.Storage.Blobs.ChangeFeed/src/BlobChangeFeedExtensions.cs index db2823badacca..d36ec0fb6cb5a 100644 --- a/sdk/storage/Azure.Storage.Blobs.ChangeFeed/src/BlobChangeFeedExtensions.cs +++ b/sdk/storage/Azure.Storage.Blobs.ChangeFeed/src/BlobChangeFeedExtensions.cs @@ -87,6 +87,11 @@ public static BlobChangeFeedClient GetChangeFeedClient(this BlobServiceClient se return null; } + if (dateTimeOffset.Value.Minute == 0 && dateTimeOffset.Value.Second == 0 && dateTimeOffset.Value.Millisecond == 0) + { + return dateTimeOffset; + } + DateTimeOffset? newDateTimeOffest = dateTimeOffset.RoundDownToNearestHour(); return newDateTimeOffest.Value.AddHours(1); diff --git a/sdk/storage/Azure.Storage.Blobs.ChangeFeed/tests/BlobChangeFeedExtensionsTests.cs b/sdk/storage/Azure.Storage.Blobs.ChangeFeed/tests/BlobChangeFeedExtensionsTests.cs index 631633df5223d..72ed2ca588d24 100644 --- a/sdk/storage/Azure.Storage.Blobs.ChangeFeed/tests/BlobChangeFeedExtensionsTests.cs +++ b/sdk/storage/Azure.Storage.Blobs.ChangeFeed/tests/BlobChangeFeedExtensionsTests.cs @@ -86,6 +86,12 @@ public void RoundUpToNearestHourTests() (new DateTimeOffset?( new DateTimeOffset(2020, 03, 17, 20, 25, 30, TimeSpan.Zero))).RoundUpToNearestHour()); + Assert.AreEqual( + new DateTimeOffset?( + new DateTimeOffset(2020, 03, 17, 21, 0, 0, TimeSpan.Zero)), + (new DateTimeOffset?( + new DateTimeOffset(2020, 03, 17, 21, 0, 0, TimeSpan.Zero))).RoundUpToNearestHour()); + Assert.AreEqual( null, ((DateTimeOffset?)null).RoundUpToNearestHour());