Skip to content

Commit e33f315

Browse files
expose time provider for TimeWindowFilter
1 parent 2ce8f5f commit e33f315

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/Microsoft.FeatureManagement/FeatureFilters/TimeWindowFilter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ public TimeWindowFilter(ILoggerFactory loggerFactory = null)
3737
public IMemoryCache Cache { get; set; }
3838

3939
/// <summary>
40-
/// This property allows the time window filter in our test suite to use simulated time.
40+
/// This property allows the time window filter to use custom <see cref="TimeProvider"/>.
4141
/// </summary>
42-
internal TimeProvider SystemClock { get; set; }
42+
public TimeProvider SystemClock { get; set; }
4343

4444
/// <summary>
4545
/// Binds configuration representing filter parameters to <see cref="TimeWindowFilterSettings"/>.

src/Microsoft.FeatureManagement/ServiceCollectionExtensions.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,8 @@ private static IFeatureManagementBuilder GetFeatureManagementBuilder(IServiceCol
175175
builder.AddFeatureFilter<TimeWindowFilter>(sp =>
176176
new TimeWindowFilter()
177177
{
178-
Cache = sp.GetRequiredService<IMemoryCache>()
178+
Cache = sp.GetRequiredService<IMemoryCache>(),
179+
SystemClock = sp.GetService<TimeProvider>() ?? TimeProvider.System,
179180
});
180181

181182
builder.AddFeatureFilter<ContextualTargetingFilter>();

0 commit comments

Comments
 (0)