Used pragmas to avoid warnings in unit tests designed to test obsolete methods; method thread-related classes into a new namespace, 'Threading'

git-svn-id: file:///srv/devel/repo-conversion/nusu@331 d2e56fa2-650e-0410-a79f-9358c0239efd
This commit is contained in:
Markus Ewald 2019-02-01 19:54:28 +00:00
parent a934fb155e
commit e6e0220fb3
7 changed files with 32 additions and 22 deletions

View File

@ -251,10 +251,6 @@
<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>
@ -263,10 +259,6 @@
<Compile Include="Source\PropertyChangedEventArgsHelper.Test.cs"> <Compile Include="Source\PropertyChangedEventArgsHelper.Test.cs">
<DependentUpon>PropertyChangedEventArgsHelper.cs</DependentUpon> <DependentUpon>PropertyChangedEventArgsHelper.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Source\AffineThreadPool.cs" />
<Compile Include="Source\AffineThreadPool.Test.cs">
<DependentUpon>AffineThreadPool.cs</DependentUpon>
</Compile>
<Compile Include="Source\EnumHelper.cs" /> <Compile Include="Source\EnumHelper.cs" />
<Compile Include="Source\EnumHelper.Test.cs"> <Compile Include="Source\EnumHelper.Test.cs">
<DependentUpon>EnumHelper.cs</DependentUpon> <DependentUpon>EnumHelper.cs</DependentUpon>
@ -279,6 +271,14 @@
<Compile Include="Source\ObservableHelper.Test.cs"> <Compile Include="Source\ObservableHelper.Test.cs">
<DependentUpon>ObservableHelper.cs</DependentUpon> <DependentUpon>ObservableHelper.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Source\Threading\AffineThreadPool.cs" />
<Compile Include="Source\Threading\AffineThreadPool.Test.cs">
<DependentUpon>AffineThreadPool.cs</DependentUpon>
</Compile>
<Compile Include="Source\Threading\ParallelBackgroundWorker.cs" />
<Compile Include="Source\Threading\ParallelBackgroundWorker.Test.cs">
<DependentUpon>ParallelBackgroundWorker.cs</DependentUpon>
</Compile>
<Compile Include="Source\TypeHelper.cs" /> <Compile Include="Source\TypeHelper.cs" />
<Compile Include="Source\TypeHelper.Test.cs"> <Compile Include="Source\TypeHelper.Test.cs">
<DependentUpon>TypeHelper.cs</DependentUpon> <DependentUpon>TypeHelper.cs</DependentUpon>

View File

