Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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();
        }