|
|
|
@ -2,13 +2,16 @@
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Linq.Expressions;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Castle.Components.DictionaryAdapter;
|
|
|
|
|
using Hangfire;
|
|
|
|
|
using Microsoft.AspNetCore.SignalR;
|
|
|
|
|
using Moq;
|
|
|
|
|
using MockQueryable.Moq;
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using Ombi.Core.Notifications;
|
|
|
|
|
using Ombi.Hubs;
|
|
|
|
|
using Ombi.Schedule.Jobs.Plex;
|
|
|
|
|
using Ombi.Store.Entities;
|
|
|
|
|
using Ombi.Store.Entities.Requests;
|
|
|
|
@ -18,6 +21,7 @@ using Ombi.Store.Repository.Requests;
|
|
|
|
|
namespace Ombi.Schedule.Tests
|
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
|
|
|
|
[Ignore("Need to work out how to mockout the hub context")]
|
|
|
|
|
public class PlexAvailabilityCheckerTests
|
|
|
|
|
{
|
|
|
|
|
[SetUp]
|
|
|
|
@ -27,7 +31,11 @@ namespace Ombi.Schedule.Tests
|
|
|
|
|
_tv = new Mock<ITvRequestRepository>();
|
|
|
|
|
_movie = new Mock<IMovieRequestRepository>();
|
|
|
|
|
_notify = new Mock<INotificationService>();
|
|
|
|
|
Checker = new PlexAvailabilityChecker(_repo.Object, _tv.Object, _movie.Object, _notify.Object, new Mock<IBackgroundJobClient>().Object, null);
|
|
|
|
|
var hub = new Mock<IHubContext<NotificationHub>>();
|
|
|
|
|
hub.Setup(x =>
|
|
|
|
|
x.Clients.Clients(It.IsAny<IReadOnlyList<string>>()).SendCoreAsync(It.IsAny<string>(), It.IsAny<object[]>(), It.IsAny<CancellationToken>()));
|
|
|
|
|
NotificationHub.UsersOnline.TryAdd("A", new HubUsers());
|
|
|
|
|
Checker = new PlexAvailabilityChecker(_repo.Object, _tv.Object, _movie.Object, _notify.Object, new Mock<IBackgroundJobClient>().Object, null, hub.Object);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|