Beispiel #1
0
        public string ToParameterString(ITestFilter filter)
        {
            var str = filter.ToString();

            if (str.StartsWith("not "))
            {
                return("/exclude:" + str.Substring("not ".Length));
            }
            return("/include:" + str);
        }
Beispiel #2
0
        public VisualState(TestSuiteTreeView treeView)
        {
            this.ShowCheckBoxes = treeView.CheckBoxes;
            this.TopNode        = ((TestSuiteTreeNode)treeView.TopNode).Test.TestName.UniqueName;
            this.SelectedNode   = ((TestSuiteTreeNode)treeView.SelectedNode).Test.TestName.UniqueName;
            this.Nodes          = new VisualTreeNode[] { new VisualTreeNode((TestSuiteTreeNode)treeView.Nodes[0]) };
            if (!treeView.CategoryFilter.IsEmpty)
            {
                ITestFilter filter = treeView.CategoryFilter;
                if (filter is NotFilter)
                {
                    filter = ((NotFilter)filter).BaseFilter;
                    this.ExcludeCategories = true;
                }

                this.SelectedCategories = filter.ToString();
            }
        }
        /// <summary>
        /// Method that actually performs the work. Overridden
        /// in CompositeWorkItem to do setup, run all child
        /// items and then do teardown.
        /// </summary>
        protected override void PerformWork()
        {
            // Assume success, since the result will be inconclusive
            // if there is no setup method to run or if the
            // context initialization fails.
            Result.SetResult(ResultState.Success);

            PerformOneTimeSetUp();

            if (Result.ResultState.Status == TestStatus.Passed && _suite.HasChildren)
            {
                foreach (Test test in _suite.Tests)
                {
                    if (_childFilter.Pass(test))
                    {
                        _children.Enqueue(CreateWorkItem(test, this.Context, _childFilter));
                    }
                }

                if (_children.Count > 0)
                {
                    RunChildren();
                    return;
                }
                else
                {
                    Console.WriteLine("No tests found that match filter: " + _childFilter.ToString() + "\n");
                    Result.SetResult(ResultState.Inconclusive);
                }
            }

            // Fall through in case there were no child tests to run.
            // Otherwise, this is done in the completion event.
            PerformOneTimeTearDown();

            WorkItemComplete();
        }
Beispiel #4
0
 /// <summary>
 /// Return string representation of the filter
 /// </summary>
 public override string ToString()
 {
     return("not " + baseFilter.ToString());
 }
 private string ToParameterString(ITestFilter filter)
 {
     var str = filter.ToString();
     if (str.StartsWith("not "))
     {
         return "/exclude:" + str.Substring("not ".Length);
     }
     return "/include:" + str;
 }