mirror of https://github.com/Radarr/Radarr
Updated NotInQueueSpecification Tests.
This commit is contained in:
parent
53e723a301
commit
98d79dab20
|
@ -54,26 +54,30 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||||
|
|
||||||
private void GivenEmptyQueue()
|
private void GivenEmptyQueue()
|
||||||
{
|
{
|
||||||
Mocker.GetMock<IQueueService>()
|
Mocker.GetMock<IDownloadTrackingService>()
|
||||||
.Setup(s => s.GetQueue())
|
.Setup(s => s.GetQueuedDownloads())
|
||||||
.Returns(new List<Queue.Queue>());
|
.Returns(new TrackedDownload[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GivenQueue(IEnumerable<RemoteEpisode> remoteEpisodes)
|
private void GivenQueue(IEnumerable<RemoteEpisode> remoteEpisodes, TrackedDownloadState state = TrackedDownloadState.Downloading)
|
||||||
{
|
{
|
||||||
var queue = new List<Queue.Queue>();
|
var queue = new List<TrackedDownload>();
|
||||||
|
|
||||||
foreach (var remoteEpisode in remoteEpisodes)
|
foreach (var remoteEpisode in remoteEpisodes)
|
||||||
{
|
{
|
||||||
queue.Add(new Queue.Queue
|
queue.Add(new TrackedDownload
|
||||||
{
|
{
|
||||||
RemoteEpisode = remoteEpisode
|
State = state,
|
||||||
});
|
DownloadItem = new DownloadClientItem
|
||||||
|
{
|
||||||
|
RemoteEpisode = remoteEpisode
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Mocker.GetMock<IQueueService>()
|
Mocker.GetMock<IDownloadTrackingService>()
|
||||||
.Setup(s => s.GetQueue())
|
.Setup(s => s.GetQueuedDownloads())
|
||||||
.Returns(queue);
|
.Returns(queue.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -95,6 +99,23 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||||
Subject.IsSatisfiedBy(_remoteEpisode, null).Should().BeTrue();
|
Subject.IsSatisfiedBy(_remoteEpisode, null).Should().BeTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_return_true_when_download_is_failed()
|
||||||
|
{
|
||||||
|
var remoteEpisode = Builder<RemoteEpisode>.CreateNew()
|
||||||
|
.With(r => r.Series = _series)
|
||||||
|
.With(r => r.Episodes = new List<Episode> { _episode })
|
||||||
|
.With(r => r.ParsedEpisodeInfo = new ParsedEpisodeInfo
|
||||||
|
{
|
||||||
|
Quality = new QualityModel(Quality.DVD)
|
||||||
|
})
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
GivenQueue(new List<RemoteEpisode> { remoteEpisode }, TrackedDownloadState.DownloadFailed);
|
||||||
|
|
||||||
|
Subject.IsSatisfiedBy(_remoteEpisode, null).Should().BeTrue();
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_return_true_when_quality_in_queue_is_lower()
|
public void should_return_true_when_quality_in_queue_is_lower()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue