1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2024-12-30 19:56:54 +00:00
Sonarr/NzbDrone.Core.Test/ProviderTests/TvDbProviderTest.cs
Mark McDowall a6e8ec6123 XemClient added
New: Now using the thexem.de for episode information
2012-10-13 12:44:19 -07:00

72 lines
No EOL
1.8 KiB
C#

// ReSharper disable RedundantUsingDirective
using System;
using System.Collections.Generic;
using System.Linq;
using FluentAssertions;
using NUnit.Framework;
using Ninject;
using NzbDrone.Common;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common;
using XemLib.Data;
using XemLib.Exceptions;
namespace NzbDrone.Core.Test.ProviderTests
{
[TestFixture]
// ReSharper disable InconsistentNaming
public class TvDbProviderTest : CoreTest
{
private TvDbProvider tvDbProvider;
[SetUp]
public void Setup()
{
tvDbProvider = new StandardKernel().Get<TvDbProvider>();
}
[TearDown]
public void TearDown()
{
ExceptionVerification.MarkInconclusive(typeof(TheTvbdbUnavailableException));
}
[TestCase("The Simpsons")]
[TestCase("Family Guy")]
[TestCase("South Park")]
public void successful_search(string title)
{
var result = tvDbProvider.SearchSeries(title);
result.Should().NotBeEmpty();
result[0].SeriesName.Should().Be(title);
}
[Test]
public void no_search_result()
{
//act
var result = tvDbProvider.SearchSeries(Guid.NewGuid().ToString());
//assert
result.Should().BeEmpty();
}
[Test]
public void none_unique_season_episode_number()
{
//act
var result = tvDbProvider.GetSeries(75978, true);//Family guy
//Asserts that when episodes are grouped by Season/Episode each group contains maximum of
//one item.
result.Episodes.GroupBy(e => e.SeasonNumber.ToString("000") + e.EpisodeNumber.ToString("000"))
.Max(e => e.Count()).Should().Be(1);
}
}
}