当前位置: 首页>>代码示例>>C#>>正文


C# TestResult.FindDescedant方法代码示例

本文整理汇总了C#中NUnit.Core.TestResult.FindDescedant方法的典型用法代码示例。如果您正苦于以下问题:C# TestResult.FindDescedant方法的具体用法?C# TestResult.FindDescedant怎么用?C# TestResult.FindDescedant使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NUnit.Core.TestResult的用法示例。


在下文中一共展示了TestResult.FindDescedant方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MergeChildren

        private void MergeChildren(TestResult other, TestResult merged)
        {
            if (other.Results == null)
                return;

            foreach (TestResult otherChild in other.Results)
            {
                var mergedChild = merged.FindDescedant(
                    d =>
                        {
                            if (otherChild.Test.TestType == TestType.Assembly.ToString()
                                && d.Test.TestType == TestType.Assembly.ToString())
                                return Path.GetFileName(d.FullName).Equals(Path.GetFileName(otherChild.FullName));
                            return d.FullName.Equals(otherChild.FullName);
                        });
                if (mergedChild == null)
                {
                    AddResult(merged, otherChild);
                    continue;
                }
                Merge(otherChild, mergedChild);
            }
        }
开发者ID:ayezutov,项目名称:NDistribUnit,代码行数:23,代码来源:TestResultsProcessor.cs

示例2: AddForReprocessingIfRequired

        /// <summary>
        /// Adds for reprocessing if required.
        /// </summary>
        /// <param name="test">The test.</param>
        /// <param name="result">The result.</param>
        /// <param name="agent"> </param>
        public void AddForReprocessingIfRequired(TestUnitWithMetadata test, TestResult result, AgentMetadata agent)
        {
            var request = requests != null ? requests.GetBy(test.Test.Run) : null;
            Action registerReprocessing = () => { if (request != null) request.Statistics.RegisterReprocessing(); };

            if (result == null)
            {
                test.AttachedData.NullReprocessingCount++;
                collection.Add(test);
                log.Info(string.Format("REPROCESSING (as null): '{0}' was added for reprocessing. [{1}]",
                   test.FullName, test.Test.Run));
                registerReprocessing();
                return;
            }

            if (!test.Test.Info.IsSuite)
            {
                var childResult = result.FindDescedant(d => d.FullName.Equals(test.FullName));
                if (childResult != null
                    && ProcessResult(childResult, test.Test.Run, test) == ReprocessingVerdict.PerformReprocessing)
                {
                    AddTestForReprocessing(test, agent);
                    registerReprocessing();
                }
                return;
            }

            foreach (var suiteResult in result.FindBottomLevelTestSuites())
            {
                if (test.FullName.Equals(suiteResult.FullName))
                {
                    var reprocessingVerdict = ProcessResult(suiteResult, test.Test.Run, test);
                    if (reprocessingVerdict == ReprocessingVerdict.MaximumCountWasReached)
                        return;

                    if (reprocessingVerdict == ReprocessingVerdict.PerformReprocessing)
                    {
                        AddTestForReprocessing(test, agent);
                        registerReprocessing();
                        continue;
                    }
                }

                var childrenForReprocessing = new List<Tuple<TestResult, TestUnitWithMetadata>>();
                foreach (TestResult childResult in suiteResult.Results)
                {
                    var childTest = test.Children.FirstOrDefault(ct => ct.FullName.Equals(childResult.FullName));
                    if (ProcessResult(childResult, test.Test.Run, childTest,
                        () =>
                            {
                                childTest = new TestUnitWithMetadata(test.Test.Run, childResult.Test, test.Test.AssemblyName);
                                test.Children.Add(childTest);
                                return childTest;
                            })==ReprocessingVerdict.PerformReprocessing)

                        childrenForReprocessing.Add(new Tuple<TestResult, TestUnitWithMetadata>(childResult, childTest));
                }

                if (childrenForReprocessing.Count > 0 && childrenForReprocessing.Count == suiteResult.Results.Count)
                {
                    AddTestForReprocessing(test, agent);
                    registerReprocessing();
                }
                else
                {
                    foreach (var childForReprocessing in childrenForReprocessing)
                    {
                        AddTestForReprocessing(childForReprocessing.Item2, agent);
                        registerReprocessing();
                    }
                }
            }
        }
开发者ID:ayezutov,项目名称:NDistribUnit,代码行数:79,代码来源:TestReprocessor.cs


注:本文中的NUnit.Core.TestResult.FindDescedant方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。