Exemplo n.º 1
0
        bool LoadCurrentCategory()
        {
            var    key = provider.Name + ".CurrentCategory";
            string value;

            if (settings.TryGetValue(key, out value))
            {
                TestCategory category;
                if (string.Equals(value, "all", StringComparison.OrdinalIgnoreCase))
                {
                    category = TestCategory.All;
                }
                else if (string.Equals(value, "global", StringComparison.OrdinalIgnoreCase))
                {
                    category = TestCategory.Global;
                }
                else
                {
                    category = categories.FirstOrDefault(c => c.Name.Equals(value)) ?? TestCategory.All;
                }
                if (category == currentCategory)
                {
                    return(false);
                }
                currentCategory = category;
                return(true);
            }

            currentCategory = TestCategory.All;
            settings.SetValue(key, currentCategory.Name);
            return(true);
        }
Exemplo n.º 2
0
        public TestConfiguration(ITestConfigurationProvider provider, SettingsBag settings)
        {
            this.provider = provider;
            this.settings = settings;
            features      = new Dictionary <string, bool> ();
            categories    = new List <TestCategory> ();

            foreach (var feature in provider.Features)
            {
                features.Add(feature.Name, false);
            }

            categories.AddRange(provider.Categories);
            currentCategory = TestCategory.All;
            Load(false);

            settings.PropertyChanged += (sender, e) => Load(true);
        }
Exemplo n.º 3
0
 public ReadOnlySnapshot(ITestConfigurationProvider provider, IReadOnlyDictionary <string, bool> features, TestCategory currentCategory)
 {
     this.features        = features;
     this.currentCategory = currentCategory;
 }