public void IsEnabledCallsIsEnabledOnToggle([Frozen] IFeatureTogglerSource togglerSource, IFeature feature, IFeatureToggler featureToggler, bool expected, FeatureContext sut) { A.CallTo(() => featureToggler.IsEnabled(sut, feature)) .Returns(expected); A.CallTo(() => togglerSource.GetFeatureToggles()) .Returns(new[] { featureToggler }); bool result = sut.IsEnabled(feature); A.CallTo(() => featureToggler.IsEnabled(sut, feature)) .MustHaveHappened(); Assert.Equal(expected, result); }
public void IsEnabledUsesFirstToggleProviderResult([Frozen] IFeatureTogglerSource togglerSource, IFeature feature, IFeatureToggler skippedToggler, IFeatureToggler enabledToggler, IFeatureToggler endToggler, bool expected, FeatureContext sut) { A.CallTo(() => enabledToggler.IsEnabled(sut, feature)) .Returns(expected); A.CallTo(() => togglerSource.GetFeatureToggles()) .Returns(new[] { skippedToggler, enabledToggler, endToggler }); bool result = sut.IsEnabled(feature); Assert.Equal(expected, result); A.CallTo(() => endToggler.IsEnabled(sut, feature)) .MustNotHaveHappened(); }