本文整理汇总了C#中EventListener.RunFinished方法的典型用法代码示例。如果您正苦于以下问题:C# EventListener.RunFinished方法的具体用法?C# EventListener.RunFinished怎么用?C# EventListener.RunFinished使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventListener
的用法示例。
在下文中一共展示了EventListener.RunFinished方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Send
public override void Send( EventListener listener )
{
if ( this.exception != null )
listener.RunFinished( this.exception );
else
listener.RunFinished( this.result );
}
示例2: Run
public virtual TestResult Run( EventListener listener, ITestFilter filter )
{
try
{
// Take note of the fact that we are running
this.runThread = Thread.CurrentThread;
listener.RunStarted( this.Test.TestName.FullName, test.CountTestCases( filter ) );
testResult = test.Run( listener, filter );
// Signal that we are done
listener.RunFinished( testResult );
// Return result array
return testResult;
}
catch( Exception exception )
{
// Signal that we finished with an exception
listener.RunFinished( exception );
// Rethrow - should we do this?
throw;
}
finally
{
runThread = null;
}
}
示例3: Run
/// <summary>
/// Private method to run a set of tests. This routine is the workhorse
/// that is called anytime tests are run.
/// </summary>
private TestResult[] Run( EventListener listener, Test[] tests )
{
// Create buffered writers for efficiency
outBuffer = new BufferedStringTextWriter( outText );
errorBuffer = new BufferedStringTextWriter( errorText );
// Save previous state of Console. This is needed because Console.Out and
// Console.Error are static. In the case where the test itself calls this
// method, we can lose output if we don't save and restore their values.
// This is exactly what happens when we are testing NUnit itself.
saveOut = Console.Out;
saveError = Console.Error;
// Set Console to go to our buffers. Note that any changes made by
// the user in the test code or the code it calls will defeat this.
Console.SetOut( outBuffer );
Console.SetError( errorBuffer );
// Save the current directory so we can run each test in
// the same directory as its assembly
currentDirectory = Environment.CurrentDirectory;
try
{
// Create an array for the resuls
results = new TestResult[ tests.Length ];
// Signal that we are starting the run
this.listener = listener;
listener.RunStarted( tests );
// TODO: Get rid of count
int count = 0;
foreach( Test test in tests )
count += filter == null ? test.CountTestCases() : test.CountTestCases( filter );
events.FireRunStarting( tests, count );
// Run each test, saving the results
int index = 0;
foreach( Test test in tests )
{
string assemblyDirectory = Path.GetDirectoryName( this.assemblies[test.AssemblyKey] );
if ( assemblyDirectory != null && assemblyDirectory != string.Empty )
Environment.CurrentDirectory = assemblyDirectory;
results[index++] = test.Run( this, filter );
}
// Signal that we are done
listener.RunFinished( results );
events.FireRunFinished( results );
// Return result array
return results;
}
catch( Exception exception )
{
// Signal that we finished with an exception
listener.RunFinished( exception );
events.FireRunFinished( exception );
// Rethrow - should we do this?
throw;
}
finally
{
CleanUpAfterTestRun();
}
}
示例4: Send
public override void Send( EventListener listener )
{
if ( this.exception != null )
{
try
{
listener.RunFinished( this.exception );
}
catch (SerializationException)
{
Exception wrapped = WrapUnserializableException(this.exception);
listener.RunFinished(wrapped);
}
}
else
listener.RunFinished( this.result );
}