Run-Tests.ps1

[string]$TempDir = $env:TEMP
$global:SourceDir=$env:BUILD_SOURCESDIRECTORY

if($global:SourceDir -eq $null) { $global:SourceDir=$($PSScriptRoot) }

$ErrorActionPreference = "Stop";

$modulePath = Join-Path $TempDir Pester-master\Pester.psm1

if (-not(Test-Path $modulePath)) {

����# Note: PSGet and chocolatey are not supported in hosted vsts build agent� 
����$tempFile = Join-Path $TempDir pester.zip
����Invoke-WebRequest https://github.com/pester/Pester/archive/master.zip -OutFile $tempFile

    Write-Host "Download Pester to file $tempFile"

����[System.Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem') | Out-Null
����Write-Host "Extract Pester to directory $tempDir"
    [System.IO.Compression.ZipFile]::ExtractToDirectory($tempFile, $tempDir)

    Write-Host "Remove file $tempFile"
����Remove-Item $tempFile
}

if((Get-Module Pester) -eq $null) {
    Write-Host "Import module ""Pester"""
    Import-Module $modulePath -DisableNameChecking
}

$outputFile = Join-Path $global:SourceDir "TEST-pester.xml"

Write-Host "Run Tests"
Invoke-Pester -Path "$global:SourceDir\Kabompo" -PassThru -OutputFile $outputFile -OutputFormat NUnitXml -EnableExit