Parallel background worker unit tests are now internal again; added missing comments; nested unit test files under the implementation files they are testing
git-svn-id: file:///srv/devel/repo-conversion/nusu@292 d2e56fa2-650e-0410-a79f-9358c0239efd
This commit is contained in:
		
							parent
							
								
									feac2b9c89
								
							
						
					
					
						commit
						a2b92248b5
					
				
					 2 changed files with 21 additions and 10 deletions
				
			
		| 
						 | 
				
			
			@ -214,8 +214,7 @@
 | 
			
		|||
    <Compile Include="Source\Licensing\LicenseKey.Test.cs">
 | 
			
		||||
      <DependentUpon>LicenseKey.cs</DependentUpon>
 | 
			
		||||
    </Compile>
 | 
			
		||||
    <Compile Include="Source\ParallelBackgroundWorker.cs" />
 | 
			
		||||
    <Compile Include="Source\ParallelBackgroundWorker.Test.cs" />
 | 
			
		||||
    <Compile Include="Source\Parsing\CommandLine.cs" />
 | 
			
		||||
    <Compile Include="Source\Parsing\CommandLine.Argument.cs">
 | 
			
		||||
      <DependentUpon>CommandLine.cs</DependentUpon>
 | 
			
		||||
    </Compile>
 | 
			
		||||
| 
						 | 
				
			
			@ -225,10 +224,13 @@
 | 
			
		|||
    <Compile Include="Source\Parsing\CommandLine.Test.cs">
 | 
			
		||||
      <DependentUpon>CommandLine.cs</DependentUpon>
 | 
			
		||||
    </Compile>
 | 
			
		||||
    <Compile Include="Source\Parsing\CommandLine.cs" />
 | 
			
		||||
    <Compile Include="Source\Parsing\CommandLine.Parser.cs">
 | 
			
		||||
      <DependentUpon>CommandLine.cs</DependentUpon>
 | 
			
		||||
    </Compile>
 | 
			
		||||
    <Compile Include="Source\ParallelBackgroundWorker.cs" />
 | 
			
		||||
    <Compile Include="Source\ParallelBackgroundWorker.Test.cs">
 | 
			
		||||
      <DependentUpon>ParallelBackgroundWorker.cs</DependentUpon>
 | 
			
		||||
    </Compile>
 | 
			
		||||
    <Compile Include="Source\Parsing\ParserHelper.cs" />
 | 
			
		||||
    <Compile Include="Source\Parsing\ParserHelper.Test.cs">
 | 
			
		||||
      <DependentUpon>ParserHelper.cs</DependentUpon>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,20 +19,22 @@ License along with this library
 | 
			
		|||
#endregion
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.IO;
 | 
			
		||||
using System.Threading;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
 | 
			
		||||
#if UNITTEST
 | 
			
		||||
 | 
			
		||||
using NUnit.Framework;
 | 
			
		||||
using System.Threading;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
 | 
			
		||||
namespace Nuclex.Support {
 | 
			
		||||
 | 
			
		||||
  /// <summary>Unit Test for the parallel background worker class</summary>
 | 
			
		||||
  [TestFixture]
 | 
			
		||||
  public class ParallelBackgroundWorkerTest {
 | 
			
		||||
  internal class ParallelBackgroundWorkerTest {
 | 
			
		||||
 | 
			
		||||
    #region class TestWorker
 | 
			
		||||
 | 
			
		||||
    /// <summary>Implementation of a background worker used for unit testing</summary>
 | 
			
		||||
    private class TestWorker : ParallelBackgroundWorker<object> {
 | 
			
		||||
 | 
			
		||||
      /// <summary>Initializes a new parallel background worker with unlimited threads</summary>
 | 
			
		||||
| 
						 | 
				
			
			@ -51,14 +53,14 @@ namespace Nuclex.Support {
 | 
			
		|||
      ///   be created, so specifying -2 on a single-core system will still occupy
 | 
			
		||||
      ///   the only core.
 | 
			
		||||
      /// </remarks>
 | 
			
		||||
      public TestWorker(int threadCount) : base(threadCount) {}
 | 
			
		||||
      public TestWorker(int threadCount) : base(threadCount) { }
 | 
			
		||||
 | 
			
		||||
      /// <summary>
 | 
			
		||||
      ///   Initializes a new parallel background worker that uses the specified name for
 | 
			
		||||
      ///   its worker threads.
 | 
			
		||||
      /// </summary>
 | 
			
		||||
      /// <param name="name">Name that will be assigned to the worker threads</param>
 | 
			
		||||
      public TestWorker(string name) : base(name) {}
 | 
			
		||||
      public TestWorker(string name) : base(name) { }
 | 
			
		||||
 | 
			
		||||
      /// <summary>
 | 
			
		||||
      ///   Initializes a new parallel background worker that uses the specified name for
 | 
			
		||||
| 
						 | 
				
			
			@ -97,13 +99,20 @@ namespace Nuclex.Support {
 | 
			
		|||
        }
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      /// <summary>Whether the work tasks should throw exceptions</summary>
 | 
			
		||||
      public bool ThrowException;
 | 
			
		||||
      /// <summary>Event that can be used to stop work tasks from completing</summary>
 | 
			
		||||
      public ManualResetEvent WaitEvent;
 | 
			
		||||
 | 
			
		||||
      /// <summary>Set by work tasks if they have been cancelled</summary>
 | 
			
		||||
      public bool WasCancelled;
 | 
			
		||||
      /// <summary>Work tasks that have reached execution</summary>
 | 
			
		||||
      public ICollection<object> Tasks;
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    #endregion // class TestWorker
 | 
			
		||||
 | 
			
		||||
    /// <summary>Verifies that the background worker has a default constructor</summary>
 | 
			
		||||
    [Test]
 | 
			
		||||
    public void CanBeDefaultConstructed() {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue