本文整理汇总了C#中EventListener.SuiteStarted方法的典型用法代码示例。如果您正苦于以下问题:C# EventListener.SuiteStarted方法的具体用法?C# EventListener.SuiteStarted怎么用?C# EventListener.SuiteStarted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventListener
的用法示例。
在下文中一共展示了EventListener.SuiteStarted方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Run
public override TestResult Run(EventListener listener, ITestFilter filter)
{
listener.SuiteStarted(this.TestName);
var suiteListener = new MuteSuiteListener(listener);
var fixtureResult = base.Run(suiteListener, TestFilter.Empty);
var testResult = fixtureResult.Results[0] as TestResult;
if (testResult != null)
{
if (testResult.IsFailure || testResult.IsError)
{
fixtureResult.SetResult(testResult.ResultState,
testResult.Message,
testResult.StackTrace);
}
if (testResult.IsSuccess)
{
fixtureResult.Success();
}
}
listener.SuiteFinished(fixtureResult);
return fixtureResult;
}
示例2: Run
public override TestResult Run(EventListener listener, ITestFilter filter)
{
using (new TestContext())
{
TestSuiteResult suiteResult = new TestSuiteResult(new TestInfo(this), TestName.Name);
listener.SuiteStarted(this.TestName);
long startTime = DateTime.Now.Ticks;
switch (this.RunState)
{
case RunState.Runnable:
case RunState.Explicit:
suiteResult.RunState = RunState.Executed;
DoOneTimeSetUp(suiteResult);
if (suiteResult.IsFailure)
MarkTestsFailed(Tests, suiteResult, listener, filter);
else
{
try
{
RunAllTests(suiteResult, listener, filter);
}
finally
{
DoOneTimeTearDown(suiteResult);
}
}
break;
case RunState.Skipped:
suiteResult.Skip(this.IgnoreReason);
MarkTestsNotRun(Tests, RunState.Skipped, IgnoreReason, suiteResult, listener, filter);
break;
default:
case RunState.Ignored:
case RunState.NotRunnable:
suiteResult.Ignore(this.IgnoreReason);
MarkTestsNotRun(Tests, RunState.Ignored, IgnoreReason, suiteResult, listener, filter);
break;
}
long stopTime = DateTime.Now.Ticks;
double time = ((double)(stopTime - startTime)) / (double)TimeSpan.TicksPerSecond;
suiteResult.Time = time;
listener.SuiteFinished(suiteResult);
return suiteResult;
}
}
示例3: MarkTestNotRun
private void MarkTestNotRun(
Test test, RunState runState, string ignoreReason, TestSuiteResult suiteResult, EventListener listener, ITestFilter filter)
{
if (test is TestSuite)
{
listener.SuiteStarted(test.TestName);
TestSuiteResult result = new TestSuiteResult( new TestInfo(test), test.TestName.FullName);
result.NotRun( runState, ignoreReason, null );
MarkTestsNotRun(test.Tests, runState, ignoreReason, suiteResult, listener, filter);
suiteResult.AddResult(result);
listener.SuiteFinished(result);
}
else
{
listener.TestStarted(test.TestName);
TestCaseResult result = new TestCaseResult( new TestInfo(test) );
result.NotRun( runState, ignoreReason, null );
suiteResult.AddResult(result);
listener.TestFinished(result);
}
}
示例4: MarkTestFailed
private void MarkTestFailed(
Test test, TestSuiteResult suiteResult, EventListener listener, ITestFilter filter)
{
if (test is TestSuite)
{
listener.SuiteStarted(test.TestName);
TestSuiteResult result = new TestSuiteResult( new TestInfo(test), test.TestName.FullName);
string msg = string.Format( "Parent SetUp failed in {0}", this.FixtureType.Name );
result.Failure(msg, null, FailureSite.Parent);
MarkTestsFailed(test.Tests, suiteResult, listener, filter);
suiteResult.AddResult(result);
listener.SuiteFinished(result);
}
else
{
listener.TestStarted(test.TestName);
TestCaseResult result = new TestCaseResult( new TestInfo(test) );
string msg = string.Format( "TestFixtureSetUp failed in {0}", this.FixtureType.Name );
result.Failure(msg, null, FailureSite.Parent);
suiteResult.AddResult(result);
listener.TestFinished(result);
}
}
示例5: Send
public override void Send( EventListener listener )
{
listener.SuiteStarted( this.suiteName );
}
示例6: Run
public override TestResult Run(EventListener listener, ITestFilter filter)
{
listener.SuiteStarted(this.TestName);
#if CLR_2_0 || CLR_4_0
long startTime = Stopwatch.GetTimestamp();
#else
long startTime = DateTime.Now.Ticks;
#endif
TestResult suiteResult = this.RunState == RunState.Runnable || this.RunState == RunState.Explicit
? RunSuiteInContext(listener, filter)
: SkipSuite(listener, filter);
#if CLR_2_0 || CLR_4_0
long stopTime = Stopwatch.GetTimestamp();
double time = ((double)(stopTime - startTime)) / (double)Stopwatch.Frequency;
#else
long stopTime = DateTime.Now.Ticks;
double time = ((double)(stopTime - startTime)) / (double)TimeSpan.TicksPerSecond;
#endif
suiteResult.Time = time;
listener.SuiteFinished(suiteResult);
return suiteResult;
}
示例7: Run
public override TestResult Run(EventListener listener, ITestFilter filter)
{
using( new TestContext() )
{
TestResult suiteResult = new TestResult( this );
listener.SuiteStarted( this.TestName );
long startTime = DateTime.Now.Ticks;
switch (this.RunState)
{
case RunState.Runnable:
case RunState.Explicit:
if (RequiresThread || ApartmentState != GetCurrentApartment())
new TestSuiteThread(this).Run(suiteResult, listener, filter);
else
Run(suiteResult, listener, filter);
break;
default:
case RunState.Skipped:
SkipAllTests(suiteResult, listener, filter);
break;
case RunState.NotRunnable:
MarkAllTestsInvalid( suiteResult, listener, filter);
break;
case RunState.Ignored:
IgnoreAllTests(suiteResult, listener, filter);
break;
}
long stopTime = DateTime.Now.Ticks;
double time = ((double)(stopTime - startTime)) / (double)TimeSpan.TicksPerSecond;
suiteResult.Time = time;
listener.SuiteFinished(suiteResult);
return suiteResult;
}
}
示例8: Run
public override TestResult Run(EventListener listener, ITestFilter filter)
{
listener.SuiteStarted(TestName);
var result = new TestResult(this);
try {
ITestResult resultAdapter = new NUnitTestResultAdapter(result);
fixture.WithInitialized(_ => {
foreach(var item in Tests.Cast<Test>().Where(filter.Pass).Select(x => x.Run(listener, filter)))
result.AddResult(item);
}, ex => {
resultAdapter.BeforeFailure(ex);
foreach(Test item in Tests) {
var failure = new TestResult(item);
listener.TestStarted(item.TestName);
failure.Error(ex, FailureSite.SetUp);
listener.TestFinished(failure);
result.AddResult(failure);
}
}, resultAdapter.AfterFailure);
} finally {
listener.SuiteFinished(result);
}
return result;
}
示例9: Run
public override TestResult Run(EventListener listener, ITestFilter filter)
{
listener.SuiteStarted(this.TestName);
long startTime = DateTime.Now.Ticks;
TestResult suiteResult = this.RunState == RunState.Runnable || this.RunState == RunState.Explicit
? RunSuiteInContext(listener, filter)
: SkipSuite(listener, filter);
long stopTime = DateTime.Now.Ticks;
double time = ((double)(stopTime - startTime)) / (double)TimeSpan.TicksPerSecond;
suiteResult.Time = time;
listener.SuiteFinished(suiteResult);
return suiteResult;
}
示例10: Run
public override TestResult Run(EventListener listener, IFilter filter)
{
TestSuiteResult suiteResult = new TestSuiteResult(this, Name);
listener.SuiteStarted(this);
long startTime = DateTime.Now.Ticks;
if ( ShouldRun )
{
suiteResult.Executed = true;
DoSetUp( suiteResult );
RunAllTests( suiteResult, listener, filter );
DoTearDown( suiteResult );
}
else
suiteResult.NotRun(this.IgnoreReason);
long stopTime = DateTime.Now.Ticks;
double time = ((double)(stopTime - startTime)) / (double)TimeSpan.TicksPerSecond;
suiteResult.Time = time;
listener.SuiteFinished(suiteResult);
return suiteResult;
}