2010-09-23 06:19:47 +03:00
|
|
|
using System;
|
|
|
|
using MbUnit.Framework;
|
2010-09-28 07:25:41 +03:00
|
|
|
using NzbDrone.Core.Providers;
|
2011-05-19 06:55:35 +03:00
|
|
|
using NzbDrone.Core.Test.Framework;
|
2010-09-23 06:19:47 +03:00
|
|
|
|
|
|
|
namespace NzbDrone.Core.Test
|
|
|
|
{
|
|
|
|
[TestFixture]
|
2010-10-08 01:17:24 +03:00
|
|
|
// ReSharper disable InconsistentNaming
|
2011-05-19 06:55:35 +03:00
|
|
|
public class TvDbProviderTest : TestBase
|
2010-09-23 06:19:47 +03:00
|
|
|
{
|
|
|
|
[Test]
|
|
|
|
[Row("The Simpsons")]
|
|
|
|
[Row("Family Guy")]
|
|
|
|
[Row("South Park")]
|
2010-10-05 09:21:18 +03:00
|
|
|
[Row("clone high, usa")]
|
|
|
|
public void successful_search(string title)
|
2010-09-23 06:19:47 +03:00
|
|
|
{
|
2010-10-05 09:21:18 +03:00
|
|
|
var tvCont = new TvDbProvider();
|
2010-09-23 06:19:47 +03:00
|
|
|
var result = tvCont.SearchSeries(title);
|
|
|
|
|
2010-10-05 09:21:18 +03:00
|
|
|
Assert.IsNotEmpty(result);
|
2010-09-23 06:19:47 +03:00
|
|
|
Assert.AreEqual(title, result[0].SeriesName, StringComparison.InvariantCultureIgnoreCase);
|
|
|
|
}
|
2010-10-05 09:21:18 +03:00
|
|
|
|
|
|
|
[Test]
|
|
|
|
[Row("The Simpsons")]
|
|
|
|
[Row("Family Guy")]
|
|
|
|
[Row("South Park")]
|
|
|
|
public void successful_title_lookup(string title)
|
|
|
|
{
|
|
|
|
var tvCont = new TvDbProvider();
|
|
|
|
var result = tvCont.GetSeries(title);
|
|
|
|
|
|
|
|
Assert.AreEqual(title, result.SeriesName, StringComparison.InvariantCultureIgnoreCase);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
2011-04-10 05:44:01 +03:00
|
|
|
[Row(new object[] {"CAPITAL", "capital", true})]
|
|
|
|
[Row(new object[] {"Something!!", "Something", true})]
|
|
|
|
[Row(new object[] {"Simpsons 2000", "Simpsons", true})]
|
|
|
|
[Row(new object[] {"Simp222sons", "Simpsons", true})]
|
|
|
|
[Row(new object[] {"Simpsons", "The Simpsons", true})]
|
|
|
|
[Row(new object[] {"Law and order", "Law & order", true})]
|
|
|
|
[Row(new object[] {"xxAndxx", "xxxx", false})]
|
|
|
|
[Row(new object[] {"Andxx", "xx", false})]
|
|
|
|
[Row(new object[] {"xxAnd", "xx", false})]
|
|
|
|
[Row(new object[] {"Thexx", "xx", false})]
|
|
|
|
[Row(new object[] {"Thexx", "xx", false})]
|
|
|
|
[Row(new object[] {"xxThexx", "xxxxx", false})]
|
|
|
|
[Row(new object[] {"Simpsons The", "Simpsons", true})]
|
2010-10-05 09:21:18 +03:00
|
|
|
public void Name_match_test(string a, string b, bool match)
|
|
|
|
{
|
|
|
|
bool result = TvDbProvider.IsTitleMatch(a, b);
|
|
|
|
|
|
|
|
Assert.AreEqual(match, result, "{0} , {1}", a, b);
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void no_search_result()
|
|
|
|
{
|
|
|
|
//setup
|
|
|
|
var tvdbProvider = new TvDbProvider();
|
|
|
|
|
|
|
|
//act
|
2011-03-30 09:18:35 +03:00
|
|
|
var result = tvdbProvider.SearchSeries(Guid.NewGuid().ToString());
|
2010-10-05 09:21:18 +03:00
|
|
|
|
|
|
|
//assert
|
|
|
|
Assert.IsEmpty(result);
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void no_result_title_lookup()
|
|
|
|
{
|
|
|
|
//setup
|
|
|
|
var tvdbProvider = new TvDbProvider();
|
|
|
|
|
|
|
|
//act
|
|
|
|
var result = tvdbProvider.GetSeries("clone high");
|
|
|
|
|
|
|
|
//assert
|
|
|
|
Assert.IsNull(result);
|
|
|
|
}
|
2010-09-23 06:19:47 +03:00
|
|
|
}
|
2011-04-10 05:44:01 +03:00
|
|
|
}
|