diff --git a/Nuclex.Support (net-4.0).csproj b/Nuclex.Support (net-4.0).csproj index 9378f3d..14255fb 100644 --- a/Nuclex.Support (net-4.0).csproj +++ b/Nuclex.Support (net-4.0).csproj @@ -214,8 +214,7 @@ LicenseKey.cs - - + CommandLine.cs @@ -225,10 +224,13 @@ CommandLine.cs - CommandLine.cs + + + ParallelBackgroundWorker.cs + ParserHelper.cs diff --git a/Source/ParallelBackgroundWorker.Test.cs b/Source/ParallelBackgroundWorker.Test.cs index f8835e1..f1c56a7 100644 --- a/Source/ParallelBackgroundWorker.Test.cs +++ b/Source/ParallelBackgroundWorker.Test.cs @@ -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 { /// Unit Test for the parallel background worker class [TestFixture] - public class ParallelBackgroundWorkerTest { + internal class ParallelBackgroundWorkerTest { + #region class TestWorker + + /// Implementation of a background worker used for unit testing private class TestWorker : ParallelBackgroundWorker { /// Initializes a new parallel background worker with unlimited threads @@ -51,14 +53,14 @@ namespace Nuclex.Support { /// be created, so specifying -2 on a single-core system will still occupy /// the only core. /// - public TestWorker(int threadCount) : base(threadCount) {} + public TestWorker(int threadCount) : base(threadCount) { } /// /// Initializes a new parallel background worker that uses the specified name for /// its worker threads. /// /// Name that will be assigned to the worker threads - public TestWorker(string name) : base(name) {} + public TestWorker(string name) : base(name) { } /// /// Initializes a new parallel background worker that uses the specified name for @@ -97,13 +99,20 @@ namespace Nuclex.Support { } } + /// Whether the work tasks should throw exceptions public bool ThrowException; + /// Event that can be used to stop work tasks from completing public ManualResetEvent WaitEvent; + + /// Set by work tasks if they have been cancelled public bool WasCancelled; + /// Work tasks that have reached execution public ICollection Tasks; } + #endregion // class TestWorker + /// Verifies that the background worker has a default constructor [Test] public void CanBeDefaultConstructed() { @@ -196,7 +205,7 @@ namespace Nuclex.Support { testWorker.AddTask(new object()); testWorker.CancelRunningTasks(); - + waitEvent.Set(); Assert.IsTrue(testWorker.Wait(1000));