Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Features that enable based on a date #12

Open
DustinKingen opened this issue Sep 28, 2016 · 1 comment
Open

Features that enable based on a date #12

DustinKingen opened this issue Sep 28, 2016 · 1 comment

Comments

@DustinKingen
Copy link

Hi Max,

I am wondering what the preferred method is for extending this framework to support Features that are enabled after some DateTime:

For example:

Configure the DateTime when the feature should start.

Features
    .Are
    .ConfiguredBy
    .Custom(featureName => new DateTime(2017, 1, 1));

Check the feature is enabled.

Feature<Sample>.Is().EnabledOn(new DateTime(2017, 1, 2)) // Returns true
Feature<Sample>.Is().EnabledNow() // Returns false when DateTime.Now is before 2017
@mexx
Copy link
Owner

mexx commented Oct 3, 2016

Hi Dustin,

Given you don't need to configure the timestamps to check against, I wouldn't add the additional functionality at the check side, it would still looks like Feature<Sample>.Is().Enabled. You can easily add a behavior function for temporal checks.

If you have to check against different timestamps, I would use FeatureSwitcher.Contexteer and put the timestamp to check against as a property into the IContext instance. You can reuse the same behavior function for temporal checks, parametrized by the timestamp from the context instead of DateTime.Now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants