public async Task GetOrFetchAsync_DateTimeShouldBeEqualEveryTime(TestObjectDateTime data)
        {
            var(firstResult, secondResult) = await PerformTimeStampGrab(data);

            Assert.Equal(firstResult.Timestamp, secondResult.Timestamp);
            Assert.Equal(firstResult.TimestampNullable, secondResult.TimestampNullable);
        }
Esempio n. 2
0
        public async Task GetOrFetchAsyncDateTimeShouldBeEqualEveryTime(TestObjectDateTime data)
        {
            using (Utility.WithEmptyDirectory(out var path))
                using (var blobCache = CreateBlobCache(path))
                {
                    var(firstResult, secondResult) = await PerformTimeStampGrab(blobCache, data).ConfigureAwait(false);

                    Assert.Equal(secondResult.Timestamp.Kind, DateTimeKind.Utc);
                    Assert.Equal(firstResult.Timestamp.ToUniversalTime(), secondResult.Timestamp.ToUniversalTime());
                    Assert.Equal(firstResult.TimestampNullable?.ToUniversalTime(), secondResult.TimestampNullable?.ToUniversalTime());
                }
        }
Esempio n. 3
0
        public async Task GetOrFetchAsyncDateTimeWithForcedLocal(TestObjectDateTime data)
        {
            using (Utility.WithEmptyDirectory(out var path))
                using (var blobCache = CreateBlobCache(path))
                {
                    blobCache.ForcedDateTimeKind   = DateTimeKind.Local;
                    var(firstResult, secondResult) = await PerformTimeStampGrab(blobCache, data).ConfigureAwait(false);

                    Assert.Equal(secondResult.Timestamp.Kind, DateTimeKind.Local);
                    Assert.Equal(firstResult.Timestamp, secondResult.Timestamp);
                    Assert.Equal(firstResult.Timestamp.ToUniversalTime(), secondResult.Timestamp.ToUniversalTime());
                    Assert.Equal(firstResult.TimestampNullable?.ToUniversalTime(), secondResult.TimestampNullable?.ToUniversalTime());
                    BlobCache.ForcedDateTimeKind = null;
                }
        }