added basic signalr connection integration tests

pull/4/head
kay.one 11 years ago
parent 82378a8628
commit 4a530a6c91

@ -40,6 +40,9 @@
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\FluentValidation.4.0.0.1\lib\Net40\FluentValidation.dll</HintPath> <HintPath>..\packages\FluentValidation.4.0.0.1\lib\Net40\FluentValidation.dll</HintPath>
</Reference> </Reference>
<Reference Include="Microsoft.AspNet.SignalR.Client">
<HintPath>..\packages\Microsoft.AspNet.SignalR.Client.1.1.3\lib\net40\Microsoft.AspNet.SignalR.Client.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin"> <Reference Include="Microsoft.Owin">
<HintPath>..\packages\Microsoft.Owin.1.1.0-beta2\lib\net40\Microsoft.Owin.dll</HintPath> <HintPath>..\packages\Microsoft.Owin.1.1.0-beta2\lib\net40\Microsoft.Owin.dll</HintPath>
</Reference> </Reference>

@ -1,5 +1,8 @@
using System.IO; using System.Collections.Generic;
using System.IO;
using FluentAssertions; using FluentAssertions;
using Microsoft.AspNet.SignalR.Client;
using Microsoft.AspNet.SignalR.Client.Transports;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Api.RootFolders; using NzbDrone.Api.RootFolders;
@ -8,6 +11,30 @@ namespace NzbDrone.Integration.Test
[TestFixture] [TestFixture]
public class RootFolderIntegrationTest : IntegrationTest public class RootFolderIntegrationTest : IntegrationTest
{ {
private Connection _connection;
private List<object> _signalRReceived;
[SetUp]
public void Setup()
{
_signalRReceived = new List<object>();
_connection = new Connection("http://localhost:8989/signalr/rootfolder");
_connection.Start(new LongPollingTransport()).ContinueWith(task =>
{
if (task.IsFaulted)
{
Assert.Fail("SignalrConnection failed. {0}", task.Exception.GetBaseException());
}
});
_connection.Received += _connection_Received;
}
private void _connection_Received(string obj)
{
_signalRReceived.Add(obj);
}
[Test] [Test]
public void should_have_no_root_folder_initially() public void should_have_no_root_folder_initially()
{ {

@ -2,6 +2,7 @@
<packages> <packages>
<package id="FluentAssertions" version="2.0.1" targetFramework="net40" /> <package id="FluentAssertions" version="2.0.1" targetFramework="net40" />
<package id="FluentValidation" version="4.0.0.1" targetFramework="net40" /> <package id="FluentValidation" version="4.0.0.1" targetFramework="net40" />
<package id="Microsoft.AspNet.SignalR.Client" version="1.1.3" targetFramework="net40" />
<package id="Microsoft.Owin" version="1.1.0-beta2" targetFramework="net40" /> <package id="Microsoft.Owin" version="1.1.0-beta2" targetFramework="net40" />
<package id="Microsoft.Owin.Host.HttpListener" version="1.1.0-beta2" targetFramework="net40" /> <package id="Microsoft.Owin.Host.HttpListener" version="1.1.0-beta2" targetFramework="net40" />
<package id="Microsoft.Owin.Hosting" version="1.1.0-beta2" targetFramework="net40" /> <package id="Microsoft.Owin.Hosting" version="1.1.0-beta2" targetFramework="net40" />

Loading…
Cancel
Save