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


C# EventListener.RunStarted方法代码示例

本文整理汇总了C#中EventListener.RunStarted方法的典型用法代码示例。如果您正苦于以下问题:C# EventListener.RunStarted方法的具体用法?C# EventListener.RunStarted怎么用?C# EventListener.RunStarted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EventListener的用法示例。


在下文中一共展示了EventListener.RunStarted方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Send

		public override void Send( EventListener listener )
		{
			listener.RunStarted(name, testCount);
		}
开发者ID:Phaiax,项目名称:dotnetautoupdate,代码行数:4,代码来源:EventQueue.cs

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

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


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