mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 21:43:33 -07:00
Adding some structure to NzbDrone.Core.Test
This commit is contained in:
parent
ae1a32b874
commit
e5c4f34e0e
41 changed files with 1673 additions and 1745 deletions
64
NzbDrone.Core.Test/JobTests/SeriesSearchJobTest.cs
Normal file
64
NzbDrone.Core.Test/JobTests/SeriesSearchJobTest.cs
Normal file
|
@ -0,0 +1,64 @@
|
|||
using System.Collections.Generic;
|
||||
using AutoMoq;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Providers.Jobs;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.JobTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
public class SeriesSearchJobTest : TestBase
|
||||
{
|
||||
[Test]
|
||||
public void SeriesSearch_success()
|
||||
{
|
||||
var seasons = new List<int> { 1, 2, 3, 4, 5 };
|
||||
|
||||
var mocker = new AutoMoqer(MockBehavior.Strict);
|
||||
|
||||
var notification = new ProgressNotification("Series Search");
|
||||
|
||||
mocker.GetMock<EpisodeProvider>()
|
||||
.Setup(c => c.GetSeasons(1)).Returns(seasons);
|
||||
|
||||
mocker.GetMock<EpisodeProvider>()
|
||||
.Setup(c => c.IsIgnored(It.IsAny<int>(), It.IsAny<int>())).Returns(false);
|
||||
|
||||
mocker.GetMock<SeasonSearchJob>()
|
||||
.Setup(c => c.Start(notification, 1, It.IsAny<int>())).Verifiable();
|
||||
|
||||
//Act
|
||||
mocker.Resolve<SeriesSearchJob>().Start(notification, 1, 0);
|
||||
|
||||
//Assert
|
||||
mocker.VerifyAllMocks();
|
||||
mocker.GetMock<SeasonSearchJob>().Verify(c => c.Start(notification, 1, It.IsAny<int>()),
|
||||
Times.Exactly(seasons.Count));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SeriesSearch_no_seasons()
|
||||
{
|
||||
var seasons = new List<int>();
|
||||
|
||||
var mocker = new AutoMoqer(MockBehavior.Strict);
|
||||
|
||||
var notification = new ProgressNotification("Series Search");
|
||||
|
||||
mocker.GetMock<EpisodeProvider>()
|
||||
.Setup(c => c.GetSeasons(1)).Returns(seasons);
|
||||
|
||||
//Act
|
||||
mocker.Resolve<SeriesSearchJob>().Start(notification, 1, 0);
|
||||
|
||||
//Assert
|
||||
mocker.VerifyAllMocks();
|
||||
mocker.GetMock<SeasonSearchJob>().Verify(c => c.Start(notification, 1, It.IsAny<int>()),
|
||||
Times.Never());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue