File tree Expand file tree Collapse file tree 4 files changed +12
-27
lines changed
src/Microsoft.FeatureManagement
tests/Tests.FeatureManagement Expand file tree Collapse file tree 4 files changed +12
-27
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ public TimeWindowFilter(ILoggerFactory loggerFactory = null)
3939 /// <summary>
4040 /// This property allows the time window filter in our test suite to use simulated time.
4141 /// </summary>
42- internal ISystemClock SystemClock { get ; set ; }
42+ internal TimeProvider SystemClock { get ; set ; }
4343
4444 /// <summary>
4545 /// Binds configuration representing filter parameters to <see cref="TimeWindowFilterSettings"/>.
@@ -74,7 +74,7 @@ public Task<bool> EvaluateAsync(FeatureFilterEvaluationContext context)
7474 // Check if prebound settings available, otherwise bind from parameters.
7575 TimeWindowFilterSettings settings = ( TimeWindowFilterSettings ) context . Settings ?? ( TimeWindowFilterSettings ) BindParameters ( context . Parameters ) ;
7676
77- DateTimeOffset now = SystemClock ? . UtcNow ?? DateTimeOffset . UtcNow ;
77+ DateTimeOffset now = SystemClock ? . GetUtcNow ( ) ?? DateTimeOffset . UtcNow ;
7878
7979 if ( ! settings . Start . HasValue && ! settings . End . HasValue )
8080 {
@@ -129,7 +129,7 @@ public Task<bool> EvaluateAsync(FeatureFilterEvaluationContext context)
129129
130130 private DateTimeOffset ? ReloadClosestStart ( TimeWindowFilterSettings settings )
131131 {
132- DateTimeOffset now = SystemClock ? . UtcNow ?? DateTimeOffset . UtcNow ;
132+ DateTimeOffset now = SystemClock ? . GetUtcNow ( ) ?? DateTimeOffset . UtcNow ;
133133
134134 DateTimeOffset ? closestStart = RecurrenceEvaluator . CalculateClosestStart ( now , settings ) ;
135135
Original file line number Diff line number Diff line change 3535 </PropertyGroup >
3636
3737 <ItemGroup Condition =" '$(TargetFramework)' == 'netstandard2.0'" >
38- <PackageReference Include =" Microsoft.Bcl.AsyncInterfaces" Version =" 1.1.1 " />
38+ <PackageReference Include =" Microsoft.Bcl.AsyncInterfaces" Version =" 8.0.0 " />
3939 </ItemGroup >
4040
4141 <ItemGroup >
42+ <PackageReference Include =" Microsoft.Bcl.TimeProvider" Version =" 8.0.1" />
4243 <PackageReference Include =" Microsoft.Extensions.Caching.Memory" Version =" 2.1.23" />
4344 <PackageReference Include =" Microsoft.Extensions.Configuration.Binder" Version =" 2.1.10" />
4445 <PackageReference Include =" Microsoft.Extensions.Logging" Version =" 2.1.1" />
Original file line number Diff line number Diff line change 1- using Microsoft . FeatureManagement . FeatureFilters ;
2- using System ;
1+ using System ;
32
43namespace Tests . FeatureManagement
54{
6- class OnDemandClock : ISystemClock
5+ class OnDemandClock : TimeProvider
76 {
87 public DateTimeOffset UtcNow { get ; set ; }
8+
9+ public override DateTimeOffset GetUtcNow ( )
10+ {
11+ return UtcNow ;
12+ }
913 }
1014}
You can’t perform that action at this time.
0 commit comments