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


C# TestResult.SetAgentName方法代码示例

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


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

示例1: Merge

        /// <summary>
        /// Merges the specified other.
        /// </summary>
        /// <param name="source"> </param>
        /// <param name="target"> </param>
        public void Merge(TestResult source, TestResult target)
        {
            var mergedType = GetType(target);
            var otherType = GetType(source);

            if (mergedType == TestType.Project && otherType == TestType.Project)
            {
                if (string.IsNullOrEmpty(target.FullName) && !string.IsNullOrEmpty(source.FullName))
                {
                    target.Test.TestName.FullName = source.FullName;
                    target.Test.TestName.Name = source.Name;
                }
            }

            if (mergedType != otherType)
                throw new NotSupportedException("Only merging of results with same test type are supported");

            if (!target.IsSuccess && source.IsSuccess)
            {
                target.Success(source.Message);
                target.SetAgentName(source.GetAgentName());
            }

            MergeChildren(source, target);
        }
开发者ID:ayezutov,项目名称:NDistribUnit,代码行数:30,代码来源:TestResultsProcessor.cs

示例2: CreateTestResult

        public TestResult CreateTestResult(TestType type, string fullName,
                                           ResultState state = ResultState.Success, 
                                           Func<IEnumerable<TestResult>> children = null, 
                                           string stackTrace = null, 
                                           string description = null,
                                           IList categories = null,
                                           string agentName = null)
        {
            description = description ?? RandomValuesGenerator.GetRandomValue<string>();
            agentName = agentName ?? RandomValuesGenerator.GetRandomValue<string>();
            var splitted = (fullName ?? string.Empty).Split(new[]{'.'}, StringSplitOptions.RemoveEmptyEntries);

            var childResults = children != null ? children() : new TestResult[0];
            var testResult = new TestResult(new TestInfoWrapper
                                                {
                                                    TestName = new TestName
                                                                   {
                                                                       FullName = fullName,
                                                                       Name = splitted.Length > 0 ? splitted[splitted.Length - 1] : string.Empty
                                                                   },
                                                    Categories = categories,
                                                    IsSuite = type != TestType.TestMethod,
                                                    TestCount = type == TestType.TestMethod ? 1 : RandomValuesGenerator.GetRandomValue<int>(),
                                                    TestType = type.ToString()
                                                })
                                 {
                                     AssertCount = 1,
                                     Time = RandomValuesGenerator.GetRandomValue<double>()
                                 };
            if (state != ResultState.Success)
                testResult.SetResult(state,
                                     description,
                                     stackTrace);
            else
                testResult.Success(description);

            testResult.SetAgentName(agentName);

            foreach (var childResult in childResults)
            {
                testResult.AddResult(childResult);
            }

            return testResult;
        }
开发者ID:ayezutov,项目名称:NDistribUnit,代码行数:45,代码来源:TestEntitiesGenerator.cs


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