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


C# EventListener.TestStarted方法代码示例

本文整理汇总了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;
        }
开发者ID:edwardt,项目名称:DreamNJasmine,代码行数:25,代码来源:NJasmineTestMethod.cs

示例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;
        }
开发者ID:bfriesen,项目名称:DreamNJasmine,代码行数:33,代码来源:NJasmineTestMethod.cs

示例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;
			}
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:33,代码来源:TestCase.cs

示例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;
            }
        }
开发者ID:WalkingDisaster,项目名称:Lingual,代码行数:35,代码来源:LingualTest.cs

示例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;
        }
开发者ID:idavis,项目名称:DreamNJasmine,代码行数:34,代码来源:NJasmineTestMethod.cs

示例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;
 }
开发者ID:idavis,项目名称:DreamNJasmine,代码行数:11,代码来源:NJasmineUnimplementedTestMethod.cs

示例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;
 }
开发者ID:idavis,项目名称:DreamNJasmine,代码行数:11,代码来源:NJasmineInvalidTestSuite.cs

示例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;
        }
开发者ID:concordion,项目名称:concordion-net,代码行数:15,代码来源:ConcordionTest.cs

示例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;
        }
开发者ID:numbbrain4all,项目名称:concordion-net,代码行数:16,代码来源:ConcordionTest.cs

示例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;
        }
开发者ID:john-ross,项目名称:concordion-net,代码行数:16,代码来源:ConcordionTest.cs

示例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;
 }
开发者ID:kitofr,项目名称:Cone,代码行数:17,代码来源:AddinTest.cs

示例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;
		}
开发者ID:alesliehughes,项目名称:olive,代码行数:18,代码来源:TestCase.cs

示例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;
			}
		}
开发者ID:Profit0004,项目名称:mono,代码行数:44,代码来源:TestCase.cs

示例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;
        }
开发者ID:rablewis,项目名称:NuScript,代码行数:37,代码来源:ScriptTest.cs

示例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;
        }
开发者ID:concordion,项目名称:concordion.net,代码行数:24,代码来源:ConcordionTest.cs


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