Exemplo n.º 1
0
        public void FeatureWithMultipleDefaultValueTraitsThrows(FeatureFixture feature,
            IEnumerable<DefaultValueTrait> defaultValueTraits, DefaultValueToggle sut)
        {
            feature.Traits.AddRange(defaultValueTraits);

            Assert.Throws<InvalidFeatureException>(() => sut.IsEnabled(feature));
        }
Exemplo n.º 2
0
        public void ReturnsNullWhenNoValueExists(FeatureFixture feature, Fixture fixture, AppSettingsToggle sut)
        {
            feature.Id = fixture.Create<string>();

            bool? result = sut.IsEnabled(feature);

            Assert.Equal(null, result);
        }
Exemplo n.º 3
0
        public void FeatureWithDefaultValueTraitShouldReturnDefaultValue(FeatureFixture feature,
            DefaultValueTrait defaultValueTrait, DefaultValueToggle sut)
        {
            feature.Traits.Add(defaultValueTrait);

            bool? result = sut.IsEnabled(feature);

            Assert.Equal(defaultValueTrait.DefaultValue, result);
        }
Exemplo n.º 4
0
        public void ReturnsAppSettingValueWhenSet(string value, bool? expected, FeatureFixture feature, Fixture fixture, AppSettingsToggle sut)
        {
            // Apparently AutoFixture will reuse the feature
            feature.Id = fixture.Create<string>();

            using (AppSetting.Use($"{AppSettingsToggle.SettingsPrefix}{feature.Id}", value))
            {
                bool? result = sut.IsEnabled(feature);

                Assert.Equal(expected, result);
            }
        }
Exemplo n.º 5
0
        public void FeatureWithoutDefaultValueTraitShouldReturnNull(FeatureFixture feature, DefaultValueToggle sut)
        {
            bool? result = sut.IsEnabled(feature);

            Assert.Null(result);
        }