Last active
September 21, 2015 23:40
-
-
Save Kyle-Muir/35911c0e8890579c079e to your computer and use it in GitHub Desktop.
Methods for copying C# projects into an Artefacts directory and then running NUnit Console runner across them
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Copy-FilesFromDirectories($exclude, $dest, $sourceDir, $config) { | |
$folders = Get-ChildItem -Path $sourceDir -Directory -Exclude $exclude | ? { $_.Name.EndsWith("Test") -or $_.Name.EndsWith("Tests") } | |
Foreach($folder in $folders) { | |
$binDirectory = "$($folder.FullName)\bin\$config" | |
if ((Test-Path $binDirectory)) { | |
Write-Host "Coyping folder $($folder.Name) to $dest" -ForegroundColor "Yellow" | |
$destinationProjectDirectory = "{0}\{1}" -f $dest,$folder.Name | |
New-Item $destinationProjectDirectory -ItemType Directory | |
Copy-Item -Path "$binDirectory\*" -Dest $destinationProjectDirectory | |
} | |
} | |
} | |
function Run-Nunit ($toolsDir, $testAssembly) | |
{ | |
$nunit = "$toolsDir\NUnit\bin\nunit-console.exe" | |
exec { &$nunit $testAssembly } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment