コード例 #1
0
        /// <summary>
        /// Groups the tests by outcome.
        /// </summary>
        private void GroupByOutcome()
        {
            var methodsGroupedByProject = TestMethodsWrapper
                                          .SelectMany(c => c.TestMethods)
                                          .GroupBy(tm => tm.ExecutionResult != null ? tm.ExecutionResult.Status : TestExecutionStatus.NotRun)
                                          .Select(tm =>
            {
                var text = GetOutcomeText(tm.Key);
                return(new TestMethodWrapper(text, tm, text));
            });

            Children.AddRange(methodsGroupedByProject);
        }
コード例 #2
0
        /// <summary>
        /// Groups the tests by project.
        /// </summary>
        private void GroupByProject()
        {
            var methodsGroupedByProject = TestMethodsWrapper
                                          .SelectMany(c => c.TestMethods)
                                          .GroupBy(tm => tm.Class.DLLPath)
                                          .Select(tm =>
            {
                var dll = Path.GetFileNameWithoutExtension(tm.Key);
                return(new TestMethodWrapper(dll, tm, dll));
            });

            Children.AddRange(methodsGroupedByProject);
        }
コード例 #3
0
        /// <summary>
        /// Groups the tests by Class.
        /// </summary>
        private void GroupByClass()
        {
            Children.AddRange(TestMethodsWrapper
                              .SelectMany(c => c.TestMethods)
                              .GroupBy(tm => tm.Class.Name)
                              .Select(tr =>
            {
                var @class = tr.ElementAt(0).Class;
                var fqn    = String.Format("{0}.{1}", @class.Namespace, @class.Name);

                return(new TestMethodWrapper(tr.Key, tr.OrderBy(t => t.FullyQualifiedName), fqn));
            })
                              .OrderBy(tmr => tmr.Name));
        }
コード例 #4
0
        /// <summary>
        /// Groups the test by Traits.
        /// </summary>
        private void GroupByTrait()
        {
            var traits            = TestMethodsWrapper.SelectMany(c => c.TestMethods).SelectMany(m => m.Traits).Distinct();
            var testMethodWrapper = new List <TestMethodWrapper>();

            foreach (var trait in traits)
            {
                var selectedTraits = TestMethodsWrapper
                                     .SelectMany(c => c.TestMethods)
                                     .Where(m => m.Traits != null && m.Traits.Contains(trait))
                                     .OrderBy(m => m.FullyQualifiedName);

                testMethodWrapper.Add(new TestMethodWrapper(trait, selectedTraits, trait));
            }

            Children.AddRange(testMethodWrapper.OrderBy(tmw => tmw.Name));
        }