microsoft / FeatureManagement-Dotnet

Microsoft.FeatureManagement provides standardized APIs for enabling feature flags within applications. Utilize this library to secure a consistent experience when developing applications that use patterns such as beta access, rollout, dark deployments, and more.
MIT License
1.02k stars 111 forks source link

Add testcases for time window filter cache entry #445

Open zhiyuanliang-ms opened 3 months ago

zhiyuanliang-ms commented 3 months ago

Why this PR?

Added testcases to check whether the cache of time window filter cached the correct closest active recurring time window start.

https://github.com/microsoft/FeatureManagement-Dotnet/pull/266#discussion_r1593335729

jimmyca15 commented 3 months ago

The test doesn't appear to be validating what it intends to. Ensuring something is in the cache does not check whether the filter calculates the window again or not.

zhiyuanliang-ms commented 3 months ago

@jimmyca15 In the latest commit, I added an internal property for the timewindow filter to track how many times recurring time window is re-calculated. What do you think?

zhiyuanliang-ms commented 3 months ago

This PR goes after PR #452

jimmyca15 commented 2 months ago

@jimmyca15 In the latest commit, I added an internal property for the timewindow filter to track how many times recurring time window is re-calculated. What do you think?

@zhiyuanliang-ms too invasive. Can we pass a custom implementation of IMemoryCache and check whenever memorycache.Set is called?

zhiyuanliang-ms commented 2 months ago

Can we pass a custom implementation of IMemoryCache and check whenever memorycache.Set is called?

@jimmyca15 Updated in 5da2d7d