|
|
|
@ -39,7 +39,7 @@ namespace NzbDrone.Core.Test.ImportListTests
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IImportListFactory>()
|
|
|
|
|
.Setup(v => v.Get(It.IsAny<int>()))
|
|
|
|
|
.Returns(new ImportListDefinition{ ShouldMonitor = true });
|
|
|
|
|
.Returns(new ImportListDefinition{ ShouldMonitor = ImportListMonitorType.SpecificAlbum });
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IFetchAndParseImportList>()
|
|
|
|
|
.Setup(v => v.Fetch())
|
|
|
|
@ -83,6 +83,13 @@ namespace NzbDrone.Core.Test.ImportListTests
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void WithMonitorType(ImportListMonitorType monitor)
|
|
|
|
|
{
|
|
|
|
|
Mocker.GetMock<IImportListFactory>()
|
|
|
|
|
.Setup(v => v.Get(It.IsAny<int>()))
|
|
|
|
|
.Returns(new ImportListDefinition{ ShouldMonitor = monitor });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_search_if_artist_title_and_no_artist_id()
|
|
|
|
|
{
|
|
|
|
@ -152,17 +159,20 @@ namespace NzbDrone.Core.Test.ImportListTests
|
|
|
|
|
.Verify(v => v.AddArtists(It.Is<List<Artist>>(t=>t.Count == 0)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_add_if_not_existing_artist()
|
|
|
|
|
[TestCase(ImportListMonitorType.None, false)]
|
|
|
|
|
[TestCase(ImportListMonitorType.SpecificAlbum, true)]
|
|
|
|
|
[TestCase(ImportListMonitorType.EntireArtist, true)]
|
|
|
|
|
public void should_add_if_not_existing_artist(ImportListMonitorType monitor, bool expectedArtistMonitored)
|
|
|
|
|
{
|
|
|
|
|
WithArtistId();
|
|
|
|
|
WithAlbum();
|
|
|
|
|
WithAlbumId();
|
|
|
|
|
WithMonitorType(monitor);
|
|
|
|
|
|
|
|
|
|
Subject.Execute(new ImportListSyncCommand());
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IAddArtistService>()
|
|
|
|
|
.Verify(v => v.AddArtists(It.Is<List<Artist>>(t => t.Count == 1)));
|
|
|
|
|
.Verify(v => v.AddArtists(It.Is<List<Artist>>(t => t.Count == 1 && t.First().Monitored == expectedArtistMonitored)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
@ -180,11 +190,12 @@ namespace NzbDrone.Core.Test.ImportListTests
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_mark_album_for_monitor_if_album_id()
|
|
|
|
|
public void should_mark_album_for_monitor_if_album_id_and_specific_monitor_selected()
|
|
|
|
|
{
|
|
|
|
|
WithArtistId();
|
|
|
|
|
WithAlbum();
|
|
|
|
|
WithAlbumId();
|
|
|
|
|
WithMonitorType(ImportListMonitorType.SpecificAlbum);
|
|
|
|
|
|
|
|
|
|
Subject.Execute(new ImportListSyncCommand());
|
|
|
|
|
|
|
|
|
@ -192,6 +203,20 @@ namespace NzbDrone.Core.Test.ImportListTests
|
|
|
|
|
.Verify(v => v.AddArtists(It.Is<List<Artist>>(t => t.Count == 1 && t.First().AddOptions.AlbumsToMonitor.Contains("09474d62-17dd-3a4f-98fb-04c65f38a479"))));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_not_mark_album_for_monitor_if_album_id_and_monitor_all_selected()
|
|
|
|
|
{
|
|
|
|
|
WithArtistId();
|
|
|
|
|
WithAlbum();
|
|
|
|
|
WithAlbumId();
|
|
|
|
|
WithMonitorType(ImportListMonitorType.EntireArtist);
|
|
|
|
|
|
|
|
|
|
Subject.Execute(new ImportListSyncCommand());
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IAddArtistService>()
|
|
|
|
|
.Verify(v => v.AddArtists(It.Is<List<Artist>>(t => t.Count == 1 && !t.First().AddOptions.AlbumsToMonitor.Any())));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_not_mark_album_for_monitor_if_no_album_id()
|
|
|
|
|
{
|
|
|
|
@ -202,6 +227,5 @@ namespace NzbDrone.Core.Test.ImportListTests
|
|
|
|
|
Mocker.GetMock<IAddArtistService>()
|
|
|
|
|
.Verify(v => v.AddArtists(It.Is<List<Artist>>(t => t.Count == 1 && t.First().AddOptions.AlbumsToMonitor.Count == 0)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|