mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-07 13:32:17 -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\ParserFixture.cs" />
|
||||
<Compile Include="ParserTests\ParsingServiceTests\GetArtistFixture.cs" />
|
||||
<Compile Include="ParserTests\ParsingServiceTests\GetAlbumsFixture.cs" />
|
||||
<Compile Include="ParserTests\PathParserFixture.cs" />
|
||||
<Compile Include="ParserTests\QualityParserFixture.cs" />
|
||||
<Compile Include="ParserTests\ReleaseGroupParserFixture.cs" />
|
||||
|
@ -613,4 +614,4 @@
|
|||
</ItemGroup>
|
||||
<Copy SourceFiles="@(IdentificationTestCases)" DestinationFolder="$(OutputPath)\Files\Identification\" SkipUnchangedFiles="true" />
|
||||
</Target>
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
albumInfo = searchCriteria.Albums.SingleOrDefault(e => e.Title == albumTitle);
|
||||
albumInfo = searchCriteria.Albums.ExclusiveOrDefault(e => e.Title == albumTitle);
|
||||
}
|
||||
|
||||
if (albumInfo == null)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue