Example #1
0
        private static void AddingToCache <T>(TestCase testCase, IDictionary <string, CachedTestCaseInfo> traitsCache, string key, CategoryList categoryList, T ancestor, Func <T, bool, string, IDictionary <string, CachedTestCaseInfo>, IEnumerable <string> > processTestCaseProperties)
        {
            if (traitsCache.ContainsKey(key))
            {
                categoryList.AddRange(traitsCache[key].Traits.Where(o => o.Name == NunitTestCategoryLabel)
                                      .Select(prop => prop.Value).ToList());

                if (traitsCache[key].Explicit)
                {
                    testCase.SetPropertyValue(CategoryList.NUnitExplicitProperty, true);
                }

                var traitsList = traitsCache[key].Traits.Where(o => o.Name != NunitTestCategoryLabel).ToList();
                if (traitsList.Count > 0)
                {
                    testCase.Traits.AddRange(traitsList);
                }
            }
            else
            {
                processTestCaseProperties(ancestor, true, key, traitsCache);
                // Adding entry to dictionary, so that we will not make SelectNodes call again.
                if (categoryList.LastNodeListCount == 0 && !traitsCache.ContainsKey(key))
                {
                    traitsCache[key] = new CachedTestCaseInfo();
                }
            }
        }