mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 13:33:34 -07:00
Updated JobProvider to allow jobs with two targets.
JobQueueItem class created instead of using Tuples. Added Search for Season and Rename Season jobs , plus links for them on Series/Details. Add GetSeasonFiles added to MediaFileProvider.
This commit is contained in:
parent
56da830296
commit
350e0388de
32 changed files with 454 additions and 108 deletions
72
NzbDrone.Core.Test/SeasonSearchJobTest.cs
Normal file
72
NzbDrone.Core.Test/SeasonSearchJobTest.cs
Normal file
|
@ -0,0 +1,72 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using AutoMoq;
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Providers.Indexer;
|
||||
using NzbDrone.Core.Providers.Jobs;
|
||||
using NzbDrone.Core.Repository;
|
||||
using NzbDrone.Core.Repository.Quality;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
public class SeasonSearchJobTest : TestBase
|
||||
{
|
||||
[Test]
|
||||
public void SeasonSearch_success()
|
||||
{
|
||||
var episodes = Builder<Episode>.CreateListOfSize(5)
|
||||
.WhereAll()
|
||||
.Have(e => e.SeriesId = 1)
|
||||
.Have(e => e.SeasonNumber = 1)
|
||||
.Build();
|
||||
|
||||
var mocker = new AutoMoqer(MockBehavior.Strict);
|
||||
|
||||
var notification = new ProgressNotification("Season Search");
|
||||
|
||||
mocker.GetMock<EpisodeProvider>()
|
||||
.Setup(c => c.GetEpisodesBySeason(1, 1)).Returns(episodes);
|
||||
|
||||
mocker.GetMock<EpisodeSearchJob>()
|
||||
.Setup(c => c.Start(notification, It.IsAny<int>(), 0)).Verifiable();
|
||||
|
||||
//Act
|
||||
mocker.Resolve<SeasonSearchJob>().Start(notification, 1, 1);
|
||||
|
||||
//Assert
|
||||
mocker.VerifyAllMocks();
|
||||
mocker.GetMock<EpisodeSearchJob>().Verify(c => c.Start(notification, It.IsAny<int>(), 0),
|
||||
Times.Exactly(episodes.Count));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SeasonSearch_no_episodes()
|
||||
{
|
||||
var mocker = new AutoMoqer(MockBehavior.Strict);
|
||||
var notification = new ProgressNotification("Season Search");
|
||||
List<Episode> nullList = null;
|
||||
|
||||
mocker.GetMock<EpisodeProvider>()
|
||||
.Setup(c => c.GetEpisodesBySeason(1, 1)).Returns(nullList);
|
||||
|
||||
//Act
|
||||
mocker.Resolve<SeasonSearchJob>().Start(notification, 1, 1);
|
||||
|
||||
//Assert
|
||||
mocker.VerifyAllMocks();
|
||||
mocker.GetMock<EpisodeSearchJob>().Verify(c => c.Start(notification, It.IsAny<int>(), 0),
|
||||
Times.Never());
|
||||
ExceptionVerification.ExcpectedWarns(1);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue