public void ChecksStateOfAllDependentFeatures(IFeatureContext featureContext, FeatureFixture feature,
                                                      IFeature dependentFeature, DependentFeatureToggler sut)
        {
            A.CallTo(() => featureContext.IsEnabled(dependentFeature))
            .Returns(true);
            // Hey, it works!
            feature.Traits.Add(new DependentFeatureTrait(dependentFeature));
            feature.Traits.Add(new DependentFeatureTrait(dependentFeature));
            feature.Traits.Add(new DependentFeatureTrait(dependentFeature));

            sut.IsEnabled(featureContext, feature);

            A.CallTo(() => featureContext.IsEnabled(dependentFeature))
            .MustHaveHappened(Repeated.Exactly.Times(3));
        }
        public void ReturnsFalseWhenDependentFeatureIsEnabled(IFeatureContext featureContext, FeatureFixture feature,
                                                              IFeature dependentFeature, DependentFeatureToggler sut)
        {
            A.CallTo(() => featureContext.IsEnabled(dependentFeature))
            .Returns(true);
            feature.Traits.Add(new DependentFeatureTrait(dependentFeature));

            bool?result = sut.IsEnabled(featureContext, feature);

            Assert.Null(result);
        }
        public void ChecksStateOfDependentFeatures(IFeatureContext featureContext, FeatureFixture feature, IFeature dependentFeature, DependentFeatureToggler sut)
        {
            A.CallTo(() => featureContext.IsEnabled(dependentFeature))
            .Returns(true);
            feature.Traits.Add(new DependentFeatureTrait(dependentFeature));

            sut.IsEnabled(featureContext, feature);

            A.CallTo(() => featureContext.IsEnabled(dependentFeature))
            .MustHaveHappened();
        }
        public void IgnoresFeatureWithoutDependentFeatureTrait(IFeatureContext featureContext, IFeature feature, DependentFeatureToggler sut)
        {
            bool?result = sut.IsEnabled(featureContext, feature);

            Assert.Null(result);
        }
 public void GivenNullFeatueContextThrowsException(IFeature feature, DependentFeatureToggler sut)
 {
     Assert.Throws <ArgumentNullException>(() => sut.IsEnabled(null, feature));
 }
 public void GivenNullFeatureThrows(IFeatureContext featureContext, DependentFeatureToggler sut)
 {
     Assert.Throws <ArgumentNullException>(() => sut.IsEnabled(featureContext, null));
 }