param(
    [string]
    $ResultsFile,

    [string]
    $ResultsType = "nunit3"
)

$ResultsFile = Resolve-Path $ResultsFile
$Url = "https://ci.appveyor.com/api/testresults/$ResultsType/$($env:APPVEYOR_JOB_ID)"

if(-Not (Test-Path $ResultsFile))
{
    Write-Host "File '$ResultsFile' not found"
    exit(1)
}

# upload results to AppVeyor
try
{
    $wc = New-Object 'System.Net.WebClient'
    $wc.UploadFile($Url, $ResultsFile)
    Write-Host "Tests result uploaded correctly to $($Url)" 
}
catch
{
    Write-Host "Error uploading tests results to $Url"
    $Exception = $_.Exception
    
    while($null -ne $Exception)
    {
        Write-Host "Error: $($Exception.Message)"
        $Exception = $Exception.InnerException
    }
    
    exit(2)
}
param(
    [string]
    $ResultsFile,

    [string]
    $ResultsType = "nunit"
)

$ResultsFile = Resolve-Path $ResultsFile
$Url = "https://ci.appveyor.com/api/testresults/$ResultsType/$($env:APPVEYOR_JOB_ID)"

if(-Not (Test-Path $ResultsFile))
{
    Write-Host "File '$ResultsFile' not found"
    exit(1)
}

# upload results to AppVeyor
try
{
    $wc = New-Object 'System.Net.WebClient'
    $wc.UploadFile($Url, $ResultsFile)
    Write-Host "Tests result uploaded correctly to $($Url)" 
}
catch
{
    Write-Host "Error uploading tests results to $Url"
    $Exception = $_.Exception
    
    while($null -ne $Exception)
    {
        Write-Host "Error: $($Exception.Message)"
        $Exception = $Exception.InnerException
    }
    
    exit(2)
}
Change test result type to nunit
Change test result type to nunit
