Skip to content

Commit

Permalink
(cake-contribGH-312) Updated unit test checks to correctly identify u…
Browse files Browse the repository at this point in the history
…nit 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.
  • Loading branch information
AdmiringWorm committed May 3, 2019
1 parent dfffcba commit 020c34f
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions Cake.Recipe/Content/build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -341,35 +341,35 @@ 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);
EnsureDirectoryExists(outputFolder);
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;
Expand Down

0 comments on commit 020c34f

Please sign in to comment.