From e6e0220fb340d0d5d4a7700b4bfd121717b6c10c Mon Sep 17 00:00:00 2001 From: Markus Ewald Date: Fri, 1 Feb 2019 19:54:28 +0000 Subject: [PATCH] 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 --- Nuclex.Support (net-4.0).csproj | 28 +++++++++---------- Source/Observable.Test.cs | 2 ++ Source/PropertyChangedEventArgsHelper.Test.cs | 8 ++++++ .../{ => Threading}/AffineThreadPool.Test.cs | 4 +-- Source/{ => Threading}/AffineThreadPool.cs | 4 +-- .../ParallelBackgroundWorker.Test.cs | 4 +-- .../ParallelBackgroundWorker.cs | 4 +-- 7 files changed, 32 insertions(+), 22 deletions(-) rename Source/{ => Threading}/AffineThreadPool.Test.cs (96%) rename Source/{ => Threading}/AffineThreadPool.cs (96%) rename Source/{ => Threading}/ParallelBackgroundWorker.Test.cs (96%) rename Source/{ => Threading}/ParallelBackgroundWorker.cs (96%) diff --git a/Nuclex.Support (net-4.0).csproj b/Nuclex.Support (net-4.0).csproj index 650c1f5..2ce6430 100644 --- a/Nuclex.Support (net-4.0).csproj +++ b/Nuclex.Support (net-4.0).csproj @@ -251,10 +251,6 @@ CommandLine.cs - - - ParallelBackgroundWorker.cs - ParserHelper.cs @@ -263,10 +259,6 @@ PropertyChangedEventArgsHelper.cs - - - AffineThreadPool.cs - EnumHelper.cs @@ -279,6 +271,14 @@ ObservableHelper.cs + + + AffineThreadPool.cs + + + + ParallelBackgroundWorker.cs + TypeHelper.cs @@ -331,11 +331,11 @@ - \ No newline at end of file diff --git a/Source/Observable.Test.cs b/Source/Observable.Test.cs index 89f509a..eaa3a89 100644 --- a/Source/Observable.Test.cs +++ b/Source/Observable.Test.cs @@ -47,7 +47,9 @@ namespace Nuclex.Support { /// Fires the property changed event for the 'SomePropety' property public void FireSomePropertyChanged() { + #pragma warning disable 0618 OnPropertyChanged(() => SomeProperty); + #pragma warning restore 0618 } /// Example property that will be reported to have changed diff --git a/Source/PropertyChangedEventArgsHelper.Test.cs b/Source/PropertyChangedEventArgsHelper.Test.cs index 1d4dbed..a429ba6 100644 --- a/Source/PropertyChangedEventArgsHelper.Test.cs +++ b/Source/PropertyChangedEventArgsHelper.Test.cs @@ -50,7 +50,9 @@ namespace Nuclex.Support { [Test] public void MatchingPropertyChangeNotificationIsRecognized() { var arguments = new PropertyChangedEventArgs("SomeProperty"); + #pragma warning disable 0618 Assert.IsTrue(arguments.AreAffecting(() => ViewModel.SomeProperty)); + #pragma warning restore 0618 Assert.IsTrue(arguments.AreAffecting("SomeProperty")); } @@ -61,7 +63,9 @@ namespace Nuclex.Support { [Test] public void MismatchingPropertyIsReportedAsUnaffected() { var arguments = new PropertyChangedEventArgs("AnotherProperty"); + #pragma warning disable 0618 Assert.IsFalse(arguments.AreAffecting(() => ViewModel.SomeProperty)); + #pragma warning restore 0618 Assert.IsFalse(arguments.AreAffecting("SomeProperty")); } @@ -72,7 +76,9 @@ namespace Nuclex.Support { [Test] public void SpecificPropertyIsAffectedByNullWildcard() { var nullArguments = new PropertyChangedEventArgs(null); + #pragma warning disable 0618 Assert.IsTrue(nullArguments.AreAffecting(() => ViewModel.SomeProperty)); + #pragma warning restore 0618 Assert.IsTrue(nullArguments.AreAffecting("SomeProperty")); } @@ -83,7 +89,9 @@ namespace Nuclex.Support { [Test] public void SpecificPropertyIsAffectedByEmptyWildcard() { var emptyArguments = new PropertyChangedEventArgs(string.Empty); + #pragma warning disable 0618 Assert.IsTrue(emptyArguments.AreAffecting(() => ViewModel.SomeProperty)); + #pragma warning disable 0618 Assert.IsTrue(emptyArguments.AreAffecting("SomeProperty")); } diff --git a/Source/AffineThreadPool.Test.cs b/Source/Threading/AffineThreadPool.Test.cs similarity index 96% rename from Source/AffineThreadPool.Test.cs rename to Source/Threading/AffineThreadPool.Test.cs index 172428e..63547cc 100644 --- a/Source/AffineThreadPool.Test.cs +++ b/Source/Threading/AffineThreadPool.Test.cs @@ -26,7 +26,7 @@ using System.Threading; using NUnit.Framework; -namespace Nuclex.Support { +namespace Nuclex.Support.Threading { /// Unit Test for the CPU core-affine thread pool [TestFixture] @@ -351,6 +351,6 @@ namespace Nuclex.Support { } -} // namespace Nuclex.Support +} // namespace Nuclex.Support.Threading #endif // UNITTEST diff --git a/Source/AffineThreadPool.cs b/Source/Threading/AffineThreadPool.cs similarity index 96% rename from Source/AffineThreadPool.cs rename to Source/Threading/AffineThreadPool.cs index c1044b1..893e272 100644 --- a/Source/AffineThreadPool.cs +++ b/Source/Threading/AffineThreadPool.cs @@ -24,7 +24,7 @@ using System.Diagnostics; using System.Runtime.InteropServices; using System.Threading; -namespace Nuclex.Support { +namespace Nuclex.Support.Threading { /// Alternative Thread pool providing one thread for each core /// @@ -293,4 +293,4 @@ namespace Nuclex.Support { } -} // namespace Nuclex.Support +} // namespace Nuclex.Support.Threading diff --git a/Source/ParallelBackgroundWorker.Test.cs b/Source/Threading/ParallelBackgroundWorker.Test.cs similarity index 96% rename from Source/ParallelBackgroundWorker.Test.cs rename to Source/Threading/ParallelBackgroundWorker.Test.cs index 787d2a5..ce646cf 100644 --- a/Source/ParallelBackgroundWorker.Test.cs +++ b/Source/Threading/ParallelBackgroundWorker.Test.cs @@ -28,7 +28,7 @@ using System.Collections.Generic; using NUnit.Framework; -namespace Nuclex.Support { +namespace Nuclex.Support.Threading { /// Unit Test for the parallel background worker class [TestFixture] @@ -249,7 +249,7 @@ namespace Nuclex.Support { } -} // namespace Nuclex.Support +} // namespace Nuclex.Support.Threading #endif // UNITTEST diff --git a/Source/ParallelBackgroundWorker.cs b/Source/Threading/ParallelBackgroundWorker.cs similarity index 96% rename from Source/ParallelBackgroundWorker.cs rename to Source/Threading/ParallelBackgroundWorker.cs index f0fd7c6..2ed3ecc 100644 --- a/Source/ParallelBackgroundWorker.cs +++ b/Source/Threading/ParallelBackgroundWorker.cs @@ -26,7 +26,7 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; -namespace Nuclex.Support { +namespace Nuclex.Support.Threading { /// Processes tasks in parallel using many threads /// Type of tasks the class will process @@ -339,6 +339,6 @@ namespace Nuclex.Support { } -} // namespace Nuclex.Support +} // namespace Nuclex.Support.Threading #endif // !NO_CONCURRENT_COLLECTIONS