mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-07 21:42:16 -07:00
Fixed: NullReferenceException in GetAlbums
This commit is contained in:
parent
8109dfb0b7
commit
68b8ccc826
3 changed files with 41 additions and 2 deletions
|
@ -362,6 +362,7 @@
|
||||||
<Compile Include="ParserTests\NormalizeTitleFixture.cs" />
|
<Compile Include="ParserTests\NormalizeTitleFixture.cs" />
|
||||||
<Compile Include="ParserTests\ParserFixture.cs" />
|
<Compile Include="ParserTests\ParserFixture.cs" />
|
||||||
<Compile Include="ParserTests\ParsingServiceTests\GetArtistFixture.cs" />
|
<Compile Include="ParserTests\ParsingServiceTests\GetArtistFixture.cs" />
|
||||||
|
<Compile Include="ParserTests\ParsingServiceTests\GetAlbumsFixture.cs" />
|
||||||
<Compile Include="ParserTests\PathParserFixture.cs" />
|
<Compile Include="ParserTests\PathParserFixture.cs" />
|
||||||
<Compile Include="ParserTests\QualityParserFixture.cs" />
|
<Compile Include="ParserTests\QualityParserFixture.cs" />
|
||||||
<Compile Include="ParserTests\ReleaseGroupParserFixture.cs" />
|
<Compile Include="ParserTests\ReleaseGroupParserFixture.cs" />
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
using Moq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using NzbDrone.Core.Parser;
|
||||||
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
using NzbDrone.Core.Music;
|
||||||
|
using FizzWare.NBuilder;
|
||||||
|
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||||
|
using NzbDrone.Core.Parser.Model;
|
||||||
|
using FluentAssertions;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.Test.ParserTests.ParsingServiceTests
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class GetAlbumsFixture : CoreTest<ParsingService>
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void should_not_fail_if_search_criteria_contains_multiple_albums_with_the_same_name()
|
||||||
|
{
|
||||||
|
var artist = Builder<Artist>.CreateNew().Build();
|
||||||
|
var albums = Builder<Album>.CreateListOfSize(2).All().With(x => x.Title = "IdenticalTitle").Build().ToList();
|
||||||
|
var criteria = new AlbumSearchCriteria {
|
||||||
|
Artist = artist,
|
||||||
|
Albums = albums
|
||||||
|
};
|
||||||
|
|
||||||
|
var parsed = new ParsedAlbumInfo {
|
||||||
|
AlbumTitle = "IdenticalTitle"
|
||||||
|
};
|
||||||
|
|
||||||
|
Subject.GetAlbums(parsed, artist, criteria).Should().BeEquivalentTo(new List<Album>());
|
||||||
|
|
||||||
|
Mocker.GetMock<IAlbumService>()
|
||||||
|
.Verify(s => s.FindByTitle(artist.ArtistMetadataId, "IdenticalTitle"), Times.Once());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -149,7 +149,7 @@ namespace NzbDrone.Core.Parser
|
||||||
|
|
||||||
if (searchCriteria != null)
|
if (searchCriteria != null)
|
||||||
{
|
{
|
||||||
albumInfo = searchCriteria.Albums.SingleOrDefault(e => e.Title == albumTitle);
|
albumInfo = searchCriteria.Albums.ExclusiveOrDefault(e => e.Title == albumTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (albumInfo == null)
|
if (albumInfo == null)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue