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:
Markus Ewald 2014-02-20 14:49:08 +00:00
parent feac2b9c89
commit a2b92248b5
2 changed files with 21 additions and 10 deletions

View File

@ -214,8 +214,7 @@
<Compile Include="Source\Licensing\LicenseKey.Test.cs"> <Compile Include="Source\Licensing\LicenseKey.Test.cs">
<DependentUpon>LicenseKey.cs</DependentUpon> <DependentUpon>LicenseKey.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Source\ParallelBackgroundWorker.cs" /> <Compile Include="Source\Parsing\CommandLine.cs" />
<Compile Include="Source\ParallelBackgroundWorker.Test.cs" />
<Compile Include="Source\Parsing\CommandLine.Argument.cs"> <Compile Include="Source\Parsing\CommandLine.Argument.cs">
<DependentUpon>CommandLine.cs</DependentUpon> <DependentUpon>CommandLine.cs</DependentUpon>
</Compile> </Compile>
@ -225,10 +224,13 @@
<Compile Include="Source\Parsing\CommandLine.Test.cs"> <Compile Include="Source\Parsing\CommandLine.Test.cs">
<DependentUpon>CommandLine.cs</DependentUpon> <DependentUpon>CommandLine.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Source\Parsing\CommandLine.cs" />
<Compile Include="Source\Parsing\CommandLine.Parser.cs"> <Compile Include="Source\Parsing\CommandLine.Parser.cs">
<DependentUpon>CommandLine.cs</DependentUpon> <DependentUpon>CommandLine.cs</DependentUpon>
</Compile> </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.cs" />
<Compile Include="Source\Parsing\ParserHelper.Test.cs"> <Compile Include="Source\Parsing\ParserHelper.Test.cs">
<DependentUpon>ParserHelper.cs</DependentUpon> <DependentUpon>ParserHelper.cs</DependentUpon>

View File

@ -19,20 +19,22 @@ License along with this library
#endregion #endregion
using System; using System;
using System.IO; using System.Threading;
using System.Collections.Generic;
#if UNITTEST #if UNITTEST
using NUnit.Framework; using NUnit.Framework;
using System.Threading;
using System.Collections.Generic;
namespace Nuclex.Support { namespace Nuclex.Support {
/// <summary>Unit Test for the parallel background worker class</summary> /// <summary>Unit Test for the parallel background worker class</summary>
[TestFixture] [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> { private class TestWorker : ParallelBackgroundWorker<object> {
/// <summary>Initializes a new parallel background worker with unlimited threads</summary> /// <summary>Initializes a new parallel background worker with unlimited threads</summary>
@ -97,13 +99,20 @@ namespace Nuclex.Support {
} }
} }
/// <summary>Whether the work tasks should throw exceptions</summary>
public bool ThrowException; public bool ThrowException;
/// <summary>Event that can be used to stop work tasks from completing</summary>
public ManualResetEvent WaitEvent; public ManualResetEvent WaitEvent;
/// <summary>Set by work tasks if they have been cancelled</summary>
public bool WasCancelled; public bool WasCancelled;
/// <summary>Work tasks that have reached execution</summary>
public ICollection<object> Tasks; public ICollection<object> Tasks;
} }
#endregion // class TestWorker
/// <summary>Verifies that the background worker has a default constructor</summary> /// <summary>Verifies that the background worker has a default constructor</summary>
[Test] [Test]
public void CanBeDefaultConstructed() { public void CanBeDefaultConstructed() {