From a2e3d552667656e2148fc4c93d141629eca2f62f Mon Sep 17 00:00:00 2001 From: Jamie Magee Date: Thu, 16 Feb 2023 13:06:58 -0800 Subject: [PATCH] test: move `BaseDetectorTest` from `Microsoft.ComponentDetection.Detectors.Tests` to `Microsoft.ComponentDetection.TestsUtilities` --- .../BaseDetectorTest.cs | 10 ---------- .../GoComponentDetectorTests.cs | 1 + .../GradleComponentDetectorTests.cs | 2 ++ .../IvyDetectorTests.cs | 2 ++ ...Microsoft.ComponentDetection.Detectors.Tests.csproj | 2 +- .../MvnCliDetectorTests.cs | 2 ++ .../NpmDetectorTests.cs | 4 +++- .../NpmDetectorWithRootsTests.cs | 2 ++ .../NuGetComponentDetectorTests.cs | 3 ++- ...ProjectModelProjectCentricComponentDetectorTests.cs | 2 ++ .../PipComponentDetectorTests.cs | 2 ++ .../PnpmDetectorTests.cs | 2 ++ .../PodDetectorTest.cs | 2 ++ .../PoetryComponentDetectorTests.cs | 2 ++ .../RubyDetectorTest.cs | 2 ++ .../RustCrateDetectorTests.cs | 2 ++ .../SPDX22ComponentDetectorTests.cs | 2 ++ .../VcpkgComponentDetectorTests.cs | 2 ++ .../nuget/NuGetPackagesConfigDetectorTests.cs | 1 + .../BaseDetectorTest.cs | 9 +++++++++ 20 files changed, 43 insertions(+), 13 deletions(-) delete mode 100644 test/Microsoft.ComponentDetection.Detectors.Tests/BaseDetectorTest.cs create mode 100644 test/Microsoft.ComponentDetection.TestsUtilities/BaseDetectorTest.cs diff --git a/test/Microsoft.ComponentDetection.Detectors.Tests/BaseDetectorTest.cs b/test/Microsoft.ComponentDetection.Detectors.Tests/BaseDetectorTest.cs deleted file mode 100644 index 292cd4d7c..000000000 --- a/test/Microsoft.ComponentDetection.Detectors.Tests/BaseDetectorTest.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Microsoft.ComponentDetection.Detectors.Tests; - -using Microsoft.ComponentDetection.Contracts; -using Microsoft.ComponentDetection.TestsUtilities; - -public abstract class BaseDetectorTest - where T : FileComponentDetector -{ - private protected DetectorTestUtilityBuilder DetectorTestUtility { get; } = new(); -} diff --git a/test/Microsoft.ComponentDetection.Detectors.Tests/GoComponentDetectorTests.cs b/test/Microsoft.ComponentDetection.Detectors.Tests/GoComponentDetectorTests.cs index 443262b33..bb68b171e 100644 --- a/test/Microsoft.ComponentDetection.Detectors.Tests/GoComponentDetectorTests.cs +++ b/test/Microsoft.ComponentDetection.Detectors.Tests/GoComponentDetectorTests.cs @@ -8,6 +8,7 @@ namespace Microsoft.ComponentDetection.Detectors.Tests; using Microsoft.ComponentDetection.Contracts; using Microsoft.ComponentDetection.Contracts.TypedComponent; using Microsoft.ComponentDetection.Detectors.Go; +using Microsoft.ComponentDetection.TestsUtilities; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; diff --git a/test/Microsoft.ComponentDetection.Detectors.Tests/GradleComponentDetectorTests.cs b/test/Microsoft.ComponentDetection.Detectors.Tests/GradleComponentDetectorTests.cs index a501a8854..dc67b1c11 100644 --- a/test/Microsoft.ComponentDetection.Detectors.Tests/GradleComponentDetectorTests.cs +++ b/test/Microsoft.ComponentDetection.Detectors.Tests/GradleComponentDetectorTests.cs @@ -1,4 +1,5 @@ namespace Microsoft.ComponentDetection.Detectors.Tests; + using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; @@ -7,6 +8,7 @@ using Microsoft.ComponentDetection.Contracts.TypedComponent; using Microsoft.ComponentDetection.Detectors.Gradle; using Microsoft.ComponentDetection.Detectors.Tests.Utilities; +using Microsoft.ComponentDetection.TestsUtilities; using Microsoft.VisualStudio.TestTools.UnitTesting; [TestClass] diff --git a/test/Microsoft.ComponentDetection.Detectors.Tests/IvyDetectorTests.cs b/test/Microsoft.ComponentDetection.Detectors.Tests/IvyDetectorTests.cs index 6edf09c65..938d1d159 100644 --- a/test/Microsoft.ComponentDetection.Detectors.Tests/IvyDetectorTests.cs +++ b/test/Microsoft.ComponentDetection.Detectors.Tests/IvyDetectorTests.cs @@ -1,4 +1,5 @@ namespace Microsoft.ComponentDetection.Detectors.Tests; + using System; using System.Collections.Generic; using System.IO; @@ -8,6 +9,7 @@ namespace Microsoft.ComponentDetection.Detectors.Tests; using Microsoft.ComponentDetection.Contracts; using Microsoft.ComponentDetection.Contracts.TypedComponent; using Microsoft.ComponentDetection.Detectors.Ivy; +using Microsoft.ComponentDetection.TestsUtilities; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; diff --git a/test/Microsoft.ComponentDetection.Detectors.Tests/Microsoft.ComponentDetection.Detectors.Tests.csproj b/test/Microsoft.ComponentDetection.Detectors.Tests/Microsoft.ComponentDetection.Detectors.Tests.csproj index ac50a2130..376bc6372 100644 --- a/test/Microsoft.ComponentDetection.Detectors.Tests/Microsoft.ComponentDetection.Detectors.Tests.csproj +++ b/test/Microsoft.ComponentDetection.Detectors.Tests/Microsoft.ComponentDetection.Detectors.Tests.csproj @@ -5,7 +5,7 @@ - + diff --git a/test/Microsoft.ComponentDetection.Detectors.Tests/MvnCliDetectorTests.cs b/test/Microsoft.ComponentDetection.Detectors.Tests/MvnCliDetectorTests.cs index 682d46558..b7fa5b965 100644 --- a/test/Microsoft.ComponentDetection.Detectors.Tests/MvnCliDetectorTests.cs +++ b/test/Microsoft.ComponentDetection.Detectors.Tests/MvnCliDetectorTests.cs @@ -1,4 +1,5 @@ namespace Microsoft.ComponentDetection.Detectors.Tests; + using System; using System.Collections.Generic; using System.Linq; @@ -9,6 +10,7 @@ namespace Microsoft.ComponentDetection.Detectors.Tests; using Microsoft.ComponentDetection.Contracts.TypedComponent; using Microsoft.ComponentDetection.Detectors.Maven; using Microsoft.ComponentDetection.Detectors.Tests.Utilities; +using Microsoft.ComponentDetection.TestsUtilities; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; diff --git a/test/Microsoft.ComponentDetection.Detectors.Tests/NpmDetectorTests.cs b/test/Microsoft.ComponentDetection.Detectors.Tests/NpmDetectorTests.cs index 28ba8ebb2..f2ad9b2cf 100644 --- a/test/Microsoft.ComponentDetection.Detectors.Tests/NpmDetectorTests.cs +++ b/test/Microsoft.ComponentDetection.Detectors.Tests/NpmDetectorTests.cs @@ -1,10 +1,12 @@ -namespace Microsoft.ComponentDetection.Detectors.Tests; +namespace Microsoft.ComponentDetection.Detectors.Tests; + using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.ComponentDetection.Contracts; using Microsoft.ComponentDetection.Contracts.TypedComponent; using Microsoft.ComponentDetection.Detectors.Npm; +using Microsoft.ComponentDetection.TestsUtilities; using Microsoft.VisualStudio.TestTools.UnitTesting; using static Microsoft.ComponentDetection.Detectors.Tests.Utilities.TestUtilityExtensions; diff --git a/test/Microsoft.ComponentDetection.Detectors.Tests/NpmDetectorWithRootsTests.cs b/test/Microsoft.ComponentDetection.Detectors.Tests/NpmDetectorWithRootsTests.cs index 53477f44c..7b1cf27e4 100644 --- a/test/Microsoft.ComponentDetection.Detectors.Tests/NpmDetectorWithRootsTests.cs +++ b/test/Microsoft.ComponentDetection.Detectors.Tests/NpmDetectorWithRootsTests.cs @@ -1,4 +1,5 @@ namespace Microsoft.ComponentDetection.Detectors.Tests; + using System; using System.Collections.Generic; using System.IO; @@ -9,6 +10,7 @@ namespace Microsoft.ComponentDetection.Detectors.Tests; using Microsoft.ComponentDetection.Contracts.TypedComponent; using Microsoft.ComponentDetection.Detectors.Npm; using Microsoft.ComponentDetection.Detectors.Tests.Utilities; +using Microsoft.ComponentDetection.TestsUtilities; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; using static Microsoft.ComponentDetection.Detectors.Tests.Utilities.TestUtilityExtensions; diff --git a/test/Microsoft.ComponentDetection.Detectors.Tests/NuGetComponentDetectorTests.cs b/test/Microsoft.ComponentDetection.Detectors.Tests/NuGetComponentDetectorTests.cs index 436f97015..3040a5756 100644 --- a/test/Microsoft.ComponentDetection.Detectors.Tests/NuGetComponentDetectorTests.cs +++ b/test/Microsoft.ComponentDetection.Detectors.Tests/NuGetComponentDetectorTests.cs @@ -1,4 +1,4 @@ -namespace Microsoft.ComponentDetection.Detectors.Tests; +namespace Microsoft.ComponentDetection.Detectors.Tests; using System; using System.Collections.Generic; @@ -12,6 +12,7 @@ namespace Microsoft.ComponentDetection.Detectors.Tests; using Microsoft.ComponentDetection.Contracts.Internal; using Microsoft.ComponentDetection.Contracts.TypedComponent; using Microsoft.ComponentDetection.Detectors.NuGet; +using Microsoft.ComponentDetection.TestsUtilities; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; diff --git a/test/Microsoft.ComponentDetection.Detectors.Tests/NuGetProjectModelProjectCentricComponentDetectorTests.cs b/test/Microsoft.ComponentDetection.Detectors.Tests/NuGetProjectModelProjectCentricComponentDetectorTests.cs index 01c00bc5c..07c73fe2c 100644 --- a/test/Microsoft.ComponentDetection.Detectors.Tests/NuGetProjectModelProjectCentricComponentDetectorTests.cs +++ b/test/Microsoft.ComponentDetection.Detectors.Tests/NuGetProjectModelProjectCentricComponentDetectorTests.cs @@ -1,4 +1,5 @@ namespace Microsoft.ComponentDetection.Detectors.Tests; + using System; using System.Collections.Generic; using System.Linq; @@ -10,6 +11,7 @@ namespace Microsoft.ComponentDetection.Detectors.Tests; using Microsoft.ComponentDetection.Detectors.NuGet; using Microsoft.ComponentDetection.Detectors.Tests.Mocks; using Microsoft.ComponentDetection.Detectors.Tests.Utilities; +using Microsoft.ComponentDetection.TestsUtilities; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; using Newtonsoft.Json; diff --git a/test/Microsoft.ComponentDetection.Detectors.Tests/PipComponentDetectorTests.cs b/test/Microsoft.ComponentDetection.Detectors.Tests/PipComponentDetectorTests.cs index 1a8ad2b65..f09c97e0f 100644 --- a/test/Microsoft.ComponentDetection.Detectors.Tests/PipComponentDetectorTests.cs +++ b/test/Microsoft.ComponentDetection.Detectors.Tests/PipComponentDetectorTests.cs @@ -1,4 +1,5 @@ namespace Microsoft.ComponentDetection.Detectors.Tests; + using System; using System.Collections.Generic; using System.IO; @@ -9,6 +10,7 @@ namespace Microsoft.ComponentDetection.Detectors.Tests; using Microsoft.ComponentDetection.Contracts.TypedComponent; using Microsoft.ComponentDetection.Detectors.Pip; using Microsoft.ComponentDetection.Detectors.Tests.Utilities; +using Microsoft.ComponentDetection.TestsUtilities; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; using Newtonsoft.Json; diff --git a/test/Microsoft.ComponentDetection.Detectors.Tests/PnpmDetectorTests.cs b/test/Microsoft.ComponentDetection.Detectors.Tests/PnpmDetectorTests.cs index 0513dc55b..7e398b7c3 100644 --- a/test/Microsoft.ComponentDetection.Detectors.Tests/PnpmDetectorTests.cs +++ b/test/Microsoft.ComponentDetection.Detectors.Tests/PnpmDetectorTests.cs @@ -1,4 +1,5 @@ namespace Microsoft.ComponentDetection.Detectors.Tests; + using System.Collections.Generic; using System.IO; using System.Linq; @@ -9,6 +10,7 @@ using Microsoft.ComponentDetection.Contracts.TypedComponent; using Microsoft.ComponentDetection.Detectors.Pnpm; using Microsoft.ComponentDetection.Detectors.Tests.Utilities; +using Microsoft.ComponentDetection.TestsUtilities; using Microsoft.VisualStudio.TestTools.UnitTesting; [TestClass] diff --git a/test/Microsoft.ComponentDetection.Detectors.Tests/PodDetectorTest.cs b/test/Microsoft.ComponentDetection.Detectors.Tests/PodDetectorTest.cs index 9fa81cf4b..67c996bc2 100644 --- a/test/Microsoft.ComponentDetection.Detectors.Tests/PodDetectorTest.cs +++ b/test/Microsoft.ComponentDetection.Detectors.Tests/PodDetectorTest.cs @@ -1,4 +1,5 @@ namespace Microsoft.ComponentDetection.Detectors.Tests; + using System; using System.Collections.Generic; using System.IO; @@ -8,6 +9,7 @@ using Microsoft.ComponentDetection.Contracts.TypedComponent; using Microsoft.ComponentDetection.Detectors.CocoaPods; using Microsoft.ComponentDetection.Detectors.Tests.Utilities; +using Microsoft.ComponentDetection.TestsUtilities; using Microsoft.VisualStudio.TestTools.UnitTesting; [TestClass] diff --git a/test/Microsoft.ComponentDetection.Detectors.Tests/PoetryComponentDetectorTests.cs b/test/Microsoft.ComponentDetection.Detectors.Tests/PoetryComponentDetectorTests.cs index a9b9caeda..347e22f6d 100644 --- a/test/Microsoft.ComponentDetection.Detectors.Tests/PoetryComponentDetectorTests.cs +++ b/test/Microsoft.ComponentDetection.Detectors.Tests/PoetryComponentDetectorTests.cs @@ -1,4 +1,5 @@ namespace Microsoft.ComponentDetection.Detectors.Tests; + using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; @@ -6,6 +7,7 @@ namespace Microsoft.ComponentDetection.Detectors.Tests; using Microsoft.ComponentDetection.Contracts.TypedComponent; using Microsoft.ComponentDetection.Detectors.Poetry; using Microsoft.ComponentDetection.Detectors.Tests.Utilities; +using Microsoft.ComponentDetection.TestsUtilities; using Microsoft.VisualStudio.TestTools.UnitTesting; [TestClass] diff --git a/test/Microsoft.ComponentDetection.Detectors.Tests/RubyDetectorTest.cs b/test/Microsoft.ComponentDetection.Detectors.Tests/RubyDetectorTest.cs index 7603c116c..1858c14e5 100644 --- a/test/Microsoft.ComponentDetection.Detectors.Tests/RubyDetectorTest.cs +++ b/test/Microsoft.ComponentDetection.Detectors.Tests/RubyDetectorTest.cs @@ -1,4 +1,5 @@ namespace Microsoft.ComponentDetection.Detectors.Tests; + using System.Collections.Generic; using System.IO; using System.Linq; @@ -9,6 +10,7 @@ using Microsoft.ComponentDetection.Contracts.TypedComponent; using Microsoft.ComponentDetection.Detectors.Ruby; using Microsoft.ComponentDetection.Detectors.Tests.Utilities; +using Microsoft.ComponentDetection.TestsUtilities; using Microsoft.VisualStudio.TestTools.UnitTesting; [TestClass] diff --git a/test/Microsoft.ComponentDetection.Detectors.Tests/RustCrateDetectorTests.cs b/test/Microsoft.ComponentDetection.Detectors.Tests/RustCrateDetectorTests.cs index 34835dbe0..ec5ce6e9e 100644 --- a/test/Microsoft.ComponentDetection.Detectors.Tests/RustCrateDetectorTests.cs +++ b/test/Microsoft.ComponentDetection.Detectors.Tests/RustCrateDetectorTests.cs @@ -1,4 +1,5 @@ namespace Microsoft.ComponentDetection.Detectors.Tests; + using System; using System.Collections.Generic; using System.IO; @@ -10,6 +11,7 @@ using Microsoft.ComponentDetection.Contracts.TypedComponent; using Microsoft.ComponentDetection.Detectors.Rust; using Microsoft.ComponentDetection.Detectors.Tests.Utilities; +using Microsoft.ComponentDetection.TestsUtilities; using Microsoft.VisualStudio.TestTools.UnitTesting; [TestClass] diff --git a/test/Microsoft.ComponentDetection.Detectors.Tests/SPDX22ComponentDetectorTests.cs b/test/Microsoft.ComponentDetection.Detectors.Tests/SPDX22ComponentDetectorTests.cs index 3adcf9ed5..79336bdbb 100644 --- a/test/Microsoft.ComponentDetection.Detectors.Tests/SPDX22ComponentDetectorTests.cs +++ b/test/Microsoft.ComponentDetection.Detectors.Tests/SPDX22ComponentDetectorTests.cs @@ -1,4 +1,5 @@ namespace Microsoft.ComponentDetection.Detectors.Tests; + using System; using System.Collections.Generic; using System.IO; @@ -10,6 +11,7 @@ namespace Microsoft.ComponentDetection.Detectors.Tests; using Microsoft.ComponentDetection.Contracts; using Microsoft.ComponentDetection.Contracts.TypedComponent; using Microsoft.ComponentDetection.Detectors.Spdx; +using Microsoft.ComponentDetection.TestsUtilities; using Microsoft.VisualStudio.TestTools.UnitTesting; [TestClass] diff --git a/test/Microsoft.ComponentDetection.Detectors.Tests/VcpkgComponentDetectorTests.cs b/test/Microsoft.ComponentDetection.Detectors.Tests/VcpkgComponentDetectorTests.cs index e554730ba..a805dc00e 100644 --- a/test/Microsoft.ComponentDetection.Detectors.Tests/VcpkgComponentDetectorTests.cs +++ b/test/Microsoft.ComponentDetection.Detectors.Tests/VcpkgComponentDetectorTests.cs @@ -1,4 +1,5 @@ namespace Microsoft.ComponentDetection.Detectors.Tests; + using System.Collections.Generic; using System.IO; using System.Linq; @@ -7,6 +8,7 @@ namespace Microsoft.ComponentDetection.Detectors.Tests; using Microsoft.ComponentDetection.Contracts; using Microsoft.ComponentDetection.Contracts.TypedComponent; using Microsoft.ComponentDetection.Detectors.Vcpkg; +using Microsoft.ComponentDetection.TestsUtilities; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; diff --git a/test/Microsoft.ComponentDetection.Detectors.Tests/nuget/NuGetPackagesConfigDetectorTests.cs b/test/Microsoft.ComponentDetection.Detectors.Tests/nuget/NuGetPackagesConfigDetectorTests.cs index cf4e92f20..7b2082da8 100644 --- a/test/Microsoft.ComponentDetection.Detectors.Tests/nuget/NuGetPackagesConfigDetectorTests.cs +++ b/test/Microsoft.ComponentDetection.Detectors.Tests/nuget/NuGetPackagesConfigDetectorTests.cs @@ -5,6 +5,7 @@ namespace Microsoft.ComponentDetection.Detectors.Tests.NuGet; using Microsoft.ComponentDetection.Contracts; using Microsoft.ComponentDetection.Contracts.TypedComponent; using Microsoft.ComponentDetection.Detectors.NuGet; +using Microsoft.ComponentDetection.TestsUtilities; using Microsoft.VisualStudio.TestTools.UnitTesting; [TestClass] diff --git a/test/Microsoft.ComponentDetection.TestsUtilities/BaseDetectorTest.cs b/test/Microsoft.ComponentDetection.TestsUtilities/BaseDetectorTest.cs new file mode 100644 index 000000000..ad3439c6f --- /dev/null +++ b/test/Microsoft.ComponentDetection.TestsUtilities/BaseDetectorTest.cs @@ -0,0 +1,9 @@ +namespace Microsoft.ComponentDetection.TestsUtilities; + +using Microsoft.ComponentDetection.Contracts; + +public abstract class BaseDetectorTest + where T : FileComponentDetector +{ + protected DetectorTestUtilityBuilder DetectorTestUtility { get; } = new(); +}