From 4a530a6c915b7d4cbdba222fe53265c5ec47c1e4 Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Sun, 18 Aug 2013 15:19:55 -0700 Subject: [PATCH] added basic signalr connection integration tests --- .../NzbDrone.Integration.Test.csproj | 3 ++ .../RootFolderIntegrationTest.cs | 29 ++++++++++++++++++- NzbDrone.Integration.Test/packages.config | 1 + 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/NzbDrone.Integration.Test/NzbDrone.Integration.Test.csproj b/NzbDrone.Integration.Test/NzbDrone.Integration.Test.csproj index 6a35e4218..f60085898 100644 --- a/NzbDrone.Integration.Test/NzbDrone.Integration.Test.csproj +++ b/NzbDrone.Integration.Test/NzbDrone.Integration.Test.csproj @@ -40,6 +40,9 @@ False ..\packages\FluentValidation.4.0.0.1\lib\Net40\FluentValidation.dll + + ..\packages\Microsoft.AspNet.SignalR.Client.1.1.3\lib\net40\Microsoft.AspNet.SignalR.Client.dll + ..\packages\Microsoft.Owin.1.1.0-beta2\lib\net40\Microsoft.Owin.dll diff --git a/NzbDrone.Integration.Test/RootFolderIntegrationTest.cs b/NzbDrone.Integration.Test/RootFolderIntegrationTest.cs index 8a8d04d7f..d4cc4bc83 100644 --- a/NzbDrone.Integration.Test/RootFolderIntegrationTest.cs +++ b/NzbDrone.Integration.Test/RootFolderIntegrationTest.cs @@ -1,5 +1,8 @@ -using System.IO; +using System.Collections.Generic; +using System.IO; using FluentAssertions; +using Microsoft.AspNet.SignalR.Client; +using Microsoft.AspNet.SignalR.Client.Transports; using NUnit.Framework; using NzbDrone.Api.RootFolders; @@ -8,6 +11,30 @@ namespace NzbDrone.Integration.Test [TestFixture] public class RootFolderIntegrationTest : IntegrationTest { + private Connection _connection; + private List _signalRReceived; + + [SetUp] + public void Setup() + { + _signalRReceived = new List(); + _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] public void should_have_no_root_folder_initially() { diff --git a/NzbDrone.Integration.Test/packages.config b/NzbDrone.Integration.Test/packages.config index 3f0ac1830..0f08d34ac 100644 --- a/NzbDrone.Integration.Test/packages.config +++ b/NzbDrone.Integration.Test/packages.config @@ -2,6 +2,7 @@ +