1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-10-30 15:32:31 +01:00

Empty directors and writers won't blowup

This commit is contained in:
Mark McDowall 2012-07-14 20:43:14 -07:00
parent c0b81a8971
commit 2982e79065
2 changed files with 28 additions and 2 deletions

View File

@ -121,6 +121,16 @@ namespace NzbDrone.Core.Test.ProviderTests.Metadata
.Returns(episodes.ToList());
}
private void WithNoDirectors()
{
tvdbSeries.Episodes.ForEach(e => e.Directors = new List<string>());
}
private void WithNoWriters()
{
tvdbSeries.Episodes.ForEach(e => e.Writer = new List<string>());
}
[Test]
public void should_not_blowup()
{
@ -151,5 +161,21 @@ namespace NzbDrone.Core.Test.ProviderTests.Metadata
Mocker.Resolve<Xbmc>().CreateForEpisodeFile(episodeFile, tvdbSeries);
Mocker.GetMock<BannerProvider>().Verify(v => v.Download(tvdbSeries.Episodes.First().BannerPath, episodeFile.Path.Replace("avi", "tbn")), Times.Once());
}
[Test]
public void should_not_blowup_when_director_is_not_found()
{
WithSingleEpisodeFile();
WithNoDirectors();
Mocker.Resolve<Xbmc>().CreateForEpisodeFile(episodeFile, tvdbSeries);
}
[Test]
public void should_not_blowup_when_writer_is_not_found()
{
WithSingleEpisodeFile();
WithNoWriters();
Mocker.Resolve<Xbmc>().CreateForEpisodeFile(episodeFile, tvdbSeries);
}
}
}

View File

@ -155,8 +155,8 @@ namespace NzbDrone.Core.Providers.Metadata
details.Add(new XElement("displayepisode"));
details.Add(new XElement("thumb", "http://www.thetvdb.com/banners/" + tvdbEpisode.BannerPath));
details.Add(new XElement("watched", "false"));
details.Add(new XElement("credits", tvdbEpisode.Writer.First()));
details.Add(new XElement("director", tvdbEpisode.Directors.First()));
details.Add(new XElement("credits", tvdbEpisode.Writer.FirstOrDefault()));
details.Add(new XElement("director", tvdbEpisode.Directors.FirstOrDefault()));
details.Add(new XElement("rating", tvDbSeries.Rating));
foreach(var actor in tvdbEpisode.GuestStars)