From 020c34fa1575a877d676ffd494141ee34fe2b88d Mon Sep 17 00:00:00 2001 From: AdmiringWorm Date: Fri, 3 May 2019 10:59:46 +0200 Subject: [PATCH] (GH-312) Updated unit test checks to correctly identify unit test library This fix is needed, otherwise any project created by a default Visual Studio 2015 unit test template can be detected as any type of unit testing library. --- Cake.Recipe/Content/build.cake | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Cake.Recipe/Content/build.cake b/Cake.Recipe/Content/build.cake index f45e9349..a6d54433 100644 --- a/Cake.Recipe/Content/build.cake +++ b/Cake.Recipe/Content/build.cake @@ -341,7 +341,7 @@ public void CopyBuildOutput() Information("Is a .Net Core Build"); } - if(parsedProject.IsLibrary() && parsedProject.IsXUnitTestProject()) + if(parsedProject.IsLibrary() && (parsedProject.HasPackage("xunit") || parsedProject.HasReference("xunit.core"))) { Information("Project has an output type of library and is an xUnit Test Project: {0}", parsedProject.RootNameSpace); var outputFolder = BuildParameters.Paths.Directories.PublishedxUnitTests.Combine(parsedProject.RootNameSpace); @@ -349,27 +349,27 @@ public void CopyBuildOutput() CopyFiles(GetFiles(parsedProject.OutputPath.FullPath + "/**/*"), outputFolder, true); continue; } - else if(parsedProject.IsLibrary() && parsedProject.IsMSTestProject()) + else if(parsedProject.IsLibrary() && (parsedProject.HasPackage("fixie") || parsedProject.HasReference("fixie"))) { - // We will use vstest.console.exe by default for MSTest Projects - Information("Project has an output type of library and is an MSTest Project: {0}", parsedProject.RootNameSpace); - var outputFolder = BuildParameters.Paths.Directories.PublishedVSTestTests.Combine(parsedProject.RootNameSpace); + Information("Project has an output type of library and is a Fixie Project: {0}", parsedProject.RootNameSpace); + var outputFolder = BuildParameters.Paths.Directories.PublishedFixieTests.Combine(parsedProject.RootNameSpace); EnsureDirectoryExists(outputFolder); CopyFiles(GetFiles(parsedProject.OutputPath.FullPath + "/**/*"), outputFolder, true); continue; } - else if(parsedProject.IsLibrary() && parsedProject.IsFixieTestProject()) + else if(parsedProject.IsLibrary() && (parsedProject.HasPackage("nunit") || parsedProject.HasReference("nunit.framework"))) { - Information("Project has an output type of library and is a Fixie Project: {0}", parsedProject.RootNameSpace); - var outputFolder = BuildParameters.Paths.Directories.PublishedFixieTests.Combine(parsedProject.RootNameSpace); + Information("Project has an output type of library and is a NUnit Test Project: {0}", parsedProject.RootNameSpace); + var outputFolder = BuildParameters.Paths.Directories.PublishedNUnitTests.Combine(parsedProject.RootNameSpace); EnsureDirectoryExists(outputFolder); CopyFiles(GetFiles(parsedProject.OutputPath.FullPath + "/**/*"), outputFolder, true); continue; } - else if(parsedProject.IsLibrary() && parsedProject.IsNUnitTestProject()) + else if(parsedProject.IsLibrary() && parsedProject.IsMSTestProject()) { - Information("Project has an output type of library and is a NUnit Test Project: {0}", parsedProject.RootNameSpace); - var outputFolder = BuildParameters.Paths.Directories.PublishedNUnitTests.Combine(parsedProject.RootNameSpace); + // We will use vstest.console.exe by default for MSTest Projects + Information("Project has an output type of library and is an MSTest Project: {0}", parsedProject.RootNameSpace); + var outputFolder = BuildParameters.Paths.Directories.PublishedVSTestTests.Combine(parsedProject.RootNameSpace); EnsureDirectoryExists(outputFolder); CopyFiles(GetFiles(parsedProject.OutputPath.FullPath + "/**/*"), outputFolder, true); continue;