LazyList is now initilized using an empty list instead of null.

This commit is contained in:
kay.one 2013-03-30 14:29:29 -07:00
parent 150b1902e9
commit 58a05fcef8
2 changed files with 14 additions and 38 deletions

View File

@ -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
public class TvDbProviderTest : CoreTest<TvDbProxy>
{
private TvDbProxy tvDbProxy;
[SetUp]
public void Setup()
{
var builder = new ContainerBuilder();
builder.RegisterType<EnvironmentProvider>();
builder.RegisterType<TvDbProxy>();
var container = builder.Build();
tvDbProxy = container.Resolve<TvDbProxy>();
}
[TearDown]
public void TearDown()
{
//Todo: Is there a similar exception for wattvdb?
//ExceptionVerification.MarkInconclusive(typeof(TvdbNotAvailableException));
}
[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();
}
}
}

View File

@ -6,6 +6,7 @@ namespace NzbDrone.Core.Datastore
public class LazyList<T> : LazyLoaded<List<T>>
{
public LazyList()
: this(new List<T>())
{
}