Lidarr/src/NzbDrone.Core.Test/MetadataSource/SkyHook/SkyHookProxySearchFixture.cs

88 lines
2.8 KiB
C#
Raw Normal View History

using FluentAssertions;
2015-08-12 20:53:51 +00:00
using NUnit.Framework;
using NzbDrone.Core.MetadataSource.SkyHook;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common;
using NzbDrone.Test.Common.Categories;
using Moq;
using NzbDrone.Core.Profiles.Metadata;
using NzbDrone.Core.Music;
using System.Collections.Generic;
2015-08-12 20:53:51 +00:00
namespace NzbDrone.Core.Test.MetadataSource.SkyHook
{
[TestFixture]
[IntegrationTest]
public class SkyHookProxySearchFixture : CoreTest<SkyHookProxy>
{
[SetUp]
public void Setup()
{
UseRealHttp();
var _metadataProfile = new MetadataProfile
{
Id = 1,
PrimaryAlbumTypes = new List<ProfilePrimaryAlbumTypeItem>
{
new ProfilePrimaryAlbumTypeItem
{
PrimaryAlbumType = PrimaryAlbumType.Album,
Allowed = true
}
},
SecondaryAlbumTypes = new List<ProfileSecondaryAlbumTypeItem>
{
new ProfileSecondaryAlbumTypeItem()
{
SecondaryAlbumType = SecondaryAlbumType.Studio,
Allowed = true
}
},
};
Mocker.GetMock<IMetadataProfileService>()
.Setup(s => s.All())
.Returns(new List<MetadataProfile>{_metadataProfile});
Mocker.GetMock<IMetadataProfileService>()
.Setup(s => s.Get(It.IsAny<int>()))
.Returns(_metadataProfile);
2015-08-12 20:53:51 +00:00
}
2017-08-24 01:39:27 +00:00
[TestCase("Coldplay", "Coldplay")]
[TestCase("Avenged Sevenfold", "Avenged Sevenfold")]
[TestCase("3OH!3", "3OH!3")]
[TestCase("Where's Kitty?", "Where's Kitty?")]
[TestCase("The Academy Is...", "The Academy Is...")]
[TestCase("lidarr:f59c5520-5f46-4d2c-b2c4-822eabf53419", "Linkin Park")]
[TestCase("lidarrid:f59c5520-5f46-4d2c-b2c4-822eabf53419", "Linkin Park")]
[TestCase("lidarrid: f59c5520-5f46-4d2c-b2c4-822eabf53419 ", "Linkin Park")]
2015-08-12 20:53:51 +00:00
public void successful_search(string title, string expected)
{
2017-08-24 01:39:27 +00:00
var result = Subject.SearchForNewArtist(title);
2015-08-12 20:53:51 +00:00
result.Should().NotBeEmpty();
2017-08-24 01:39:27 +00:00
result[0].Name.Should().Be(expected);
2015-08-12 20:53:51 +00:00
ExceptionVerification.IgnoreWarns();
}
2017-08-24 01:39:27 +00:00
[TestCase("lidarrid:")]
[TestCase("lidarrid: 99999999999999999999")]
[TestCase("lidarrid: 0")]
[TestCase("lidarrid: -12")]
[TestCase("lidarrid:289578")]
2015-08-12 20:53:51 +00:00
[TestCase("adjalkwdjkalwdjklawjdlKAJD;EF")]
public void no_search_result(string term)
{
2017-08-24 01:39:27 +00:00
var result = Subject.SearchForNewArtist(term);
2015-08-12 20:53:51 +00:00
result.Should().BeEmpty();
ExceptionVerification.IgnoreWarns();
}
}
}