Beispiel #1
0
 private static LayoutToggle GetElement(Guid itemId, string currentLanguage, Func <Feature, IList <LayoutToggle> > expression)
 {
     return(FeatureToggles.GetAllEnabledFeatures()
            .Where(x => x.EnabledForLanguage(currentLanguage))
            .SelectMany(expression.Invoke)
            .Where(x => x != null)
            .FirstOrDefault(x => x.Id == itemId));
 }
Beispiel #2
0
        internal static IEnumerable <RenderingReplacement> GetAllRenderingReplacements(string currentLanguage)
        {
            var allFeatures = FeatureToggles.GetAllEnabledFeatures().Where(x => x.EnabledForLanguage(currentLanguage));

            var allSublayouts = new List <RenderingReplacement>();

            foreach (var feature in allFeatures)
            {
                var currentFeature = feature;
                var sublayouts     =
                    feature.Renderings.Select(x => new RenderingReplacement
                {
                    Enabled  = currentFeature.Enabled,
                    New      = x.New,
                    Original = x.Original
                });

                allSublayouts.AddRange(sublayouts);
            }

            return(allSublayouts);
        }
Beispiel #3
0
        public void GetAllEnabledFeatures_GivenFeaturesInConfig_ReturnsElevenFeatureToggles()
        {
            var features = FeatureToggles.GetAllEnabledFeatures();

            Assert.AreEqual(9, features.Count());
        }