@ -2,14 +2,17 @@ using System;
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]
@ -21,29 +24,38 @@ namespace NzbDrone.Core.Test.QueueTests
public void SetUp ( )
public void SetUp ( )
{
{
var downloadItem = Builder < NzbDrone . Core . Download . DownloadClientItem > . CreateNew ( )
var downloadItem = Builder < NzbDrone . Core . Download . DownloadClientItem > . CreateNew ( )
. With ( v = > v . RemainingTime = TimeSpan . FromSeconds ( 10 ) )
. With ( v = > v . RemainingTime = TimeSpan . FromSeconds ( 10 ) )
. Build ( ) ;
. Build ( ) ;
var artist = Builder < Artist > . CreateNew ( )
. Build ( ) ;
var series = Builder < Artist > . CreateNew ( )
var albums = Builder < Album > . CreateListOfSize ( 3 )
. Build ( ) ;
. All ( )
. With ( e = > e . ArtistId = artist . Id )
. Build ( ) ;
var episodes = Builder < Album > . CreateListOfSize ( 3 )
var remoteAlbum = Builder < RemoteAlbum > . CreateNew ( )
. All ( )
. With ( r = > r . Artist = artist )
. With ( e = > e . ArtistId = series . Id )
. With ( r = > r . Albums = new List < Album > ( albums ) )
. Build ( ) ;
. With ( r = > r . ParsedAlbumInfo = new ParsedAlbumInfo ( ) )
. Build ( ) ;
var remoteEpisode = Builder < RemoteAlbum > . CreateNew ( )
. With ( r = > r . Artist = series )
. With ( r = > r . Albums = new List < Album > ( episodes ) )
. With ( r = > r . ParsedAlbumInfo = new ParsedAlbumInfo ( ) )
. 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 = remote Episode )
. 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]