public void should_match_tracks(string file) { var path = Path.Combine(TestContext.CurrentContext.TestDirectory, "Files", "Identification", file); var testcase = JsonConvert.DeserializeObject <IdTestCase>(File.ReadAllText(path)); var artists = GivenArtists(testcase.LibraryAuthors); var specifiedArtist = artists.SingleOrDefault(x => x.Metadata.Value.ForeignAuthorId == testcase.Author); var idOverrides = new IdentificationOverrides { Author = specifiedArtist }; var tracks = testcase.Tracks.Select(x => new LocalBook { Path = x.Path.AsOsAgnostic(), FileTrackInfo = x.FileTrackInfo }).ToList(); if (testcase.Fingerprints != null) { GivenFingerprints(testcase.Fingerprints); } var config = new ImportDecisionMakerConfig { NewDownload = testcase.NewDownload, SingleRelease = testcase.SingleRelease, IncludeExisting = false }; var result = _Subject.Identify(tracks, idOverrides, config); result.Should().HaveCount(testcase.ExpectedMusicBrainzReleaseIds.Count); }
public void should_match_tracks(string file) { var path = Path.Combine(TestContext.CurrentContext.TestDirectory, "Files", "Identification", file); var testcase = JsonConvert.DeserializeObject <IdTestCase>(File.ReadAllText(path)); var artists = GivenArtists(testcase.LibraryArtists); var specifiedArtist = artists.SingleOrDefault(x => x.Metadata.Value.ForeignArtistId == testcase.Artist); var tracks = testcase.Tracks.Select(x => new LocalTrack { Path = x.Path.AsOsAgnostic(), FileTrackInfo = x.FileTrackInfo }).ToList(); if (testcase.Fingerprints != null) { GivenFingerprints(testcase.Fingerprints); } var result = Subject.Identify(tracks, specifiedArtist, null, null, testcase.NewDownload, testcase.SingleRelease, false); TestLogger.Debug($"Found releases:\n{result.Where(x => x.AlbumRelease != null).Select(x => x.AlbumRelease?.ForeignReleaseId).ToJson()}"); result.Should().HaveCount(testcase.ExpectedMusicBrainzReleaseIds.Count); result.Where(x => x.AlbumRelease != null).Select(x => x.AlbumRelease.ForeignReleaseId).ShouldBeEquivalentTo(testcase.ExpectedMusicBrainzReleaseIds); }