• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ITestResult类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ITestResult的典型用法代码示例。如果您正苦于以下问题:C# ITestResult类的具体用法?C# ITestResult怎么用?C# ITestResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ITestResult类属于命名空间,在下文中一共展示了ITestResult类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: TestFinished

        public void TestFinished(ITestResult result)
        {
#if PORTABLE
	        if(result.Test is TestMethod)
	        {
		        if(result.ResultState == ResultState.Inconclusive)
		        {
			        Console.ForegroundColor = ConsoleColor.Yellow;
		        }
		        else if(result.ResultState != ResultState.Success)
		        {
			        Console.ForegroundColor = ConsoleColor.Red;
		        }
		        else if(result.ResultState == ResultState.Success)
		        {
			        Console.ForegroundColor = ConsoleColor.Green;
		        }

		        Console.WriteLine(result.ResultState);

		        Console.ResetColor();
	        }
#else
			Events += string.Format(":{0}>", result.ResultState);
#endif
        }
开发者ID:xplatform,项目名称:Portable.NUnitLite,代码行数:26,代码来源:RecordingTestListener.cs


示例2: Visit

        private void Visit(ITestResult result)
        {
            if (result.Test is TestSuite)
            {
                foreach (ITestResult r in result.Children)
                    Visit(r);
            }
            else
            {
                testCount++;
                switch (result.ResultState.Status)
                {
                    case TestStatus.Skipped:
                        notRunCount++;
                        break;
                    case TestStatus.Failed:
                        if (result.ResultState == ResultState.Failure)
                            failureCount++;
                        else
                            errorCount++;
                        break;
                    default:
                        break;
                }

                return;
            }
        }
开发者ID:minhhh,项目名称:nunit-unity3d,代码行数:28,代码来源:ResultSummary.cs


示例3: WriteResultFile

 /// <summary>
 /// Writes a test result to a file
 /// </summary>
 /// <param name="result">The result to be written</param>
 /// <param name="outputPath">Path to the file to which the result is written</param>
 /// <param name="runSettings">A dictionary of settings used for this test run</param>
 public void WriteResultFile(ITestResult result, string outputPath, IDictionary runSettings, TestFilter filter)
 {
     using (StreamWriter writer = new StreamWriter(outputPath, false, Encoding.UTF8))
     {
         WriteResultFile(result, writer, runSettings, filter);
     }
 }
开发者ID:alfeg,项目名称:nunit,代码行数:13,代码来源:OutputWriter.cs


示例4: NewTestResultSummaryEventArgs

 public NewTestResultSummaryEventArgs(ITest test, ITestResult result, ITestOutcomeFilter outcomeFilter, ITestResultSummary summary)
 {
     Test = test;
     Result = result;
     OutcomeFilter = outcomeFilter;
     Summary = summary;
 }
开发者ID:slang25,项目名称:SimpleSpeedTester,代码行数:7,代码来源:NewTestResultSummaryEventArgs.cs


示例5: TestFinished

 public void TestFinished(ITestResult fullName)
 {
     foreach (var unitTestRunnerCallback in m_CallbackList)
     {
         unitTestRunnerCallback.TestFinished(fullName);
     }
 }
开发者ID:LostLT,项目名称:TestTools,代码行数:7,代码来源:TestRunnerCallbackList.cs


示例6: InitializeXmlFile

        private void InitializeXmlFile(ITestResult result)
        {
            xmlWriter.WriteStartDocument(false);

            // In order to match the format used by NUnit 3.0, we
            // wrap the entire result from the framework in a 
            // <test-run> element.
            xmlWriter.WriteStartElement("test-run");

            xmlWriter.WriteAttributeString("id", "2"); // TODO: Should not be hard-coded
            xmlWriter.WriteAttributeString("name", result.Name);
            xmlWriter.WriteAttributeString("fullname", result.FullName);
            xmlWriter.WriteAttributeString("testcasecount", result.Test.TestCaseCount.ToString());

            xmlWriter.WriteAttributeString("result", result.ResultState.Status.ToString());
            if (result.ResultState.Label != string.Empty) // && result.ResultState.Label != ResultState.Status.ToString())
                xmlWriter.WriteAttributeString("label", result.ResultState.Label);

            xmlWriter.WriteAttributeString("start-time", result.StartTime.ToString("u"));
            xmlWriter.WriteAttributeString("end-time", result.EndTime.ToString("u"));
            xmlWriter.WriteAttributeString("duration", result.Duration.ToString("0.000000", NumberFormatInfo.InvariantInfo));

            xmlWriter.WriteAttributeString("total", (result.PassCount + result.FailCount + result.SkipCount + result.InconclusiveCount).ToString());
            xmlWriter.WriteAttributeString("passed", result.PassCount.ToString());
            xmlWriter.WriteAttributeString("failed", result.FailCount.ToString());
            xmlWriter.WriteAttributeString("inconclusive", result.InconclusiveCount.ToString());
            xmlWriter.WriteAttributeString("skipped", result.SkipCount.ToString());
            xmlWriter.WriteAttributeString("asserts", result.AssertCount.ToString());

            xmlWriter.WriteAttributeString("random-seed", Randomizer.InitialSeed.ToString());

            WriteEnvironmentElement();
        }
