示例#1
0
        void OnCombineRenamed(object sender, SolutionItemRenamedEventArgs e)
        {
            UnitTestGroup parent = Parent as UnitTestGroup;

            if (parent != null)
            {
                parent.UpdateTests();
            }
        }
示例#2
0
        public override void BuildChildNodes(ITreeBuilder builder, object dataObject)
        {
            UnitTestGroup test = dataObject as UnitTestGroup;

            if (test == null)
            {
                return;
            }

            builder.AddChildren(test.Tests);
        }
示例#3
0
        void BuildChildNodes(UnitTestGroup test, ITreeBuilder builder)
        {
            bool isSolution = test is SolutionFolderTestGroup;

            if (!isSolution && ContainsSingleUnitTestGroup(test))
            {
                var unitTestGroup = test.Tests[0] as UnitTestGroup;
                BuildChildNodes(unitTestGroup, builder);
                return;
            }
            builder.AddChildren(test.Tests);
        }
示例#4
0
        void BuildChildNodes(UnitTestGroup test, ITreeBuilder builder)
        {
            var  combineTestNamespaces = builder.Options ["CombineTestNamespaces"];
            bool isSolution            = test is SolutionFolderTestGroup;

            if (!isSolution && ContainsUnitTestCanMerge(test) && combineTestNamespaces)
            {
                var unitTestGroup = test.Tests[0] as UnitTestGroup;
                BuildChildNodes(unitTestGroup, builder);
                return;
            }
            builder.AddChildren(test.Tests);
        }
示例#5
0
        public override void BuildChildNodes(ITreeBuilder builder, object dataObject)
        {
            UnitTestGroup test = dataObject as UnitTestGroup;

            if (test == null)
            {
                return;
            }

            foreach (UnitTest t in test.Tests)
            {
                builder.AddChild(t);
            }
        }
示例#6
0
        public override void BuildChildNodes(ITreeBuilder builder, object dataObject)
        {
            UnitTestGroup test = dataObject as UnitTestGroup;

            if (test == null)
            {
                return;
            }

            if (ContainsSingleUnitTestGroup(test))
            {
                BuildChildNodes(test, builder);
                return;
            }
            builder.AddChildren(test.Tests);
        }
        public static void ResetResult(UnitTest test)
        {
            if (test == null)
            {
                return;
            }
            test.ResetLastResult();
            UnitTestGroup group = test as UnitTestGroup;

            if (group == null)
            {
                return;
            }
            foreach (UnitTest t in new List <UnitTest> (group.Tests))
            {
                ResetResult(t);
            }
        }
 public static UnitTest FindRootTest(IEnumerable <UnitTest> tests, WorkspaceObject item)
 {
     foreach (UnitTest t in tests)
     {
         if (t.OwnerObject == item)
         {
             return(t);
         }
         UnitTestGroup tg = t as UnitTestGroup;
         if (tg != null)
         {
             UnitTest ct = FindRootTest(tg.Tests, item);
             if (ct != null)
             {
                 return(ct);
             }
         }
     }
     return(null);
 }
示例#9
0
        static string GetSuffix(UnitTestGroup unitTestGroup)
        {
            var stringBuilder = new StringBuilder();

            while (unitTestGroup != null)
            {
                if (ContainsSingleUnitTestGroup(unitTestGroup) && !(unitTestGroup is SolutionFolderTestGroup))
                {
                    var testCollection       = unitTestGroup.Tests;
                    var singleChildTestGroup = testCollection [0] as UnitTestGroup;
                    stringBuilder.Append(".")
                    .Append(singleChildTestGroup.Title);
                    unitTestGroup = singleChildTestGroup;
                }
                else
                {
                    unitTestGroup = null;
                }
            }
            return(stringBuilder.ToString());
        }
示例#10
0
        public override bool HasChildNodes(ITreeBuilder builder, object dataObject)
        {
            UnitTestGroup test = dataObject as UnitTestGroup;

            return(test != null && test.Tests.Count > 0);
        }
示例#11
0
        void FillTestInformation()
        {
            if (!detailsPad.Visible)
            {
                return;
            }

            if (detailsTest is UnitTestGroup)
            {
                UnitTestGroup group = detailsTest as UnitTestGroup;
                if (infoBook.Page == TestSummaryPage)
                {
                    detailsStore.Clear();
                    foreach (UnitTest t in group.Tests)
                    {
                        UnitTestResult res = t.Results.GetLastResult(chart.CurrentDate);
                        if (res != null)
                        {
                            detailsStore.AppendValues(t, t.Name, res.Passed.ToString(), res.ErrorsAndFailures.ToString(), res.Ignored.ToString());
                        }
                        else
                        {
                            detailsStore.AppendValues(t, t.Name, "", "", "");
                        }
                    }
                }
                else if (infoBook.Page == TestRegressionsPage)
                {
                    regressionStore.Clear();
                    UnitTestCollection regs = detailsTest.GetRegressions(chart.ReferenceDate, chart.CurrentDate);
                    if (regs.Count > 0)
                    {
                        foreach (UnitTest t in regs)
                        {
                            regressionStore.AppendValues(t, t.Name, TestStatusIcon.Failure);
                        }
                    }
                    else
                    {
                        regressionStore.AppendValues(null, GettextCatalog.GetString("No regressions found."));
                    }
                }
                else if (infoBook.Page == TestFailuresPage)
                {
                    failedStore.Clear();
                    UnitTestCollection regs = group.GetFailedTests(chart.CurrentDate);
                    if (regs.Count > 0)
                    {
                        foreach (UnitTest t in regs)
                        {
                            failedStore.AppendValues(t, t.Name, TestStatusIcon.Failure);
                        }
                    }
                    else
                    {
                        failedStore.AppendValues(null, GettextCatalog.GetString("No failed tests found."));
                    }
                }
            }
            else
            {
                UnitTestResult res = detailsTest.Results.GetLastResult(chart.CurrentDate);
                if (infoBook.Page == TestOutputPage)
                {
                    outputView.Buffer.Clear();
                    if (res != null)
                    {
                        outputView.Buffer.InsertAtCursor(res.ConsoleOutput);
                    }
                }
                else if (infoBook.Page == TestResultPage)
                {
                    resultView.Buffer.Clear();
                    if (res != null)
                    {
                        string msg = res.Message + "\n\n" + res.StackTrace;
                        resultView.Buffer.InsertAtCursor(msg);
                    }
                }
            }
        }
示例#12
0
 static bool ContainsSingleUnitTestGroup(UnitTestGroup test) =>
 test.Tests.Count == 1 && test.Tests[0] is UnitTestGroup;
示例#13
0
 internal UnitTestCollection(UnitTestGroup owner)
 {
     this.owner = owner;
 }
示例#14
0
 static bool ContainsUnitTestCanMerge(UnitTestGroup test) =>
 test.Tests.Count == 1 && test.Tests[0] is UnitTestGroup &&
 test.Tests [0].CanMergeWithParent;