示例#1
0
        public void provider_should_call_checker()
        {
            GivenAnEnabledFeature();
            GivenAProviderWithAChecker();

            provider.ReadConfiguration();
            provider.IsAvailable("feature1");

            checker.Received(1).IsAvailable(Arg.Any <Feature>());
        }
示例#2
0
        public void Should_read_feature_configuration()
        {
            var dictionary = GivenAnEnabledFeature();

            var provider = new InMemorySwitchProvider(dictionary);

            provider.ReadConfiguration();

            provider.FeatureSwitches.Values.ToArray()[0].Name.ShouldBe("feature1");
            provider.FeatureSwitches.Values.ToArray()[0].State.ShouldBe(true);
        }
示例#3
0
        public void Should_be_able_to_add_checkers_onto_features()
        {
            var checker           = new StateChecker();
            var featureDictionary = new Dictionary <string, bool>();

            featureDictionary.Add("feature", true);

            var provider = new InMemorySwitchProvider(featureDictionary);

            provider.AddChecker(checker);

            provider.ReadConfiguration();
            provider.IsAvailable("feature").ShouldBe(true);
        }