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


C# ITestListener.TestFinished方法代码示例

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


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

示例1: Run

        public TestResult Run(ITestListener listener)
        {
            listener.TestStarted(this);

            TestResult result = new TestResult(this);
            Run(result, listener);

            listener.TestFinished(result);

            return result;
        }
开发者ID:skela,项目名称:NUnitLite.MonoDroid,代码行数:11,代码来源:TestCase.cs

示例2: Run

        private TestRunState Run( ITestListener testListener, Runner runner, TestFilter filter)
        {
            var state = TestRunState.NoTests;

                     runner.RunAll(result =>{

                            testListener.TestFinished( new TestResult()
                                                                    {
                                                                        Name = String.Format("{0}.{1}",result.Test.Fixture.Name, result.Test.Name),
                                                                        FixtureType = ((Fixture)result.Test.Fixture).Type,
                                                                        StackTrace = result.Output,
                                                                        Method = ((Test)result.Test).Method,
                                                                        State = StateForResult(result.Kind),
                                                                        TimeSpan = result.EndTime - result.StartTime,
                                                                    });

                                    if(state == TestRunState.NoTests){
                                        switch (result.Kind)
                                        {
                                            case ResultKind.Fail:
                                                state = TestRunState.Failure;
                                                break;
                                            case ResultKind.Error:
                                                state = TestRunState.Error;
                                                break;
                                            default:
                                                state = TestRunState.Success;
                                                break;
                                        }
                                    } else if(state == TestRunState.Success || state == TestRunState.Failure){
                                        switch (result.Kind)
                                        {
                                            case ResultKind.Fail:
                                                state = TestRunState.Failure;
                                                break;
                                            case ResultKind.Error:
                                                state = TestRunState.Error;
                                                break;
                                        }
                                    }

                     }, filter);
            return state;
        }
开发者ID:jbtule,项目名称:PclUnit,代码行数:44,代码来源:PclUnitRunner.cs

示例3: Send

 /// <summary>
 /// Calls TestFinished on the specified listener.
 /// </summary>
 /// <param name="listener">The listener.</param>
 public override void Send(ITestListener listener)
 {
     listener.TestFinished(_result);
 }
开发者ID:ChrisMaddock,项目名称:nunit,代码行数:8,代码来源:EventQueue.cs

示例4: Run

        public TestResult Run(ITestListener listener)
        {
            int count = 0, failures = 0, errors = 0;
            listener.TestStarted(this);
            TestResult result = new TestResult(this);

            switch (this.RunState)
            {
                case RunState.NotRunnable:
                    result.Error(this.IgnoreReason);
                    break;

                case RunState.Ignored:
                    result.NotRun(this.IgnoreReason);
                    break;

                case RunState.Runnable:
                    foreach (ITest test in tests)
                    {
                        ++count;
                        TestResult r = test.Run(listener);
                        result.AddResult(r);
                        switch (r.ResultState)
                        {
                            case ResultState.Error:
                                ++errors;
                                break;
                            case ResultState.Failure:
                                ++failures;
                                break;
                            default:
                                break;
                        }
                    }

                    if (count == 0)
                        result.NotRun("Class has no tests");
                    else if (errors > 0 || failures > 0)
                        result.Failure("One or more component tests failed");
                    else
                        result.Success();
                    break;
            }

            listener.TestFinished(result);
            return result;
        }
开发者ID:skela,项目名称:NUnitLite.MonoDroid,代码行数:47,代码来源:TestSuite.cs


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