开发者ID:JohanLarsson,项目名称:nunit,代码行数:33,代码来源:NUnit3XmlOutputWriter.cs


示例7: ResultViewModel

 public ResultViewModel(ITestResult result)
 {
     TestResult = result;
     Name = result.Name;
     Parent = result.Test.Parent.FullName;
     Message = result.Message;
 }
开发者ID:conceptdev,项目名称:nunit.runners,代码行数:7,代码来源:ResultViewModel.cs


示例8: WriteResultFile

 /// <summary>
 /// Writes a test result to a file
 /// </summary>
 /// <param name="result">The result to be written</param>
 /// <param name="outputPath">Path to the file to which the result is written</param>
 public void WriteResultFile(ITestResult result, string outputPath)
 {
     using (StreamWriter writer = new StreamWriter(outputPath, false, Encoding.UTF8))
     {
         WriteResultFile(result, writer);
     }
 }
开发者ID:balaghanta,项目名称:nunit-framework,代码行数:12,代码来源:OutputWriter.cs


示例9: InitializeXmlFile

        private void InitializeXmlFile(ITestResult result)
        {
            ResultSummary summary = new ResultSummary(result);

            xmlWriter.WriteStartDocument(false);
            xmlWriter.WriteComment("This file represents the results of running a test suite");

            xmlWriter.WriteStartElement("test-results");

            xmlWriter.WriteAttributeString("name", result.FullName);
            xmlWriter.WriteAttributeString("total", summary.TestCount.ToString());
            xmlWriter.WriteAttributeString("errors", summary.ErrorCount.ToString());
            xmlWriter.WriteAttributeString("failures", summary.FailureCount.ToString());
            var notRunTotal = summary.SkipCount + summary.FailureCount + summary.InvalidCount;
            xmlWriter.WriteAttributeString("not-run", notRunTotal.ToString());
            xmlWriter.WriteAttributeString("inconclusive", summary.InconclusiveCount.ToString());
            xmlWriter.WriteAttributeString("ignored", summary.IgnoreCount.ToString());
            xmlWriter.WriteAttributeString("skipped", summary.SkipCount.ToString());
            xmlWriter.WriteAttributeString("invalid", summary.InvalidCount.ToString());

            xmlWriter.WriteAttributeString("date", result.StartTime.ToString("yyyy-MM-dd"));
            xmlWriter.WriteAttributeString("time", result.StartTime.ToString("HH:mm:ss"));
            WriteEnvironment();
            WriteCultureInfo();
        }
开发者ID:nunit,项目名称:nunit,代码行数:25,代码来源:NUnit2XmlOutputWriter.cs


示例10: TestFinished

        /// <summary>
        /// Called when a test has finished
        /// </summary>
        /// <param name="result">The result of the test</param>
        public void TestFinished(ITestResult result)
        {
            string testName = result.Test.Name;

            if (result.Test.IsSuite)
                TC_TestSuiteFinished(testName);
            else
                switch (result.ResultState.Status)
                {
                    case TestStatus.Passed:
                        TC_TestFinished(testName, result.Duration);
                        break;
                    case TestStatus.Inconclusive:
                        TC_TestIgnored(testName, "Inconclusive");
                        break;
                    case TestStatus.Skipped:
                        TC_TestIgnored(testName, result.Message);
                        break;
                    case TestStatus.Warning:
                        // TODO: No action at this time. May need to be added.
                        break;
                    case TestStatus.Failed:
                        TC_TestFailed(testName, result.Message, result.StackTrace);
                        TC_TestFinished(testName, result.Duration);
                        break;
                }
        }
开发者ID:nunit,项目名称:nunit,代码行数:31,代码来源:TeamCityEventListener.cs


示例11: Invoke

 public override void Invoke(object[] parameters, ITestResult result)
 {
     var x = Invoke(parameters);
     if(ReturnType == typeof(void) || expectedResult.Matches(x))
         result.Success();
     else result.TestFailure(new Exception("\n" + string.Format(ExpectMessages.EqualFormat, x, expectedResult)));
 }
开发者ID:drunkcod,项目名称:Cone,代码行数:7,代码来源:ValueResultTestMethod.cs


