本文整理汇总了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;
}
示例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;
}
示例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);
}
示例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;
}