Base:
86 references to GetUtcNow
Aspire.Hosting.Tests (1)
Health\ResourceHealthCheckServiceTests.cs (1)
141await channel.Writer.WriteAsync(timeProvider.GetUtcNow());
Microsoft.AspNetCore.Authentication.Test (3)
CookieTests.cs (3)
478new AuthenticationProperties() { ExpiresUtc = _timeProvider.GetUtcNow().Add(TimeSpan.FromMinutes(5)) })); 843ctx.Properties.IssuedUtc = _timeProvider.GetUtcNow(); 990context.Properties.ExpiresUtc = _timeProvider.GetUtcNow().Add(TimeSpan.FromMinutes(5));
Microsoft.AspNetCore.Identity.Test (3)
SecurityStampValidatorTest.cs (3)
301IssuedUtc = timeProvider.GetUtcNow() - TimeSpan.FromDays(1), 302ExpiresUtc = timeProvider.GetUtcNow() + TimeSpan.FromDays(1), 313var now = timeProvider.GetUtcNow();
Microsoft.AspNetCore.OutputCaching.Tests (9)
OutputCacheMiddlewareTests.cs (9)
380Assert.Equal(timeProvider.GetUtcNow(), context.ResponseTime); 392var initialTime = timeProvider.GetUtcNow(); 401Assert.NotEqual(timeProvider.GetUtcNow(), context.ResponseTime); 432context.ResponseTime = timeProvider.GetUtcNow(); 433context.HttpContext.Response.Headers.Expires = HeaderUtilities.FormatDate(timeProvider.GetUtcNow() + TimeSpan.FromSeconds(11)); 455context.ResponseTime = timeProvider.GetUtcNow(); 461context.HttpContext.Response.Headers.Expires = HeaderUtilities.FormatDate(timeProvider.GetUtcNow() + TimeSpan.FromSeconds(11)); 481context.ResponseTime = timeProvider.GetUtcNow(); 487context.HttpContext.Response.Headers.Expires = HeaderUtilities.FormatDate(timeProvider.GetUtcNow() + TimeSpan.FromSeconds(11));
Microsoft.AspNetCore.ResponseCaching.Tests (9)
ResponseCachingMiddlewareTests.cs (9)
371Assert.Equal(timeProvider.GetUtcNow(), context.ResponseTime); 383var initialTime = timeProvider.GetUtcNow(); 392Assert.NotEqual(timeProvider.GetUtcNow(), context.ResponseTime); 448var now = timeProvider.GetUtcNow(); 458context.ResponseTime = timeProvider.GetUtcNow(); 478context.ResponseTime = timeProvider.GetUtcNow(); 484context.HttpContext.Response.Headers.Expires = HeaderUtilities.FormatDate(timeProvider.GetUtcNow() + TimeSpan.FromSeconds(11)); 503context.ResponseTime = timeProvider.GetUtcNow(); 509context.HttpContext.Response.Headers.Expires = HeaderUtilities.FormatDate(timeProvider.GetUtcNow() + TimeSpan.FromSeconds(11));
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (6)
DateHeaderValueManagerTests.cs (4)
26var now = timeProvider.GetUtcNow(); 38var now = timeProvider.GetUtcNow(); 57var now = timeProvider.GetUtcNow(); 86var now = timeProvider.GetUtcNow();
HeartbeatTests.cs (1)
137Assert.Equal($"As of \"{timeProvider.GetUtcNow().ToString(CultureInfo.InvariantCulture)}\", the heartbeat has been running for "
KestrelServerTests.cs (1)
747Assert.Equal(HeaderUtilities.FormatDate(testContext.FakeTimeProvider.GetUtcNow()),
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests (23)
CalculatorTests.cs (2)
19totalTimeSinceStart: TimeSpan.FromTicks(new FakeTimeProvider().GetUtcNow().Ticks), 122totalTimeSinceStart: TimeSpan.FromTicks(new FakeTimeProvider().GetUtcNow().Ticks),
Helpers\DummyProvider.cs (1)
28totalTimeSinceStart: TimeSpan.FromTicks(SnapshotTimeClock.GetUtcNow().Ticks),
IResourceUtilizationSnapshotProviderTests.cs (1)
27Assert.Equal(DummyProvider.SnapshotTimeClock.GetUtcNow().Ticks, snapshot.TotalTimeSinceStart.Ticks);
Providers\ConditionallyFaultProvider.cs (1)
35TimeSpan.FromTicks(new FakeTimeProvider().GetUtcNow().Ticks),
Providers\FakeProvider.cs (1)
12TimeSpan.FromTicks(new FakeTimeProvider().GetUtcNow().Ticks),
Providers\FaultProvider.cs (1)
25return new Snapshot(TimeSpan.FromTicks(_clock.GetUtcNow().Ticks), TimeSpan.Zero, TimeSpan.Zero, ulong.MaxValue);
ResourceMonitoringServiceTests.cs (13)
389TimeSpan.FromTicks(clock.GetUtcNow().Ticks), 403TimeSpan.FromTicks(clock.GetUtcNow().AddMilliseconds(TimerPeriod).Ticks), 408TimeSpan.FromTicks(clock.GetUtcNow().AddMilliseconds(TimerPeriod * 2).Ticks), 413TimeSpan.FromTicks(clock.GetUtcNow().AddMilliseconds(TimerPeriod * 3).Ticks), 418TimeSpan.FromTicks(clock.GetUtcNow().AddMilliseconds(TimerPeriod * 4).Ticks), 423TimeSpan.FromTicks(clock.GetUtcNow().AddMilliseconds(TimerPeriod * 5).Ticks), 496TimeSpan.FromTicks(clock.GetUtcNow().Ticks), 509TimeSpan.FromTicks(clock.GetUtcNow().AddMilliseconds(TimerPeriod).Ticks), 514TimeSpan.FromTicks(clock.GetUtcNow().AddMilliseconds(TimerPeriod * 2).Ticks), 519TimeSpan.FromTicks(clock.GetUtcNow().AddMilliseconds(TimerPeriod * 3).Ticks), 524TimeSpan.FromTicks(clock.GetUtcNow().AddMilliseconds(TimerPeriod * 4).Ticks), 529TimeSpan.FromTicks(clock.GetUtcNow().AddMilliseconds(TimerPeriod * 5).Ticks), 644TimeSpan.FromTicks(_clock.GetUtcNow().Ticks),
SnapshotTests.cs (3)
18var snapshot = new Snapshot(TimeSpan.FromTicks(time.GetUtcNow().Ticks), TimeSpan.Zero, TimeSpan.FromSeconds(1), 10); 19Assert.Equal(time.GetUtcNow().Ticks, snapshot.TotalTimeSinceStart.Ticks); 23Assert.Equal(time.GetUtcNow().Ticks, snapshot.TotalTimeSinceStart.Ticks);
Microsoft.Extensions.Diagnostics.Testing.Tests (5)
Logging\FakeLoggerTests.cs (1)
254var start = timeProvider.GetUtcNow();
Metrics\MetricCollectorTests.cs (4)
77Assert.Equal(timeProvider.GetUtcNow(), collector.LastMeasurement.Timestamp); 122Assert.Equal(timeProvider.GetUtcNow(), collector.LastMeasurement.Timestamp); 169Assert.Equal(timeProvider.GetUtcNow(), collector.LastMeasurement.Timestamp); 230Assert.Equal(timeProvider.GetUtcNow(), collector.LastMeasurement.Timestamp);
Microsoft.Extensions.Http.Resilience.Tests (2)
Internal\RetryAfterHelperTests.cs (2)
45response.Headers.RetryAfter = new RetryConditionHeaderValue(timeProvider.GetUtcNow() + TimeSpan.FromDays(1)); 59response.Headers.RetryAfter = new RetryConditionHeaderValue(timeProvider.GetUtcNow() + TimeSpan.FromDays(1));
Microsoft.Extensions.TimeProvider.Testing.Tests (25)
FakeTimeProviderTests.cs (23)
20var now = timeProvider.GetUtcNow(); 37var now2 = timeProvider.GetUtcNow(); 52var now = timeProvider.GetUtcNow(); 68now = timeProvider.GetUtcNow(); 108var initialTimeUtcNow = timeProvider.GetUtcNow(); 111timeProvider.SetUtcNow(timeProvider.GetUtcNow().AddMilliseconds(1234)); 113var finalTimeUtcNow = timeProvider.GetUtcNow(); 132var initialTimeUtcNow = timeProvider.GetUtcNow(); 137var finalTimeUtcNow = timeProvider.GetUtcNow(); 157Assert.Throws<ArgumentOutOfRangeException>(() => timeProvider.SetUtcNow(timeProvider.GetUtcNow() - TimeSpan.FromTicks(1))); 171tp.AdjustTime(tp.GetUtcNow() + TimeSpan.FromMilliseconds(999)); 174tp.AdjustTime(tp.GetUtcNow() + TimeSpan.FromMilliseconds(1)); 177tp.AdjustTime(tp.GetUtcNow() + TimeSpan.FromSeconds(10)); 198tp.AdjustTime(tp.GetUtcNow() - TimeSpan.FromMilliseconds(999)); 201tp.AdjustTime(tp.GetUtcNow() - TimeSpan.FromMilliseconds(1)); 204tp.AdjustTime(tp.GetUtcNow() - TimeSpan.FromSeconds(10)); 364var first = timeProvider.GetUtcNow(); 365var second = timeProvider.GetUtcNow(); 366var third = timeProvider.GetUtcNow(); 380Assert.Equal(timeProvider.Start, timeProvider.GetUtcNow()); 394Assert.Equal(timeProvider.Start, timeProvider.GetUtcNow()); 421var th = new Thread(() => provider.GetUtcNow()); 434provider.GetUtcNow();
TimerTests.cs (2)
280using var timer = timeProvider.CreateTimer(_ => { callbackTime = timeProvider.GetUtcNow(); }, null, TimeSpan.Zero, TimeSpan.FromMilliseconds(10)); 303var timer = timeProvider.CreateTimer(_ => { callbackTimes.Add(timeProvider.GetUtcNow()); }, null, TimeSpan.Zero, period);