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)
39
39
/// <summary>
40
40
/// This property allows the time window filter in our test suite to use simulated time.
41
41
/// </summary>
42
- internal ISystemClock SystemClock { get ; set ; }
42
+ internal TimeProvider SystemClock { get ; set ; }
43
43
44
44
/// <summary>
45
45
/// Binds configuration representing filter parameters to <see cref="TimeWindowFilterSettings"/>.
@@ -74,7 +74,7 @@ public Task<bool> EvaluateAsync(FeatureFilterEvaluationContext context)
74
74
// Check if prebound settings available, otherwise bind from parameters.
75
75
TimeWindowFilterSettings settings = ( TimeWindowFilterSettings ) context . Settings ?? ( TimeWindowFilterSettings ) BindParameters ( context . Parameters ) ;
76
76
77
- DateTimeOffset now = SystemClock ? . UtcNow ?? DateTimeOffset . UtcNow ;
77
+ DateTimeOffset now = SystemClock ? . GetUtcNow ( ) ?? DateTimeOffset . UtcNow ;
78
78
79
79
if ( ! settings . Start . HasValue && ! settings . End . HasValue )
80
80
{
@@ -129,7 +129,7 @@ public Task<bool> EvaluateAsync(FeatureFilterEvaluationContext context)
129
129
130
130
private DateTimeOffset ? ReloadClosestStart ( TimeWindowFilterSettings settings )
131
131
{
132
- DateTimeOffset now = SystemClock ? . UtcNow ?? DateTimeOffset . UtcNow ;
132
+ DateTimeOffset now = SystemClock ? . GetUtcNow ( ) ?? DateTimeOffset . UtcNow ;
133
133
134
134
DateTimeOffset ? closestStart = RecurrenceEvaluator . CalculateClosestStart ( now , settings ) ;
135
135
Original file line number Diff line number Diff line change 37
37
</PropertyGroup >
38
38
39
39
<ItemGroup Condition =" '$(TargetFramework)' == 'netstandard2.0'" >
40
- <PackageReference Include =" Microsoft.Bcl.AsyncInterfaces" Version =" 1.1.1 " />
40
+ <PackageReference Include =" Microsoft.Bcl.AsyncInterfaces" Version =" 8.0.0 " />
41
41
</ItemGroup >
42
42
43
43
<ItemGroup >
44
+ <PackageReference Include =" Microsoft.Bcl.TimeProvider" Version =" 8.0.1" />
44
45
<PackageReference Include =" Microsoft.Extensions.Caching.Memory" Version =" 2.1.23" />
45
46
<PackageReference Include =" Microsoft.Extensions.Configuration.Binder" Version =" 2.1.10" />
46
47
<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 ;
3
2
4
3
namespace Tests . FeatureManagement
5
4
{
6
- class OnDemandClock : ISystemClock
5
+ class OnDemandClock : TimeProvider
7
6
{
8
7
public DateTimeOffset UtcNow { get ; set ; }
8
+
9
+ public override DateTimeOffset GetUtcNow ( )
10
+ {
11
+ return UtcNow ;
12
+ }
9
13
}
10
14
}
You can’t perform that action at this time.
0 commit comments