本文整理汇总了C#中EventListener.TestStarted方法的典型用法代码示例。如果您正苦于以下问题:C# EventListener.TestStarted方法的具体用法?C# EventListener.TestStarted怎么用?C# EventListener.TestStarted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventListener
的用法示例。
在下文中一共展示了EventListener.TestStarted方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RunTest
TestResult RunTest(EventListener listener)
{
listener.TestStarted(base.TestName);
TestResult nunitTestResult = new TestResult(this);
if (_pendingException != null)
{
nunitTestResult.Failure(_pendingException.Message, _pendingException.StackTrace, FailureSite.Test);
}
else if (RunState == RunState.NotRunnable)
{
nunitTestResult.SetResult(ResultState.NotRunnable, IgnoreReason, "", FailureSite.Test);
}
else
{
var testResult = SpecificationRunner.RunTest(this._testContext, new List<string>());
NativeTestResult.ApplyToNunitResult(testResult, nunitTestResult);
}
listener.TestFinished(nunitTestResult);
return nunitTestResult;
}
示例2: Run
public override TestResult Run(EventListener listener, ITestFilter filter)
{
listener.TestStarted(base.TestName);
long ticks = DateTime.Now.Ticks;
TestResult testResult = new TestResult(this);
Exception existingError = null;
_globalSetup.PrepareForTestPosition(Position, out existingError);
if (existingError != null)
{
TestResultUtil.Error(testResult, existingError, null, FailureSite.SetUp);
}
else
{
List<string> traceMessages = null;
try
{
RunTestMethod(testResult, out traceMessages);
}
catch (Exception e)
{
var globalTraceMessages = _globalSetup.GetTraceMessages();
TestResultUtil.Error(testResult, e, globalTraceMessages.Concat(traceMessages));
}
}
double num3 = ((double)(DateTime.Now.Ticks - ticks)) / 10000000.0;
testResult.Time = num3;
listener.TestFinished(testResult);
return testResult;
}
示例3: Run
public override TestResult Run( EventListener listener )
{
using( new TestContext() )
{
TestCaseResult testResult = MakeTestCaseResult();
listener.TestStarted( this.TestName );
long startTime = DateTime.Now.Ticks;
switch (this.RunState)
{
case RunState.Runnable:
case RunState.Explicit:
Run(testResult);
break;
case RunState.Skipped:
testResult.Skip(IgnoreReason);
break;
default:
case RunState.NotRunnable:
case RunState.Ignored:
testResult.Ignore(IgnoreReason);
break;
}
long stopTime = DateTime.Now.Ticks;
double time = ((double)(stopTime - startTime)) / (double)TimeSpan.TicksPerSecond;
testResult.Time = time;
listener.TestFinished(testResult);
return testResult;
}
}
示例4: Run
public override TestResult Run(EventListener listener, ITestFilter filter)
{
using (new global::NUnit.Core.TestContext())
{
var testResult = new TestResult(this);
Log.Debug("Test Starting: " + TestName.FullName);
listener.TestStarted(TestName);
var stopwatch = new Stopwatch();
stopwatch.Start();
switch (RunState)
{
case RunState.Runnable:
case RunState.Explicit:
DoTest(_test, testResult);
break;
case RunState.NotRunnable:
testResult.Invalid(IgnoreReason);
break;
case RunState.Ignored:
testResult.Ignore(IgnoreReason);
break;
default:
testResult.Skip(IgnoreReason);
break;
}
stopwatch.Stop();
testResult.Time = stopwatch.Elapsed.Seconds;
listener.TestFinished(testResult);
return testResult;
}
}
示例5: Run
public override TestResult Run(EventListener listener, ITestFilter filter)
{
listener.TestStarted(base.TestName);
long ticks = DateTime.Now.Ticks;
var testResult = new TestResultShim();
Exception existingError = null;
_globalSetup.PrepareForTestPosition(Position, out existingError);
if (existingError != null)
{
TestResultUtil.Error(testResult, TestExtensions.GetMultilineName(this), existingError, null, TestResultShim.Site.SetUp);
}
else
{
List<string> traceMessages = null;
try
{
RunTestMethod(testResult, out traceMessages);
}
catch (Exception e)
{
var globalTraceMessages = _globalSetup.GetTraceMessages();
TestResultUtil.Error(testResult, TestExtensions.GetMultilineName(this), e, globalTraceMessages.Concat(traceMessages));
}
}
var nunitTestResult = new TestResult(this);
NativeTestResult.ApplyToNunitResult(testResult, nunitTestResult);
nunitTestResult.Time = ((DateTime.Now.Ticks - ticks)) / 10000000.0;
listener.TestFinished(nunitTestResult);
return nunitTestResult;
}
示例6: Run
public override TestResult Run(EventListener listener, ITestFilter filter)
{
listener.TestStarted(base.TestName);
long ticks = DateTime.Now.Ticks;
TestResult result = new TestResult(this);
result.SetResult(ResultState.NotRunnable, "Specification not implemented.", null, FailureSite.Test);
double num3 = ((double)(DateTime.Now.Ticks - ticks)) / 10000000.0;
result.Time = num3;
listener.TestFinished(result);
return result;
}
示例7: Run
public override TestResult Run(EventListener listener, ITestFilter filter)
{
listener.TestStarted(base.TestName);
long ticks = DateTime.Now.Ticks;
TestResult testResult = new TestResult(this);
testResult.Failure(_reason, _stackTrace);
double num3 = ((double)(DateTime.Now.Ticks - ticks)) / 10000000.0;
testResult.Time = num3;
listener.TestFinished(testResult);
return testResult;
}
示例8: Run
public override TestResult Run(EventListener listener, ITestFilter filter)
{
listener.TestStarted(this.TestName);
Fixture = Reflect.Construct(m_FixtureType);
RunFixtureSetUp();
var fixtureRunner = new FixtureRunner();
var concordionResult = fixtureRunner.Run(Fixture);
var testResult = NUnitTestResult(concordionResult, fixtureRunner.ResultPath);
RunFixtureTearDown();
listener.TestFinished(testResult);
return testResult;
}
示例9: Run
public override TestResult Run(EventListener listener, ITestFilter filter)
{
listener.TestStarted(TestName);
var source = new EmbeddedResourceSource(m_FixtureType.Assembly);
var target = new FileTarget(new SpecificationConfig().Load(m_FixtureType).BaseOutputDirectory);
var concordion = new ConcordionBuilder().WithSource(source).WithTarget(target).Build();
Fixture = Reflect.Construct(m_FixtureType);
var concordionResult = concordion.Process(Fixture);
var testResult = NUnitTestResult(concordionResult);
listener.TestFinished(testResult);
return testResult;
}
示例10: Run
public override TestResult Run(EventListener listener, ITestFilter filter)
{
listener.TestStarted(TestName);
Fixture = Reflect.Construct(m_FixtureType);
RunFixtureSetUp();
var testResult = NUnitTestResult(new FixtureRunner().Run(Fixture));
RunFixtureTearDown();
listener.TestFinished(testResult);
return testResult;
}
示例11: Run
public override TestResult Run(EventListener listener, ITestFilter filter)
{
var result = new TestResult(this);
switch(RunState){
case RunState.Runnable: testExecutor.Run(this,
new NUnitTestResultAdapter(result),
new TimedTestContext(
_ => listener.TestStarted(TestName),
(_, time) => {
result.Time = time.TotalSeconds;
listener.TestFinished(result);
}));
break;
case RunState.Explicit: goto case RunState.Runnable;
}
return result;
}
示例12: Run
public override TestResult Run( EventListener listener )
{
TestCaseResult testResult = new TestCaseResult(this);
listener.TestStarted(this);
long startTime = DateTime.Now.Ticks;
Run( testResult );
testResult.AssertCount = NUnit.Framework.Assert.Counter;
long stopTime = DateTime.Now.Ticks;
double time = ((double)(stopTime - startTime)) / (double)TimeSpan.TicksPerSecond;
testResult.Time = time;
listener.TestFinished(testResult);
return testResult;
}
示例13: Run
public override TestResult Run( EventListener listener )
{
using( new TestContext() )
{
TestCaseResult testResult = MakeTestCaseResult();
listener.TestStarted( this.TestName );
// The babysitter's enter/leave "listeners" specifically exist to track crashes,
// so unfortunately they can't work through the (asynchronous) listener interface.
bool willRun = this.RunState == RunState.Runnable || this.RunState == RunState.Explicit;
if (willRun)
BabysitterSupport.RecordEnterTest(this.TestName.FullName);
long startTime = DateTime.Now.Ticks;
switch (this.RunState)
{
case RunState.Runnable:
case RunState.Explicit:
Run(testResult);
break;
case RunState.Skipped:
testResult.Skip(IgnoreReason);
break;
default:
case RunState.NotRunnable:
case RunState.Ignored:
testResult.Ignore(IgnoreReason);
break;
}
long stopTime = DateTime.Now.Ticks;
if (willRun)
BabysitterSupport.RecordLeaveTest(this.TestName.FullName);
double time = ((double)(stopTime - startTime)) / (double)TimeSpan.TicksPerSecond;
testResult.Time = time;
listener.TestFinished(testResult);
return testResult;
}
}
示例14: Run
public override TestResult Run(EventListener listener, ITestFilter filter)
{
// TODO: Implement logic required for filtering.
listener.TestStarted(this.TestName);
long startTime = DateTime.Now.Ticks;
var result = new TestResult(this);
try
{
_engine.ExecuteScriptFile(_scriptPath);
result.Success();
}
catch (AssertionException assertEx)
{
result.SetResult(ResultState.Failure, assertEx.Message, assertEx.StackTrace, FailureSite.Test);
}
catch (InconclusiveException inconclusiveEx)
{
result.SetResult(ResultState.Inconclusive, inconclusiveEx.Message, inconclusiveEx.StackTrace);
}
catch (Exception ex)
{
result.Error(ex);
}
finally
{
long stopTime = DateTime.Now.Ticks;
double time = ((double)(stopTime - startTime)) / (double)TimeSpan.TicksPerSecond;
result.Time = time;
listener.TestFinished(result);
}
return result;
}
示例15: Run
public override TestResult Run(EventListener listener, ITestFilter filter)
{
listener.TestStarted(this.TestName);
Fixture = Reflect.Construct(m_FixtureType);
RunFixtureSetUp();
TestResult testResult;
try
{
var testRunner = new DefaultConcordionRunner();
var concordionResult = testRunner.Run(Fixture);
testResult = NUnitTestResult(concordionResult, "");
}
catch (Exception exception)
{
testResult = new TestResult(this);
testResult.Error(exception);
}
RunFixtureTearDown();
listener.TestFinished(testResult);
return testResult;
}