Fixed tests

pull/511/head^2
tidusjar 8 years ago
parent 0f98f12756
commit 89e8bace80

@ -42,6 +42,7 @@ using PlexRequests.Services.Interfaces;
using PlexRequests.Helpers; using PlexRequests.Helpers;
using PlexRequests.Services.Jobs; using PlexRequests.Services.Jobs;
using PlexRequests.Services.Models; using PlexRequests.Services.Models;
using PlexRequests.Services.Notification;
using PlexRequests.Store.Models; using PlexRequests.Store.Models;
using PlexRequests.Store.Repository; using PlexRequests.Store.Repository;
@ -63,6 +64,11 @@ namespace PlexRequests.Services.Tests
private Mock<IJobRecord> JobRec { get; set; } private Mock<IJobRecord> JobRec { get; set; }
private Mock<IRepository<UsersToNotify>> NotifyUsers { get; set; } private Mock<IRepository<UsersToNotify>> NotifyUsers { get; set; }
private Mock<IRepository<PlexEpisodes>> PlexEpisodes { get; set; } private Mock<IRepository<PlexEpisodes>> PlexEpisodes { get; set; }
private Mock<INotificationEngine> Engine
{
get;
set;
}
[SetUp] [SetUp]
public void Setup() public void Setup()
@ -76,7 +82,8 @@ namespace PlexRequests.Services.Tests
NotifyUsers = new Mock<IRepository<UsersToNotify>>(); NotifyUsers = new Mock<IRepository<UsersToNotify>>();
PlexEpisodes = new Mock<IRepository<PlexEpisodes>>(); PlexEpisodes = new Mock<IRepository<PlexEpisodes>>();
JobRec = new Mock<IJobRecord>(); JobRec = new Mock<IJobRecord>();
Checker = new PlexAvailabilityChecker(SettingsMock.Object, RequestMock.Object, PlexMock.Object, CacheMock.Object, NotificationMock.Object, JobRec.Object, NotifyUsers.Object, PlexEpisodes.Object); Engine = new Mock<INotificationEngine>();
Checker = new PlexAvailabilityChecker(SettingsMock.Object, RequestMock.Object, PlexMock.Object, CacheMock.Object, NotificationMock.Object, JobRec.Object, NotifyUsers.Object, PlexEpisodes.Object, Engine.Object);
} }
@ -212,7 +219,6 @@ namespace PlexRequests.Services.Tests
new PlexEpisodes {EpisodeNumber = 1, ShowTitle = "The Flash",ProviderId = 23.ToString(), SeasonNumber = 1, EpisodeTitle = "Pilot"} new PlexEpisodes {EpisodeNumber = 1, ShowTitle = "The Flash",ProviderId = 23.ToString(), SeasonNumber = 1, EpisodeTitle = "Pilot"}
}; };
PlexEpisodes.Setup(x => x.Custom(It.IsAny<Func<IDbConnection, IEnumerable<PlexEpisodes>>>())).Returns(expected); PlexEpisodes.Setup(x => x.Custom(It.IsAny<Func<IDbConnection, IEnumerable<PlexEpisodes>>>())).Returns(expected);
Checker = new PlexAvailabilityChecker(SettingsMock.Object, RequestMock.Object, PlexMock.Object, CacheMock.Object, NotificationMock.Object, JobRec.Object, NotifyUsers.Object, PlexEpisodes.Object);
var result = Checker.IsEpisodeAvailable(providerId, season, episode); var result = Checker.IsEpisodeAvailable(providerId, season, episode);
@ -270,8 +276,6 @@ namespace PlexRequests.Services.Tests
public async Task GetAllPlexEpisodes() public async Task GetAllPlexEpisodes()
{ {
PlexEpisodes.Setup(x => x.GetAllAsync()).ReturnsAsync(F.CreateMany<PlexEpisodes>().ToList()); PlexEpisodes.Setup(x => x.GetAllAsync()).ReturnsAsync(F.CreateMany<PlexEpisodes>().ToList());
Checker = new PlexAvailabilityChecker(SettingsMock.Object, RequestMock.Object, PlexMock.Object, CacheMock.Object, NotificationMock.Object, JobRec.Object, NotifyUsers.Object, PlexEpisodes.Object);
var episodes = await Checker.GetEpisodes(); var episodes = await Checker.GetEpisodes();
Assert.That(episodes.Count(), Is.GreaterThan(0)); Assert.That(episodes.Count(), Is.GreaterThan(0));

Loading…
Cancel
Save