From 58a05fcef80fe71d22f43bc8eb8ee2bfac73d861 Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Sat, 30 Mar 2013 14:29:29 -0700 Subject: [PATCH] LazyList is now initilized using an empty list instead of null. --- .../ProviderTests/TvDbProviderTest.cs | 51 +++++-------------- NzbDrone.Core/Datastore/LazyList.cs | 1 + 2 files changed, 14 insertions(+), 38 deletions(-) diff --git a/NzbDrone.Core.Test/ProviderTests/TvDbProviderTest.cs b/NzbDrone.Core.Test/ProviderTests/TvDbProviderTest.cs index a437aed8a..721f71840 100644 --- a/NzbDrone.Core.Test/ProviderTests/TvDbProviderTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/TvDbProviderTest.cs @@ -1,50 +1,23 @@ using System; -using System.Collections.Generic; using System.Linq; -using Autofac; using FluentAssertions; using NUnit.Framework; -using NzbDrone.Common; using NzbDrone.Core.MetadataSource; -using NzbDrone.Core.Providers; using NzbDrone.Core.Test.Framework; -using NzbDrone.Test.Common; namespace NzbDrone.Core.Test.ProviderTests { [TestFixture] - - public class TvDbProviderTest : CoreTest - { - private TvDbProxy tvDbProxy; - - [SetUp] - public void Setup() - { - var builder = new ContainerBuilder(); - - builder.RegisterType(); - builder.RegisterType(); - - var container = builder.Build(); - - tvDbProxy = container.Resolve(); - } - - [TearDown] - public void TearDown() - { - //Todo: Is there a similar exception for wattvdb? - //ExceptionVerification.MarkInconclusive(typeof(TvdbNotAvailableException)); - } + public class TvDbProviderTest : CoreTest + { [TestCase("The Simpsons")] [TestCase("Family Guy")] [TestCase("South Park")] [TestCase("Franklin & Bash")] public void successful_search(string title) { - var result = tvDbProxy.SearchSeries(title); + var result = Subject.SearchSeries(title); result.Should().NotBeEmpty(); result[0].Title.Should().Be(title); @@ -54,26 +27,28 @@ namespace NzbDrone.Core.Test.ProviderTests [Test] public void no_search_result() { - - var result = tvDbProxy.SearchSeries(Guid.NewGuid().ToString()); - - + var result = Subject.SearchSeries(Guid.NewGuid().ToString()); result.Should().BeEmpty(); } - [Test] public void none_unique_season_episode_number() { - - var result = tvDbProxy.GetEpisodes(75978);//Family guy + var result = Subject.GetEpisodes(75978);//Family guy result.GroupBy(e => e.SeasonNumber.ToString("000") + e.EpisodeNumber.ToString("000")) .Max(e => e.Count()).Should().Be(1); - result.Select(c => c.TvDbEpisodeId).Should().OnlyHaveUniqueItems(); + } + + [Test] + public void should_be_able_to_get_series_detail() + { + var details = Subject.GetSeries(75978); + details.Should().NotBeNull(); + details.Covers.Value.Should().NotBeEmpty(); } } } \ No newline at end of file diff --git a/NzbDrone.Core/Datastore/LazyList.cs b/NzbDrone.Core/Datastore/LazyList.cs index e27709b48..17d0aba02 100644 --- a/NzbDrone.Core/Datastore/LazyList.cs +++ b/NzbDrone.Core/Datastore/LazyList.cs @@ -6,6 +6,7 @@ namespace NzbDrone.Core.Datastore public class LazyList : LazyLoaded> { public LazyList() + : this(new List()) { }