mirror of
https://github.com/lidarr/Lidarr
synced 2025-02-26 15:52:42 +00:00
Fixed: Add HistoryService Mock to Queue Fixture
This commit is contained in:
parent
0099d9f430
commit
caac321ef9
1 changed files with 30 additions and 18 deletions
|
@ -2,14 +2,17 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Core.Download.TrackedDownloads;
|
|
||||||
using NzbDrone.Core.Queue;
|
|
||||||
using NzbDrone.Core.Test.Framework;
|
|
||||||
using FizzWare.NBuilder;
|
using FizzWare.NBuilder;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
|
using Moq;
|
||||||
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
using NzbDrone.Core.Download.TrackedDownloads;
|
||||||
|
using NzbDrone.Core.History;
|
||||||
using NzbDrone.Core.Music;
|
using NzbDrone.Core.Music;
|
||||||
|
using NzbDrone.Core.Queue;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.QueueTests
|
namespace NzbDrone.Core.Test.QueueTests
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
|
@ -24,26 +27,35 @@ public void SetUp()
|
||||||
.With(v => v.RemainingTime = TimeSpan.FromSeconds(10))
|
.With(v => v.RemainingTime = TimeSpan.FromSeconds(10))
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
var series = Builder<Artist>.CreateNew()
|
var artist = Builder<Artist>.CreateNew()
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
var episodes = Builder<Album>.CreateListOfSize(3)
|
var albums = Builder<Album>.CreateListOfSize(3)
|
||||||
.All()
|
.All()
|
||||||
.With(e => e.ArtistId = series.Id)
|
.With(e => e.ArtistId = artist.Id)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
var remoteEpisode = Builder<RemoteAlbum>.CreateNew()
|
var remoteAlbum = Builder<RemoteAlbum>.CreateNew()
|
||||||
.With(r => r.Artist = series)
|
.With(r => r.Artist = artist)
|
||||||
.With(r => r.Albums = new List<Album>(episodes))
|
.With(r => r.Albums = new List<Album>(albums))
|
||||||
.With(r => r.ParsedAlbumInfo = new ParsedAlbumInfo())
|
.With(r => r.ParsedAlbumInfo = new ParsedAlbumInfo())
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
_trackedDownloads = Builder<TrackedDownload>.CreateListOfSize(1)
|
_trackedDownloads = Builder<TrackedDownload>.CreateListOfSize(1)
|
||||||
.All()
|
.All()
|
||||||
.With(v => v.DownloadItem = downloadItem)
|
.With(v => v.DownloadItem = downloadItem)
|
||||||
.With(v => v.RemoteAlbum = remoteEpisode)
|
.With(v => v.RemoteAlbum = remoteAlbum)
|
||||||
.Build()
|
.Build()
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
|
var historyItem = Builder<History.History>.CreateNew()
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
Mocker.GetMock<IHistoryService>()
|
||||||
|
.Setup(c => c.Find(It.IsAny<string>(), HistoryEventType.Grabbed)).Returns
|
||||||
|
(
|
||||||
|
new List<History.History> { historyItem }
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
|
Loading…
Reference in a new issue