mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-23 22:25:09 -04:00
added signalR to Integration Test
This commit is contained in:
@@ -1,8 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using FluentAssertions;
|
||||
using Microsoft.AspNet.SignalR.Client;
|
||||
using Microsoft.AspNet.SignalR.Client.Transports;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Api.RootFolders;
|
||||
|
||||
@@ -11,39 +8,25 @@ namespace NzbDrone.Integration.Test
|
||||
[TestFixture]
|
||||
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]
|
||||
public void should_have_no_root_folder_initially()
|
||||
{
|
||||
RootFolders.All().Should().BeEmpty();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_add_and_delete_root_folders()
|
||||
{
|
||||
|
||||
ConnectSignalR();
|
||||
|
||||
var rootFolder = new RootFolderResource
|
||||
{
|
||||
Path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
|
||||
};
|
||||
{
|
||||
Path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
|
||||
};
|
||||
|
||||
var postResponse = RootFolders.Post(rootFolder);
|
||||
|
||||
@@ -56,6 +39,11 @@ namespace NzbDrone.Integration.Test
|
||||
RootFolders.Delete(postResponse.Id);
|
||||
|
||||
RootFolders.All().Should().BeEmpty();
|
||||
|
||||
|
||||
SignalRMessages.Should().Contain(c => c.Name == "rootfolder");
|
||||
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
Reference in New Issue
Block a user