public void IsEnabledCallsAllToggles([Frozen] IFeatureToggleProvider toggleProvider, IFeature feature, Fixture fixture, FeatureContext sut) { var featureToggles = fixture.CreateMany <Fake <IFeatureToggle> >().ToList(); foreach (Fake <IFeatureToggle> fake in featureToggles) { fake.CallsTo(ft => ft.IsEnabled(feature)) .Returns(null); } var finalTogle = A.Fake <Fake <IFeatureToggle> >(); finalTogle.CallsTo(ft => ft.IsEnabled(feature)) .Returns(true); featureToggles.Add(finalTogle); A.CallTo(() => toggleProvider.GetFeatureToggles()) .Returns(featureToggles.Select(f => f.FakedObject)); sut.IsEnabled(feature); foreach (Fake <IFeatureToggle> fake in featureToggles) { fake.CallsTo(ft => ft.IsEnabled(feature)) .MustHaveHappened(); } }
public FeatureContext(IFeatureToggleProvider toggleProvider) { if (toggleProvider == null) throw new ArgumentNullException(nameof(toggleProvider)); _toggleProvider = toggleProvider; }
public void IsEnabledCallsGetsFeatureToggles([Frozen] IFeatureToggleProvider toggleProvider, IFeature feature, FeatureContext sut) { Ignore.Exception <FeatureStateNotFoundException, bool>(() => sut.IsEnabled(feature)); A.CallTo(() => toggleProvider.GetFeatureToggles()) .MustHaveHappened(); }
public FeatureContext(IFeatureToggleProvider toggleProvider) { if (toggleProvider == null) { throw new ArgumentNullException(nameof(toggleProvider)); } _toggleProvider = toggleProvider; }
public void IsEnabledCallsIsEnabledOnToggle([Frozen] IFeatureToggleProvider toggleProvider, IFeature feature, IFeatureToggle featureToggle, bool expected, FeatureContext sut) { A.CallTo(() => featureToggle.IsEnabled(feature)) .Returns(expected); A.CallTo(() => toggleProvider.GetFeatureToggles()) .Returns(new[] { featureToggle }); bool result = sut.IsEnabled(feature); A.CallTo(() => featureToggle.IsEnabled(feature)) .MustHaveHappened(); Assert.Equal(expected, result); }
public void IsEnabledUsesFirstToggleProviderResult([Frozen] IFeatureToggleProvider toggleProvider, IFeature feature, IFeatureToggle skippedToggle, IFeatureToggle enabledToggle, IFeatureToggle endToggle, bool expected, FeatureContext sut) { A.CallTo(() => enabledToggle.IsEnabled(feature)) .Returns(expected); A.CallTo(() => toggleProvider.GetFeatureToggles()) .Returns(new[] { skippedToggle, enabledToggle, endToggle }); bool result = sut.IsEnabled(feature); Assert.Equal(expected, result); A.CallTo(() => endToggle.IsEnabled(feature)) .MustNotHaveHappened(); }
public BackgroundService(ILogger <BackgroundService> logger, IFeatureToggleProvider featureToggleProvider) { _logger = logger; _featureToggleProvider = featureToggleProvider; }
public KeyGenerator(IFeatureToggleProvider featureProvider) { _iFeatureProvider = featureProvider; }
public DevDocumentFilter(IFeatureToggleProvider featureProvider) { _iFeatureProvider = featureProvider; }
public CryptoSigner(ITransactionHasher transactionHasher, IFeatureToggleProvider featureProvider) { _iTransactionHasher = transactionHasher; _iFeatureProvider = featureProvider; }
public ValuesController(IFeatureToggleProvider featureToggleProvider) { _featureToggleProvider = featureToggleProvider; }
public static bool IsEnable(this Enum featureFlag, IFeatureToggleProvider featureToggleProvider, IDictionary <string, object> userAttributes = null) { return(featureToggleProvider.IsEnable(featureFlag, userAttributes)); }
public static T Get <T>(this Enum featureFlag, IFeatureToggleProvider featureToggleProvider, IDictionary <string, object> userAttributes = null) { return(featureToggleProvider.Get <T>(featureFlag, userAttributes)); }