@ -47,7 +47,9 @@ namespace Nuclex.Support {
/// <summary>Fires the property changed event for the 'SomePropety' property</summary> /// <summary>Fires the property changed event for the 'SomePropety' property</summary>
public void FireSomePropertyChanged() { public void FireSomePropertyChanged() {
#pragma warning disable 0618
OnPropertyChanged(() => SomeProperty); OnPropertyChanged(() => SomeProperty);
#pragma warning restore 0618
} }
/// <summary>Example property that will be reported to have changed</summary> /// <summary>Example property that will be reported to have changed</summary>

View File

@ -50,7 +50,9 @@ namespace Nuclex.Support {
[Test] [Test]
public void MatchingPropertyChangeNotificationIsRecognized() { public void MatchingPropertyChangeNotificationIsRecognized() {
var arguments = new PropertyChangedEventArgs("SomeProperty"); var arguments = new PropertyChangedEventArgs("SomeProperty");
#pragma warning disable 0618
Assert.IsTrue(arguments.AreAffecting(() => ViewModel.SomeProperty)); Assert.IsTrue(arguments.AreAffecting(() => ViewModel.SomeProperty));
#pragma warning restore 0618
Assert.IsTrue(arguments.AreAffecting("SomeProperty")); Assert.IsTrue(arguments.AreAffecting("SomeProperty"));
} }
@ -61,7 +63,9 @@ namespace Nuclex.Support {
[Test] [Test]
public void MismatchingPropertyIsReportedAsUnaffected() { public void MismatchingPropertyIsReportedAsUnaffected() {
var arguments = new PropertyChangedEventArgs("AnotherProperty"); var arguments = new PropertyChangedEventArgs("AnotherProperty");
#pragma warning disable 0618
Assert.IsFalse(arguments.AreAffecting(() => ViewModel.SomeProperty)); Assert.IsFalse(arguments.AreAffecting(() => ViewModel.SomeProperty));
#pragma warning restore 0618
Assert.IsFalse(arguments.AreAffecting("SomeProperty")); Assert.IsFalse(arguments.AreAffecting("SomeProperty"));
} }
@ -72,7 +76,9 @@ namespace Nuclex.Support {
[Test] [Test]
public void SpecificPropertyIsAffectedByNullWildcard() { public void SpecificPropertyIsAffectedByNullWildcard() {
var nullArguments = new PropertyChangedEventArgs(null); var nullArguments = new PropertyChangedEventArgs(null);
#pragma warning disable 0618
Assert.IsTrue(nullArguments.AreAffecting(() => ViewModel.SomeProperty)); Assert.IsTrue(nullArguments.AreAffecting(() => ViewModel.SomeProperty));
#pragma warning restore 0618
Assert.IsTrue(nullArguments.AreAffecting("SomeProperty")); Assert.IsTrue(nullArguments.AreAffecting("SomeProperty"));
} }
@ -83,7 +89,9 @@ namespace Nuclex.Support {
[Test] [Test]
public void SpecificPropertyIsAffectedByEmptyWildcard() { public void SpecificPropertyIsAffectedByEmptyWildcard() {
var emptyArguments = new PropertyChangedEventArgs(string.Empty); var emptyArguments = new PropertyChangedEventArgs(string.Empty);
#pragma warning disable 0618
Assert.IsTrue(emptyArguments.AreAffecting(() => ViewModel.SomeProperty)); Assert.IsTrue(emptyArguments.AreAffecting(() => ViewModel.SomeProperty));
#pragma warning disable 0618
Assert.IsTrue(emptyArguments.AreAffecting("SomeProperty")); Assert.IsTrue(emptyArguments.AreAffecting("SomeProperty"));
} }

View File

@ -26,7 +26,7 @@ using System.Threading;
using NUnit.Framework; using NUnit.Framework;
namespace Nuclex.Support { namespace Nuclex.Support.Threading {
/// <summary>Unit Test for the CPU core-affine thread pool</summary> /// <summary>Unit Test for the CPU core-affine thread pool</summary>
[TestFixture] [TestFixture]
@ -351,6 +351,6 @@ namespace Nuclex.Support {
} }
} // namespace Nuclex.Support } // namespace Nuclex.Support.Threading
#endif // UNITTEST #endif // UNITTEST

View File

@ -24,7 +24,7 @@ using System.Diagnostics;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Threading; using System.Threading;
namespace Nuclex.Support { namespace Nuclex.Support.Threading {
/// <summary>Alternative Thread pool providing one thread for each core</summary> /// <summary>Alternative Thread pool providing one thread for each core</summary>
/// <remarks> /// <remarks>
@ -293,4 +293,4 @@ namespace Nuclex.Support {
} }
} // namespace Nuclex.Support } // namespace Nuclex.Support.Threading

View File

@ -28,7 +28,7 @@ using System.Collections.Generic;
using NUnit.Framework; using NUnit.Framework;
namespace Nuclex.Support { namespace Nuclex.Support.Threading {
/// <summary>Unit Test for the parallel background worker class</summary> /// <summary>Unit Test for the parallel background worker class</summary>
[TestFixture] [TestFixture]
@ -249,7 +249,7 @@ namespace Nuclex.Support {
} }
} // namespace Nuclex.Support } // namespace Nuclex.Support.Threading
#endif // UNITTEST #endif // UNITTEST

View File

@ -26,7 +26,7 @@ using System.Collections.Generic;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Nuclex.Support { namespace Nuclex.Support.Threading {
/// <summary>Processes tasks in parallel using many threads</summary> /// <summary>Processes tasks in parallel using many threads</summary>
/// <typeparam name="TTask">Type of tasks the class will process</typeparam> /// <typeparam name="TTask">Type of tasks the class will process</typeparam>
@ -339,6 +339,6 @@ namespace Nuclex.Support {
} }
} // namespace Nuclex.Support } // namespace Nuclex.Support.Threading
#endif // !NO_CONCURRENT_COLLECTIONS #endif // !NO_CONCURRENT_COLLECTIONS