示例12: WriteResultFile

        /// <summary>
        /// Write the result of a test run according to a spec.
        /// </summary>
        /// <param name="result">The test result</param>
        /// <param name="spec">An output specification</param>
        public void WriteResultFile(ITestResult result, OutputSpecification spec, IDictionary runSettings, TestFilter filter)
        {
            string outputPath = Path.Combine(_workDirectory, spec.OutputPath);
            OutputWriter outputWriter = null;

            switch (spec.Format)
            {
                case "nunit3":
                    outputWriter = new NUnit3XmlOutputWriter();
                    break;

                case "nunit2":
                    outputWriter = new NUnit2XmlOutputWriter();
                    break;

                //case "user":
                //    Uri uri = new Uri(Assembly.GetExecutingAssembly().CodeBase);
                //    string dir = Path.GetDirectoryName(uri.LocalPath);
                //    outputWriter = new XmlTransformOutputWriter(Path.Combine(dir, spec.Transform));
                //    break;

                default:
                    throw new ArgumentException(
                        string.Format("Invalid XML output format '{0}'", spec.Format),
                        "spec");
            }

            outputWriter.WriteResultFile(result, outputPath, runSettings, filter);
            Console.WriteLine("Results ({0}) saved as {1}", spec.Format, outputPath);
        }
开发者ID:alfeg,项目名称:nunit,代码行数:35,代码来源:OutputManager.cs


示例13: ResultReporter

        /// <summary>
        /// Constructs an instance of ResultReporter
        /// </summary>
        /// <param name="result">The top-level result being reported</param>
        /// <param name="writer">A TextWriter to which the report is written</param>
        public ResultReporter(ITestResult result, TextWriter writer)
        {
            this.result = result;
            this.writer = writer;

            this.summary = new ResultSummary(this.result);
        }
开发者ID:mono,项目名称:NUnitLite,代码行数:12,代码来源:ResultReporter.cs


示例14: TestFinished

 public void TestFinished(ITestResult fullName)
 {
     foreach (ITestRunnerCallback callback in this.m_CallbackList)
     {
         callback.TestFinished(fullName);
     }
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:7,代码来源:TestRunnerCallbackList.cs


示例15: WriteResultFile

 /// <summary>
 /// Writes the result of a test run to a specified TextWriter.
 /// </summary>
 /// <param name="result">The test result for the run</param>
 /// <param name="writer">The TextWriter to which the xml will be written</param>
 /// <param name="runSettings"></param>
 /// <param name="filter"></param>
 public override void WriteResultFile(ITestResult result, TextWriter writer, IDictionary<string, object> runSettings, TestFilter filter)
 {
     var settings = new XmlWriterSettings { Indent = true };
     using (var xmlWriter = XmlWriter.Create(writer, settings))
     {
         WriteXmlOutput(result, xmlWriter);
     }
 }
开发者ID:nunit,项目名称:nunit,代码行数:15,代码来源:NUnit2XmlOutputWriter.cs


示例16: WriteResultFile

 /// <summary>
 /// Writes a test result to a file
 /// </summary>
 /// <param name="result">The result to be written</param>
 /// <param name="outputPath">Path to the file to which the result is written</param>
 /// <param name="runSettings">A dictionary of settings used for this test run</param>
 public void WriteResultFile(ITestResult result, string outputPath, IDictionary<string, object> runSettings, TestFilter filter)
 {
     using (var stream = new FileStream(outputPath, FileMode.Create))
     using (var writer = new StreamWriter(stream, Encoding.UTF8))
     {
         WriteResultFile(result, writer, runSettings, filter);
     }
 }
开发者ID:nunit,项目名称:nunit,代码行数:14,代码来源:OutputWriter.cs


示例17: ResultViewModel

 public ResultViewModel(ITestResult result)
 {
     TestResult = result;
     Result = result.ResultState.Status.ToString().ToUpperInvariant();
     Name = result.Name;
     Parent = result.Test.Parent.FullName;
     Message = result.Message;
 }
开发者ID:moritzh,项目名称:nunit.xamarin,代码行数:8,代码来源:ResultViewModel.cs


示例18: Update

 public void Update(ITestResult source, bool outdated) {
     this.ResultState = source.ResultState;
     this.Duration = source.Duration;
     this.Message = source.Message;
     this.StackTrace = source.StackTrace;
     this.Executed = source.Executed;
     this.Outdated = outdated;
 }
开发者ID:675492062,项目名称:behaviac,代码行数:8,代码来源:UnitTestResult.cs


示例19: After

 void After(ITestResult result)
 {
     try {
         EachInterceptor(x => x.After(result));
     } catch(Exception ex) {
         result.AfterFailure(ex);
     }
 }
开发者ID:drunkcod,项目名称:Cone,代码行数:8,代码来源:TestExecutionContext.cs


示例20: TextValidationSerializer

 public TextValidationSerializer(
     IValidationRuleset ruleset,
     ITestResult[] testResults) :
     this()
 {
     Ruleset = ruleset;
     TestResults = testResults;
 }
开发者ID:xxjeng,项目名称:nuxleus,代码行数:8,代码来源:TextValidationSerializer.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ITestResults类代码示例发布时间:2022-05-24
下一篇:
C# ITestOutputHelper类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap