Created
June 15, 2017 16:16
-
-
Save dizco/fc8e0a5dcfb09075753b18044722c2a4 to your computer and use it in GitHub Desktop.
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
<?xml version="1.0" encoding="utf-8"?> | |
<configuration> | |
<runtime> | |
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> | |
<dependentAssembly> | |
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> | |
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" /> | |
</dependentAssembly> | |
</assemblyBinding> | |
</runtime> | |
</configuration> |
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
# Add accept all self signed certificates | |
add-type @" | |
using System.Net; | |
using System.Security.Cryptography.X509Certificates; | |
public class TrustAllCertsPolicy : ICertificatePolicy { | |
public bool CheckValidationResult( | |
ServicePoint srvPoint, X509Certificate certificate, | |
WebRequest request, int certificateProblem) { | |
return true; | |
} | |
} | |
"@ | |
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy | |
# Update this to where your signalR server is | |
$server = "https://localhost/rest/" | |
$dllFolder = -join((Get-Item -Path ".\" -Verbose).FullName, "\bin\Debug\") | |
[string[]] $dllPathsToLoad = @("\Newtonsoft.Json.dll", "\Microsoft.AspNet.SignalR.Client.dll") | |
$token = "insertyourtokenhere" | |
function LoadDllPaths($dlls) | |
{ | |
foreach ($dll in $dlls) | |
{ | |
$dllpath = $dllFolder + $dll | |
[System.Reflection.Assembly]::LoadFrom($dllpath) | |
} | |
} | |
try | |
{ | |
Write-Host "" | |
Write-Host "--- Loading dlls for SignalR tests ---" -ForegroundColor Magenta | |
try | |
{ | |
LoadDllPaths($dllPathsToLoad) | |
write-host "done loading" -foreground Green | |
} | |
catch | |
{ | |
Write-host ([string]::Format("Error : {0}", $_.Exception.ToString())) -ForegroundColor Red | |
write-host "failed" -ForegroundColor DarkRed | |
} | |
Write-Host "" | |
write-host "--- Build HubConnection --- " -ForegroundColor Magenta | |
try | |
{ | |
$hub = New-Object Microsoft.AspNet.SignalR.Client.HubConnection($server) | |
$hub.Headers["Authorization"] = -join("Bearer ", $token) | |
Write-Host ([string]::Format("Created hub connection with authorization : {0}", $hub.Headers["Authorization"])) | |
Start-Sleep -seconds 1 | |
write-host "passed" -ForegroundColor Green | |
} | |
catch | |
{ | |
Write-host ([string]::Format("Error : {0}", $_.Exception.ToString())) -ForegroundColor Red | |
write-host "failed" -ForegroundColor DarkRed | |
} | |
} | |
catch [System.Net.WebException]{ | |
Write-host ([string]::Format("Error : {0}", $_.Exception.ToString())) -ForegroundColor Red | |
} | |
write-host "Done." -ForegroundColor Magenta |
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
<?xml version="1.0" encoding="utf-8"?> | |
<packages> | |
<package id="Microsoft.AspNet.SignalR.Client" version="2.2.2" targetFramework="net452" /> | |
<package id="MSTest.TestAdapter" version="1.1.11" targetFramework="net452" /> | |
<package id="MSTest.TestFramework" version="1.1.11" targetFramework="net452" /> | |
<package id="Newtonsoft.Json" version="10.0.2" targetFramework="net452" /> | |
</packages> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment