From d8d9d44534739e1ffa3d1fc9d2b1698f2495c3fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B8=D1=82=D0=B0=D0=BB=D0=B8=D0=B9=20=D0=9A=D0=B2?= =?UTF-8?q?=D0=B0=D1=88=D0=B8=D0=BD?= Date: Sun, 17 Dec 2023 22:53:03 +0400 Subject: [PATCH] #17 Fixed instrumental song results for all providers except AZLyrics. --- LyricsScraperNET.Client/Program.cs | 16 +- .../TestModel/LyricsTestData.cs | 7 +- LyricsScraperNET/LyricsScraperClient.cs | 8 +- .../Requests/ArtistAndSongSearchRequest.cs | 5 + .../Models/Requests/UriSearchRequest.cs | 5 + .../Providers/AZLyrics/AZLyricsProvider.cs | 12 +- .../Providers/LyricFind/LyricFindProvider.cs | 57 +- .../SongLyrics/SongLyricsProvider.cs | 26 +- .../LyricsScraperNET.IntegrationTest.csproj | 12 + .../Properties/launchSettings.json | 8 - .../Providers/Genius/GeniusProviderTest.cs | 21 + .../Genius/instrumental_test_data.json | 8 + .../LyricFind/LyricFindProviderTest.cs | 21 + .../LyricFind/instrumental_test_data.json | 8 + .../Musixmatch/MusixmatchProviderTest.cs | 21 + .../Musixmatch/instrumental_test_data.json | 8 + .../SongLyrics/SongLyricsProviderTest.cs | 21 + .../SongLyrics/instrumental_test_data.json | 8 + .../LyricsScraperClientTests.cs | 14 + .../LyricsScraperNET.UnitTest.csproj | 18 + .../Providers/Genius/GeniusProviderTest.cs | 24 + .../Resources/Instrumental_HtmlPage_01.txt | 967 +++++++++++++++ .../Genius/instrumental_test_data.json | 9 + .../LyricFind/LyricFindProviderTest.cs | 23 + .../Resources/Instrumental_HtmlPage_01.txt | 17 + .../LyricFind/instrumental_test_data.json | 9 + .../Resources/Instrumental_HtmlPage_01.txt | 1092 +++++++++++++++++ .../SongLyrics/SongLyricsProviderTest.cs | 23 + .../SongLyrics/instrumental_test_data.json | 9 + 29 files changed, 2435 insertions(+), 42 deletions(-) delete mode 100644 Tests/LyricsScraperNET.IntegrationTest/Properties/launchSettings.json create mode 100644 Tests/LyricsScraperNET.IntegrationTest/Providers/Genius/instrumental_test_data.json create mode 100644 Tests/LyricsScraperNET.IntegrationTest/Providers/LyricFind/instrumental_test_data.json create mode 100644 Tests/LyricsScraperNET.IntegrationTest/Providers/Musixmatch/instrumental_test_data.json create mode 100644 Tests/LyricsScraperNET.IntegrationTest/Providers/SongLyrics/instrumental_test_data.json create mode 100644 Tests/LyricsScraperNET.UnitTest/Providers/Genius/Resources/Instrumental_HtmlPage_01.txt create mode 100644 Tests/LyricsScraperNET.UnitTest/Providers/Genius/instrumental_test_data.json create mode 100644 Tests/LyricsScraperNET.UnitTest/Providers/LyricFind/Resources/Instrumental_HtmlPage_01.txt create mode 100644 Tests/LyricsScraperNET.UnitTest/Providers/LyricFind/instrumental_test_data.json create mode 100644 Tests/LyricsScraperNET.UnitTest/Providers/SongLyrics/Resources/Instrumental_HtmlPage_01.txt create mode 100644 Tests/LyricsScraperNET.UnitTest/Providers/SongLyrics/instrumental_test_data.json diff --git a/LyricsScraperNET.Client/Program.cs b/LyricsScraperNET.Client/Program.cs index c3eb549..c58a80f 100644 --- a/LyricsScraperNET.Client/Program.cs +++ b/LyricsScraperNET.Client/Program.cs @@ -22,6 +22,10 @@ static async Task Main() string artistToSearch = "Parkway Drive"; string songToSearch = "Idols And Anchors"; + //// The case when a song contains only an instrumental, without vocals. + //string artistToSearch = "Rush"; + //string songToSearch = "YYZ"; + //// How to configure for ASP.NET applications: var result = ExampleWithHostConfiguration(artistToSearch, songToSearch); @@ -37,14 +41,14 @@ static async Task Main() if (result.Instrumental) { Console.ForegroundColor = ConsoleColor.Gray; - Console.WriteLine("This song is instrumental.\r\nIt does not contain any lyrics"); + Console.WriteLine($"This song [{artistToSearch} - {songToSearch}] is instrumental.\r\nIt does not contain any lyrics"); } else { Console.ForegroundColor = ConsoleColor.Red; - Console.WriteLine($"Can't find lyrics for: [ {artistToSearch} - {songToSearch} ]. " + - $"Status code: [ {result.ResponseStatusCode} ]. " + - $"Response message: [ {result.ResponseMessage} ]."); + Console.WriteLine($"Can't find lyrics for: [{artistToSearch} - {songToSearch}]. " + + $"Status code: [{result.ResponseStatusCode}]. " + + $"Response message: [{result.ResponseMessage}]."); } Console.ResetColor(); @@ -54,13 +58,13 @@ static async Task Main() //// Output result to console Console.ForegroundColor = ConsoleColor.Yellow; - Console.WriteLine($"[ {artistToSearch} - {songToSearch} ]\r\n"); + Console.WriteLine($"[{artistToSearch} - {songToSearch}]\r\n"); Console.ResetColor(); Console.WriteLine(result.LyricText); Console.ForegroundColor = ConsoleColor.Magenta; - Console.WriteLine($"\r\nThis lyric was found by [ {result.ExternalProviderType} ]\r\n"); + Console.WriteLine($"\r\nThis lyric was found by [{result.ExternalProviderType}]\r\n"); Console.ResetColor(); Console.ReadLine(); diff --git a/LyricsScraperNET.TestShared/TestModel/LyricsTestData.cs b/LyricsScraperNET.TestShared/TestModel/LyricsTestData.cs index 0360579..a44b2c4 100644 --- a/LyricsScraperNET.TestShared/TestModel/LyricsTestData.cs +++ b/LyricsScraperNET.TestShared/TestModel/LyricsTestData.cs @@ -10,8 +10,11 @@ public class LyricsTestData public string SongName { get; set; } public string SongUri { get; set; } - public string LyricPageData => File.ReadAllText(LyricPagePath); + public string LyricPageData => ReadFileData(LyricPagePath); - public string LyricResultData => File.ReadAllText(LyricResultPath); + public string LyricResultData => ReadFileData(LyricResultPath); + + private string ReadFileData(string path) => + !string.IsNullOrEmpty(path) ? File.ReadAllText(path) : string.Empty; } } diff --git a/LyricsScraperNET/LyricsScraperClient.cs b/LyricsScraperNET/LyricsScraperClient.cs index a8c90f3..d43c01a 100644 --- a/LyricsScraperNET/LyricsScraperClient.cs +++ b/LyricsScraperNET/LyricsScraperClient.cs @@ -74,11 +74,11 @@ public SearchResult SearchLyric(SearchRequest searchRequest) { return providerSearchResult; } - _logger?.LogWarning($"Can't find lyric by provider: {externalProvider}."); + _logger?.LogWarning($"Can't find lyric by provider: [{externalProvider.Options?.ExternalProviderType}]."); } searchResult.AddNoDataFoundMessage(Constants.ResponseMessages.NotFoundLyric); - _logger?.LogError($"Can't find lyrics for searchRequest: {searchRequest}."); + _logger?.LogError($"Can't find lyrics for searchRequest: [{searchRequest}]."); return searchResult; } @@ -106,11 +106,11 @@ public async Task SearchLyricAsync(SearchRequest searchRequest) { return providerSearchResult; } - _logger?.LogWarning($"Can't find lyric by provider: {externalProvider}."); + _logger?.LogWarning($"Can't find lyric by provider: [{externalProvider.Options?.ExternalProviderType}]."); } searchResult.AddNoDataFoundMessage(Constants.ResponseMessages.NotFoundLyric); - _logger?.LogError($"Can't find lyrics for searchRequest: {searchRequest}."); + _logger?.LogError($"Can't find lyrics for searchRequest: [{searchRequest}]."); return searchResult; } diff --git a/LyricsScraperNET/Models/Requests/ArtistAndSongSearchRequest.cs b/LyricsScraperNET/Models/Requests/ArtistAndSongSearchRequest.cs index d0e4b5e..4572372 100644 --- a/LyricsScraperNET/Models/Requests/ArtistAndSongSearchRequest.cs +++ b/LyricsScraperNET/Models/Requests/ArtistAndSongSearchRequest.cs @@ -34,5 +34,10 @@ public ArtistAndSongSearchRequest(string artist, string song, ExternalProviderTy { Provider = provider; } + + public override string ToString() + { + return $"Artist: [{Artist}]. Song: [{Song}]. Provider: [{Provider}]"; + } } } diff --git a/LyricsScraperNET/Models/Requests/UriSearchRequest.cs b/LyricsScraperNET/Models/Requests/UriSearchRequest.cs index 6e8f27a..5620b95 100644 --- a/LyricsScraperNET/Models/Requests/UriSearchRequest.cs +++ b/LyricsScraperNET/Models/Requests/UriSearchRequest.cs @@ -35,5 +35,10 @@ public UriSearchRequest(string uri) : this(new Uri(uri)) public UriSearchRequest(string uri, ExternalProviderType provider) : this(new Uri(uri), provider) { } + + public override string ToString() + { + return $"Uri: [{Uri}]. Provider: [{Provider}]"; + } } } diff --git a/LyricsScraperNET/Providers/AZLyrics/AZLyricsProvider.cs b/LyricsScraperNET/Providers/AZLyrics/AZLyricsProvider.cs index 3264fb2..7e3957e 100644 --- a/LyricsScraperNET/Providers/AZLyrics/AZLyricsProvider.cs +++ b/LyricsScraperNET/Providers/AZLyrics/AZLyricsProvider.cs @@ -68,7 +68,7 @@ protected override SearchResult SearchLyric(Uri uri) if (WebClient == null || Parser == null) { _logger?.LogWarning($"AZLyrics. Please set up WebClient and Parser first"); - return new SearchResult(); + return new SearchResult(Models.ExternalProviderType.AZLyrics); } var text = WebClient.Load(uri); return PostProcessLyric(uri, text); @@ -88,7 +88,7 @@ protected override async Task SearchLyricAsync(Uri uri) if (WebClient == null || Parser == null) { _logger?.LogWarning($"AZLyrics. Please set up WebClient and Parser first"); - return new SearchResult(); + return new SearchResult(Models.ExternalProviderType.AZLyrics); } var text = await WebClient.LoadAsync(uri); return PostProcessLyric(uri, text); @@ -105,16 +105,16 @@ private SearchResult PostProcessLyric(Uri uri, string text) { if (string.IsNullOrEmpty(text)) { - _logger?.LogWarning($"AZLyrics. Text is empty for {uri}"); - return new SearchResult(); + _logger?.LogWarning($"AZLyrics. Text is empty for Uri: [{uri}]"); + return new SearchResult(Models.ExternalProviderType.AZLyrics); } var startIndex = text.IndexOf(_lyricStart); var endIndex = text.IndexOf(_lyricEnd); if (startIndex <= 0 || endIndex <= 0) { - _logger?.LogWarning($"AZLyrics. Can't find lyrics for {uri}"); - return new SearchResult(); + _logger?.LogWarning($"AZLyrics. Can't find lyrics for Uri: [{uri}]"); + return new SearchResult(Models.ExternalProviderType.AZLyrics); } string result = Parser.Parse(text.Substring(startIndex, endIndex - startIndex)); diff --git a/LyricsScraperNET/Providers/LyricFind/LyricFindProvider.cs b/LyricsScraperNET/Providers/LyricFind/LyricFindProvider.cs index a28b009..b0a861e 100644 --- a/LyricsScraperNET/Providers/LyricFind/LyricFindProvider.cs +++ b/LyricsScraperNET/Providers/LyricFind/LyricFindProvider.cs @@ -1,4 +1,5 @@ -using LyricsScraperNET.Helpers; +using LyricsScraperNET.Extensions; +using LyricsScraperNET.Helpers; using LyricsScraperNET.Models.Responses; using LyricsScraperNET.Network; using LyricsScraperNET.Providers.Abstract; @@ -14,8 +15,16 @@ public sealed class LyricFindProvider : ExternalProviderBase private ILogger _logger; private readonly IExternalUriConverter _uriConverter; + /// + /// Field name in json format that contains lyric text. + /// private const string _lyricStart = "\"lyrics\""; + // "instrumental":true + private const string _instrumentalStart = "\"instrumental\""; + // "songIsInstrumental":true + private const string _songIsInstrumentalStart = "\"songIsInstrumental\""; + #region Constructors public LyricFindProvider() @@ -67,7 +76,7 @@ protected override SearchResult SearchLyric(Uri uri) if (WebClient == null || Parser == null) { _logger?.LogWarning($"LyricFind. Please set up WebClient and Parser first"); - return new SearchResult(); + return new SearchResult(Models.ExternalProviderType.LyricFind); } var text = WebClient.Load(uri); return PostProcessLyric(uri, text); @@ -87,7 +96,7 @@ protected override async Task SearchLyricAsync(Uri uri) if (WebClient == null || Parser == null) { _logger?.LogWarning($"LyricFind. Please set up WebClient and Parser first"); - return new SearchResult(); + return new SearchResult(Models.ExternalProviderType.LyricFind); } var text = await WebClient.LoadAsync(uri); return PostProcessLyric(uri, text); @@ -104,15 +113,19 @@ private SearchResult PostProcessLyric(Uri uri, string text) { if (string.IsNullOrEmpty(text)) { - _logger?.LogWarning($"LyricFind. Text is empty for {uri}"); - return new SearchResult(); + _logger?.LogWarning($"LyricFind. Text is empty for Uri: [{uri}]"); + return new SearchResult(Models.ExternalProviderType.LyricFind); } var startIndex = text.IndexOf(_lyricStart); if (startIndex <= 0) { - _logger?.LogWarning($"LyricFind. Can't find lyrics for {uri}"); - return new SearchResult(); + // In case of instrumental song it could not contains lyric field. + if (IsInstumentalLyric(text)) + return new SearchResult(Models.ExternalProviderType.LyricFind).AddInstrumental(true); + + _logger?.LogWarning($"LyricFind. Can't find lyrics for Uri: [{uri}]"); + return new SearchResult(Models.ExternalProviderType.LyricFind); } // Trim the beginning of the text to the lyrics @@ -126,13 +139,39 @@ private SearchResult PostProcessLyric(Uri uri, string text) int endOfLyricInJson = Math.Max(Math.Min(endOfFieldValue, endOfJsonObject), -1); if (endOfLyricInJson < 0) { - _logger?.LogWarning($"LyricFind. Can't parse lyrics for {uri}"); - return new SearchResult(); + // In case of instrumental song it could not contains lyric field. + if (IsInstumentalLyric(text)) + return new SearchResult(Models.ExternalProviderType.LyricFind).AddInstrumental(true); + + _logger?.LogWarning($"LyricFind. Can't parse lyrics for Uri: [{uri}]"); + return new SearchResult(Models.ExternalProviderType.LyricFind); } string result = Parser.Parse(text.Substring(start, endOfLyricInJson - start)); return new SearchResult(result, Models.ExternalProviderType.LyricFind); } + + /// + /// Check if lyric text contains instrumental flag. + /// + private bool IsInstumentalLyric(string text) + { + return TryReturnBooleanFieldValue(text, _instrumentalStart) + || TryReturnBooleanFieldValue(text, _songIsInstrumentalStart); + } + + /// + /// Try to find and return the fielad value as boolean. Pattern: "":. + /// In case if fieldName is not found returns false. + /// + private bool TryReturnBooleanFieldValue(string text, string fieldName) + { + var startIndex = text.IndexOf(fieldName); + if (startIndex <= 0) + return false; + var fieldValue = text.Substring(startIndex + fieldName.Length + 1, 5); + return fieldValue.IndexOf("true", StringComparison.OrdinalIgnoreCase) >= 0; + } } } diff --git a/LyricsScraperNET/Providers/SongLyrics/SongLyricsProvider.cs b/LyricsScraperNET/Providers/SongLyrics/SongLyricsProvider.cs index c6cd306..cb30da4 100644 --- a/LyricsScraperNET/Providers/SongLyrics/SongLyricsProvider.cs +++ b/LyricsScraperNET/Providers/SongLyrics/SongLyricsProvider.cs @@ -1,4 +1,5 @@ using HtmlAgilityPack; +using LyricsScraperNET.Extensions; using LyricsScraperNET.Helpers; using LyricsScraperNET.Models.Responses; using LyricsScraperNET.Network; @@ -21,6 +22,11 @@ public sealed class SongLyricsProvider : ExternalProviderBase private const string NotExistLyricPattern = "We do not have the lyrics for (.*) yet."; + /// + /// For instrumental songs, the text "[Instrumental]" is returned in the songLyricsDiv + /// + private const string InstrumentalLyricText = "Instrumental"; + #region Constructors public SongLyricsProvider() @@ -71,7 +77,7 @@ protected override SearchResult SearchLyric(Uri uri) if (WebClient == null) { _logger?.LogWarning($"SongLyrics. Please set up WebClient first"); - return new SearchResult(); + return new SearchResult(Models.ExternalProviderType.SongLyrics); } var htmlPageBody = WebClient.Load(uri); return GetParsedLyricFromHtmlPageBody(uri, htmlPageBody); @@ -91,7 +97,7 @@ protected override async Task SearchLyricAsync(Uri uri) if (WebClient == null) { _logger?.LogWarning($"SongLyrics. Please set up WebClient first"); - return new SearchResult(); + return new SearchResult(Models.ExternalProviderType.SongLyrics); } var htmlPageBody = await WebClient.LoadAsync(uri); return GetParsedLyricFromHtmlPageBody(uri, htmlPageBody); @@ -108,8 +114,8 @@ private SearchResult GetParsedLyricFromHtmlPageBody(Uri uri, string htmlPageBody { if (string.IsNullOrEmpty(htmlPageBody)) { - _logger?.LogWarning($"SongLyrics. Text is empty for {uri}"); - return new SearchResult(); + _logger?.LogWarning($"SongLyrics. Text is empty for Uri: [{uri}]"); + return new SearchResult(Models.ExternalProviderType.SongLyrics); } var htmlDocument = new HtmlDocument(); @@ -119,16 +125,22 @@ private SearchResult GetParsedLyricFromHtmlPageBody(Uri uri, string htmlPageBody if (lyricsContainerNode == null) { - _logger?.LogWarning($"SongLyrics. Can't find lyrics for {uri}"); - return new SearchResult(); + _logger?.LogWarning($"SongLyrics. Can't find lyrics for Uri: [{uri}]"); + return new SearchResult(Models.ExternalProviderType.SongLyrics); } + // Check if lyric not exist on site yet if (Regex.IsMatch(lyricsContainerNode.InnerText, NotExistLyricPattern, RegexOptions.IgnoreCase)) { _logger?.LogDebug($"SongLyrics. Returns empty result: \"{lyricsContainerNode.InnerText}\""); - return new SearchResult(); + return new SearchResult(Models.ExternalProviderType.SongLyrics); } + // Check if lyric is instrumental + if (string.Equals(lyricsContainerNode.InnerText, InstrumentalLyricText, StringComparison.OrdinalIgnoreCase) + || string.Equals(lyricsContainerNode.InnerText, $"[{InstrumentalLyricText}]", StringComparison.OrdinalIgnoreCase)) + return new SearchResult(Models.ExternalProviderType.SongLyrics).AddInstrumental(true); + return new SearchResult(lyricsContainerNode.InnerText, Models.ExternalProviderType.SongLyrics); } } diff --git a/Tests/LyricsScraperNET.IntegrationTest/LyricsScraperNET.IntegrationTest.csproj b/Tests/LyricsScraperNET.IntegrationTest/LyricsScraperNET.IntegrationTest.csproj index d1dc790..ce0eff4 100644 --- a/Tests/LyricsScraperNET.IntegrationTest/LyricsScraperNET.IntegrationTest.csproj +++ b/Tests/LyricsScraperNET.IntegrationTest/LyricsScraperNET.IntegrationTest.csproj @@ -34,15 +34,24 @@ PreserveNewest + + PreserveNewest + PreserveNewest + + PreserveNewest + PreserveNewest PreserveNewest + + PreserveNewest + PreserveNewest @@ -58,6 +67,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest diff --git a/Tests/LyricsScraperNET.IntegrationTest/Properties/launchSettings.json b/Tests/LyricsScraperNET.IntegrationTest/Properties/launchSettings.json deleted file mode 100644 index 33504c9..0000000 --- a/Tests/LyricsScraperNET.IntegrationTest/Properties/launchSettings.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "profiles": { - "WSL": { - "commandName": "WSL2", - "distributionName": "" - } - } -} \ No newline at end of file diff --git a/Tests/LyricsScraperNET.IntegrationTest/Providers/Genius/GeniusProviderTest.cs b/Tests/LyricsScraperNET.IntegrationTest/Providers/Genius/GeniusProviderTest.cs index 050cb35..253ce1a 100644 --- a/Tests/LyricsScraperNET.IntegrationTest/Providers/Genius/GeniusProviderTest.cs +++ b/Tests/LyricsScraperNET.IntegrationTest/Providers/Genius/GeniusProviderTest.cs @@ -28,6 +28,27 @@ public void SearchLyric_IntegrationDynamicData_Success(LyricsTestData testData) Assert.True(string.IsNullOrEmpty(searchResult.ResponseMessage)); Assert.Equal(ExternalProviderType.Genius, searchResult.ExternalProviderType); Assert.Equal(testData.LyricResultData.Replace("\r\n", "\n"), searchResult.LyricText.Replace("\r\n", "\n")); + Assert.False(searchResult.Instrumental); + } + + [Theory] + [MemberData(nameof(GetTestData), parameters: "Providers\\Genius\\instrumental_test_data.json")] + public void SearchLyric_UnitDynamicData_Instrumental(LyricsTestData testData) + { + // Arrange + var lyricsClient = new GeniusProvider(); + SearchRequest searchRequest = CreateSearchRequest(testData); + + // Act + var searchResult = lyricsClient.SearchLyric(searchRequest); + + // Assert + Assert.NotNull(searchResult); + Assert.True(searchResult.IsEmpty()); + Assert.Equal(ResponseStatusCode.Success, searchResult.ResponseStatusCode); + Assert.True(string.IsNullOrEmpty(searchResult.ResponseMessage)); + Assert.Equal(ExternalProviderType.Genius, searchResult.ExternalProviderType); + Assert.True(searchResult.Instrumental); } } } diff --git a/Tests/LyricsScraperNET.IntegrationTest/Providers/Genius/instrumental_test_data.json b/Tests/LyricsScraperNET.IntegrationTest/Providers/Genius/instrumental_test_data.json new file mode 100644 index 0000000..0d39242 --- /dev/null +++ b/Tests/LyricsScraperNET.IntegrationTest/Providers/Genius/instrumental_test_data.json @@ -0,0 +1,8 @@ +[ + { + "LyricResultPath": null, + "ArtistName": "Rush", + "SongName": "YYZ", + "SongUri": null + } +] \ No newline at end of file diff --git a/Tests/LyricsScraperNET.IntegrationTest/Providers/LyricFind/LyricFindProviderTest.cs b/Tests/LyricsScraperNET.IntegrationTest/Providers/LyricFind/LyricFindProviderTest.cs index 08696a7..b03bc09 100644 --- a/Tests/LyricsScraperNET.IntegrationTest/Providers/LyricFind/LyricFindProviderTest.cs +++ b/Tests/LyricsScraperNET.IntegrationTest/Providers/LyricFind/LyricFindProviderTest.cs @@ -28,6 +28,27 @@ public void SearchLyric_IntegrationDynamicData_Success(LyricsTestData testData) Assert.True(string.IsNullOrEmpty(searchResult.ResponseMessage)); Assert.Equal(ExternalProviderType.LyricFind, searchResult.ExternalProviderType); Assert.Equal(testData.LyricResultData.Replace("\r\n", "\n"), searchResult.LyricText.Replace("\r\n", "\n")); + Assert.False(searchResult.Instrumental); + } + + [Theory] + [MemberData(nameof(GetTestData), parameters: "Providers\\LyricFind\\instrumental_test_data.json")] + public void SearchLyric_IntegrationDynamicData_Instrumental(LyricsTestData testData) + { + // Arrange + var lyricsClient = new LyricFindProvider(); + SearchRequest searchRequest = CreateSearchRequest(testData); + + // Act + var searchResult = lyricsClient.SearchLyric(searchRequest); + + // Assert + Assert.NotNull(searchResult); + Assert.True(searchResult.IsEmpty()); + Assert.Equal(ResponseStatusCode.Success, searchResult.ResponseStatusCode); + Assert.True(string.IsNullOrEmpty(searchResult.ResponseMessage)); + Assert.Equal(ExternalProviderType.LyricFind, searchResult.ExternalProviderType); + Assert.True(searchResult.Instrumental); } } } diff --git a/Tests/LyricsScraperNET.IntegrationTest/Providers/LyricFind/instrumental_test_data.json b/Tests/LyricsScraperNET.IntegrationTest/Providers/LyricFind/instrumental_test_data.json new file mode 100644 index 0000000..0d39242 --- /dev/null +++ b/Tests/LyricsScraperNET.IntegrationTest/Providers/LyricFind/instrumental_test_data.json @@ -0,0 +1,8 @@ +[ + { + "LyricResultPath": null, + "ArtistName": "Rush", + "SongName": "YYZ", + "SongUri": null + } +] \ No newline at end of file diff --git a/Tests/LyricsScraperNET.IntegrationTest/Providers/Musixmatch/MusixmatchProviderTest.cs b/Tests/LyricsScraperNET.IntegrationTest/Providers/Musixmatch/MusixmatchProviderTest.cs index 0d2e8e3..07aa554 100644 --- a/Tests/LyricsScraperNET.IntegrationTest/Providers/Musixmatch/MusixmatchProviderTest.cs +++ b/Tests/LyricsScraperNET.IntegrationTest/Providers/Musixmatch/MusixmatchProviderTest.cs @@ -28,6 +28,27 @@ public void SearchLyric_IntegrationDynamicData_Success(LyricsTestData testData) Assert.True(string.IsNullOrEmpty(searchResult.ResponseMessage)); Assert.Equal(ExternalProviderType.Musixmatch, searchResult.ExternalProviderType); Assert.Equal(testData.LyricResultData.Replace("\r\n", "\n"), searchResult.LyricText); + Assert.False(searchResult.Instrumental); + } + + [Theory] + [MemberData(nameof(GetTestData), parameters: "Providers\\Musixmatch\\instrumental_test_data.json")] + public void SearchLyric_IntegrationDynamicData_Instrumental(LyricsTestData testData) + { + // Arrange + var lyricsClient = new MusixmatchProvider(); + SearchRequest searchRequest = CreateSearchRequest(testData); + + // Act + var searchResult = lyricsClient.SearchLyric(searchRequest); + + // Assert + Assert.NotNull(searchResult); + Assert.True(searchResult.IsEmpty()); + Assert.Equal(ResponseStatusCode.Success, searchResult.ResponseStatusCode); + Assert.True(string.IsNullOrEmpty(searchResult.ResponseMessage)); + Assert.Equal(ExternalProviderType.Musixmatch, searchResult.ExternalProviderType); + Assert.True(searchResult.Instrumental); } } } diff --git a/Tests/LyricsScraperNET.IntegrationTest/Providers/Musixmatch/instrumental_test_data.json b/Tests/LyricsScraperNET.IntegrationTest/Providers/Musixmatch/instrumental_test_data.json new file mode 100644 index 0000000..0d39242 --- /dev/null +++ b/Tests/LyricsScraperNET.IntegrationTest/Providers/Musixmatch/instrumental_test_data.json @@ -0,0 +1,8 @@ +[ + { + "LyricResultPath": null, + "ArtistName": "Rush", + "SongName": "YYZ", + "SongUri": null + } +] \ No newline at end of file diff --git a/Tests/LyricsScraperNET.IntegrationTest/Providers/SongLyrics/SongLyricsProviderTest.cs b/Tests/LyricsScraperNET.IntegrationTest/Providers/SongLyrics/SongLyricsProviderTest.cs index 2d1be2b..0cd6391 100644 --- a/Tests/LyricsScraperNET.IntegrationTest/Providers/SongLyrics/SongLyricsProviderTest.cs +++ b/Tests/LyricsScraperNET.IntegrationTest/Providers/SongLyrics/SongLyricsProviderTest.cs @@ -28,6 +28,27 @@ public void SearchLyric_IntegrationDynamicData_Success(LyricsTestData testData) Assert.True(string.IsNullOrEmpty(searchResult.ResponseMessage)); Assert.Equal(ExternalProviderType.SongLyrics, searchResult.ExternalProviderType); Assert.Equal(testData.LyricResultData.Replace("\r\n", "\n"), searchResult.LyricText.Replace("\r\n", "\n")); + Assert.False(searchResult.Instrumental); + } + + [Theory] + [MemberData(nameof(GetTestData), parameters: "Providers\\SongLyrics\\instrumental_test_data.json")] + public void SearchLyric_IntegrationDynamicData_Instrumental(LyricsTestData testData) + { + // Arrange + var lyricsClient = new SongLyricsProvider(); + SearchRequest searchRequest = CreateSearchRequest(testData); + + // Act + var searchResult = lyricsClient.SearchLyric(searchRequest); + + // Assert + Assert.NotNull(searchResult); + Assert.True(searchResult.IsEmpty()); + Assert.Equal(ResponseStatusCode.Success, searchResult.ResponseStatusCode); + Assert.True(string.IsNullOrEmpty(searchResult.ResponseMessage)); + Assert.Equal(ExternalProviderType.SongLyrics, searchResult.ExternalProviderType); + Assert.True(searchResult.Instrumental); } } } diff --git a/Tests/LyricsScraperNET.IntegrationTest/Providers/SongLyrics/instrumental_test_data.json b/Tests/LyricsScraperNET.IntegrationTest/Providers/SongLyrics/instrumental_test_data.json new file mode 100644 index 0000000..0d39242 --- /dev/null +++ b/Tests/LyricsScraperNET.IntegrationTest/Providers/SongLyrics/instrumental_test_data.json @@ -0,0 +1,8 @@ +[ + { + "LyricResultPath": null, + "ArtistName": "Rush", + "SongName": "YYZ", + "SongUri": null + } +] \ No newline at end of file diff --git a/Tests/LyricsScraperNET.UnitTest/LyricsScraperClientTests.cs b/Tests/LyricsScraperNET.UnitTest/LyricsScraperClientTests.cs index 0b128a4..aae6189 100644 --- a/Tests/LyricsScraperNET.UnitTest/LyricsScraperClientTests.cs +++ b/Tests/LyricsScraperNET.UnitTest/LyricsScraperClientTests.cs @@ -34,10 +34,12 @@ public async void SearchLyric_WithDisabledClient_ShouldReturnEmptySearchResult() Assert.True(searchResult.IsEmpty()); Assert.Equal(ResponseStatusCode.NoDataFound, searchResult.ResponseStatusCode); Assert.Equal(Constants.ResponseMessages.ExternalProvidersAreDisabled, searchResult.ResponseMessage); + Assert.False(searchResult.Instrumental); Assert.NotNull(searchResultAsync); Assert.True(searchResultAsync.IsEmpty()); Assert.Equal(ResponseStatusCode.NoDataFound, searchResultAsync.ResponseStatusCode); Assert.Equal(Constants.ResponseMessages.ExternalProvidersAreDisabled, searchResultAsync.ResponseMessage); + Assert.False(searchResultAsync.Instrumental); } [Fact] @@ -57,10 +59,12 @@ public async void SearchLyric_DefaultClient_ShouldReturnEmptySearchResult() Assert.True(searchResult.IsEmpty()); Assert.Equal(ResponseStatusCode.NoDataFound, searchResult.ResponseStatusCode); Assert.Equal(Constants.ResponseMessages.ExternalProvidersListIsEmpty, searchResult.ResponseMessage); + Assert.False(searchResult.Instrumental); Assert.NotNull(searchResultAsync); Assert.True(searchResultAsync.IsEmpty()); Assert.Equal(ResponseStatusCode.NoDataFound, searchResultAsync.ResponseStatusCode); Assert.Equal(Constants.ResponseMessages.ExternalProvidersListIsEmpty, searchResultAsync.ResponseMessage); + Assert.False(searchResultAsync.Instrumental); } [Theory] @@ -85,11 +89,13 @@ public async void SearchLyric_MalformedArtistAndSongSearchRequest_ShouldReturnBa Assert.Equal(ExternalProviderType.None, searchResult.ExternalProviderType); Assert.Equal(ResponseStatusCode.BadRequest, searchResult.ResponseStatusCode); Assert.Equal(Constants.ResponseMessages.ArtistAndSongSearchRequestFieldsAreEmpty, searchResult.ResponseMessage); + Assert.False(searchResult.Instrumental); Assert.NotNull(searchResultAsync); Assert.True(searchResultAsync.IsEmpty()); Assert.Equal(ExternalProviderType.None, searchResultAsync.ExternalProviderType); Assert.Equal(ResponseStatusCode.BadRequest, searchResultAsync.ResponseStatusCode); Assert.Equal(Constants.ResponseMessages.ArtistAndSongSearchRequestFieldsAreEmpty, searchResultAsync.ResponseMessage); + Assert.False(searchResultAsync.Instrumental); } [Theory] @@ -111,11 +117,13 @@ public async void SearchLyric_MalformedUriSearchRequest_ShouldReturnBadRequestSt Assert.Equal(ExternalProviderType.None, searchResult.ExternalProviderType); Assert.Equal(ResponseStatusCode.BadRequest, searchResult.ResponseStatusCode); Assert.Equal(Constants.ResponseMessages.UriSearchRequestFieldsAreEmpty, searchResult.ResponseMessage); + Assert.False(searchResult.Instrumental); Assert.NotNull(searchResultAsync); Assert.True(searchResultAsync.IsEmpty()); Assert.Equal(ExternalProviderType.None, searchResultAsync.ExternalProviderType); Assert.Equal(ResponseStatusCode.BadRequest, searchResultAsync.ResponseStatusCode); Assert.Equal(Constants.ResponseMessages.UriSearchRequestFieldsAreEmpty, searchResultAsync.ResponseMessage); + Assert.False(searchResultAsync.Instrumental); } [Fact] @@ -135,11 +143,13 @@ public async void SearchLyric_EmptySearchRequest_ShouldReturnBadRequestStatus() Assert.Equal(ExternalProviderType.None, searchResult.ExternalProviderType); Assert.Equal(ResponseStatusCode.BadRequest, searchResult.ResponseStatusCode); Assert.Equal(Constants.ResponseMessages.SearchRequestIsEmpty, searchResult.ResponseMessage); + Assert.False(searchResult.Instrumental); Assert.NotNull(searchResultAsync); Assert.True(searchResultAsync.IsEmpty()); Assert.Equal(ExternalProviderType.None, searchResultAsync.ExternalProviderType); Assert.Equal(ResponseStatusCode.BadRequest, searchResultAsync.ResponseStatusCode); Assert.Equal(Constants.ResponseMessages.SearchRequestIsEmpty, searchResultAsync.ResponseMessage); + Assert.False(searchResultAsync.Instrumental); } [Fact] @@ -159,11 +169,13 @@ public async void SearchLyric_ProviderWithEmptyResult_ShouldReturnNotFoundStatus Assert.Equal(ExternalProviderType.None, searchResult.ExternalProviderType); Assert.Equal(ResponseStatusCode.NoDataFound, searchResult.ResponseStatusCode); Assert.Equal(Constants.ResponseMessages.NotFoundLyric, searchResult.ResponseMessage); + Assert.False(searchResult.Instrumental); Assert.NotNull(searchResultAsync); Assert.True(searchResultAsync.IsEmpty()); Assert.Equal(ExternalProviderType.None, searchResultAsync.ExternalProviderType); Assert.Equal(ResponseStatusCode.NoDataFound, searchResultAsync.ResponseStatusCode); Assert.Equal(Constants.ResponseMessages.NotFoundLyric, searchResultAsync.ResponseMessage); + Assert.False(searchResultAsync.Instrumental); } [Fact] @@ -183,11 +195,13 @@ public async void SearchLyric_ProviderNotSpecifiedForRequest_ShouldReturnNotFoun Assert.Equal(ExternalProviderType.None, searchResult.ExternalProviderType); Assert.Equal(ResponseStatusCode.BadRequest, searchResult.ResponseStatusCode); Assert.Equal(Constants.ResponseMessages.ExternalProviderForRequestNotSpecified, searchResult.ResponseMessage); + Assert.False(searchResult.Instrumental); Assert.NotNull(searchResultAsync); Assert.True(searchResultAsync.IsEmpty()); Assert.Equal(ExternalProviderType.None, searchResultAsync.ExternalProviderType); Assert.Equal(ResponseStatusCode.BadRequest, searchResultAsync.ResponseStatusCode); Assert.Equal(Constants.ResponseMessages.ExternalProviderForRequestNotSpecified, searchResultAsync.ResponseMessage); + Assert.False(searchResultAsync.Instrumental); } [Fact] diff --git a/Tests/LyricsScraperNET.UnitTest/LyricsScraperNET.UnitTest.csproj b/Tests/LyricsScraperNET.UnitTest/LyricsScraperNET.UnitTest.csproj index c73f5ac..7c3b142 100644 --- a/Tests/LyricsScraperNET.UnitTest/LyricsScraperNET.UnitTest.csproj +++ b/Tests/LyricsScraperNET.UnitTest/LyricsScraperNET.UnitTest.csproj @@ -31,6 +31,12 @@ + + PreserveNewest + + + PreserveNewest + PreserveNewest @@ -49,6 +55,12 @@ PreserveNewest + + PreserveNewest + + + PreserveNewest + PreserveNewest @@ -58,6 +70,12 @@ PreserveNewest + + PreserveNewest + + + PreserveNewest + PreserveNewest diff --git a/Tests/LyricsScraperNET.UnitTest/Providers/Genius/GeniusProviderTest.cs b/Tests/LyricsScraperNET.UnitTest/Providers/Genius/GeniusProviderTest.cs index ee361a2..4cb7b5b 100644 --- a/Tests/LyricsScraperNET.UnitTest/Providers/Genius/GeniusProviderTest.cs +++ b/Tests/LyricsScraperNET.UnitTest/Providers/Genius/GeniusProviderTest.cs @@ -26,10 +26,34 @@ public void SearchLyric_UnitDynamicData_Success(LyricsTestData testData) // Assert Assert.NotNull(searchResult); + Assert.False(searchResult.IsEmpty()); Assert.Equal(ResponseStatusCode.Success, searchResult.ResponseStatusCode); Assert.True(string.IsNullOrEmpty(searchResult.ResponseMessage)); Assert.Equal(ExternalProviderType.Genius, searchResult.ExternalProviderType); Assert.Equal(testData.LyricResultData.Replace("\r\n", "\n"), searchResult.LyricText.Replace("\r\n", "\n")); + Assert.False(searchResult.Instrumental); + } + + [Theory] + [MemberData(nameof(GetTestData), parameters: "Providers\\Genius\\instrumental_test_data.json")] + public void SearchLyric_UnitDynamicData_Instrumental(LyricsTestData testData) + { + // Arrange + var lyricsClient = new GeniusProvider(); + lyricsClient.ConfigureExternalProvider(testData); + + SearchRequest searchRequest = CreateSearchRequest(testData); + + // Act + var searchResult = lyricsClient.SearchLyric(searchRequest); + + // Assert + Assert.NotNull(searchResult); + Assert.True(searchResult.IsEmpty()); + Assert.Equal(ResponseStatusCode.Success, searchResult.ResponseStatusCode); + Assert.True(string.IsNullOrEmpty(searchResult.ResponseMessage)); + Assert.Equal(ExternalProviderType.Genius, searchResult.ExternalProviderType); + Assert.True(searchResult.Instrumental); } } } diff --git a/Tests/LyricsScraperNET.UnitTest/Providers/Genius/Resources/Instrumental_HtmlPage_01.txt b/Tests/LyricsScraperNET.UnitTest/Providers/Genius/Resources/Instrumental_HtmlPage_01.txt new file mode 100644 index 0000000..e2c386e --- /dev/null +++ b/Tests/LyricsScraperNET.UnitTest/Providers/Genius/Resources/Instrumental_HtmlPage_01.txt @@ -0,0 +1,967 @@ + + + + Rush – YYZ Lyrics | Genius Lyrics + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

This song is an instrumental

How to Format Lyrics:

  • Type out all lyrics, even repeating song parts like the chorus
  • Lyrics should be broken down into individual lines
  • Use section headers above different song parts like [Verse], [Chorus], etc.
  • Use italics (<i>lyric</i>) and bold (<b>lyric</b>) to distinguish between different vocalists in the same song part
  • If you don’t understand a lyric, use [?]

To learn more, check out our transcription guide or visit our transcribers forum

About

Genius Annotation

An instrumental interlude named for Rush’s local airport, Toronto’s Pearson International, which is represented by the code YYZ, hence the use of the title in morse code (sort of) as a motif throughout the song. This song has become legendary among Rush fans for the insane and lengthy solos drummer Neil Peart often adds when it’s performed in concert.

Q&A

Find answers to frequently asked questions about the song and explore its deeper meaning

Comments
+ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Tests/LyricsScraperNET.UnitTest/Providers/Genius/instrumental_test_data.json b/Tests/LyricsScraperNET.UnitTest/Providers/Genius/instrumental_test_data.json new file mode 100644 index 0000000..ed49ab0 --- /dev/null +++ b/Tests/LyricsScraperNET.UnitTest/Providers/Genius/instrumental_test_data.json @@ -0,0 +1,9 @@ +[ + { + "LyricPagePath": "Providers/Genius/Resources/Instrumental_HtmlPage_01.txt", + "LyricResultPath": null, + "ArtistName": null, + "SongName": null, + "SongUri": "https://genius.com/Rush-yyz-lyrics" + } +] \ No newline at end of file diff --git a/Tests/LyricsScraperNET.UnitTest/Providers/LyricFind/LyricFindProviderTest.cs b/Tests/LyricsScraperNET.UnitTest/Providers/LyricFind/LyricFindProviderTest.cs index d73aaee..d99a36a 100644 --- a/Tests/LyricsScraperNET.UnitTest/Providers/LyricFind/LyricFindProviderTest.cs +++ b/Tests/LyricsScraperNET.UnitTest/Providers/LyricFind/LyricFindProviderTest.cs @@ -30,6 +30,29 @@ public void SearchLyric_UnitDynamicData_Success(LyricsTestData testData) Assert.True(string.IsNullOrEmpty(searchResult.ResponseMessage)); Assert.Equal(ExternalProviderType.LyricFind, searchResult.ExternalProviderType); Assert.Equal(testData.LyricResultData.Replace("\r\n", "\n"), searchResult.LyricText.Replace("\r\n", "\n")); + Assert.False(searchResult.Instrumental); + } + + [Theory] + [MemberData(nameof(GetTestData), parameters: "Providers\\LyricFind\\instrumental_test_data.json")] + public void SearchLyric_UnitDynamicData_Instrumental(LyricsTestData testData) + { + // Arrange + var lyricsClient = new LyricFindProvider(); + lyricsClient.ConfigureExternalProvider(testData); + + SearchRequest searchRequest = CreateSearchRequest(testData); + + // Act + var searchResult = lyricsClient.SearchLyric(searchRequest); + + // Assert + Assert.NotNull(searchResult); + Assert.True(searchResult.IsEmpty()); + Assert.Equal(ResponseStatusCode.Success, searchResult.ResponseStatusCode); + Assert.True(string.IsNullOrEmpty(searchResult.ResponseMessage)); + Assert.Equal(ExternalProviderType.LyricFind, searchResult.ExternalProviderType); + Assert.True(searchResult.Instrumental); } } } diff --git a/Tests/LyricsScraperNET.UnitTest/Providers/LyricFind/Resources/Instrumental_HtmlPage_01.txt b/Tests/LyricsScraperNET.UnitTest/Providers/LyricFind/Resources/Instrumental_HtmlPage_01.txt new file mode 100644 index 0000000..ad53c9e --- /dev/null +++ b/Tests/LyricsScraperNET.UnitTest/Providers/LyricFind/Resources/Instrumental_HtmlPage_01.txt @@ -0,0 +1,17 @@ +Lyrics | Rush | YYZ
ChartsGenres
Add Song
logoLyricFind
Lyric cover art as blurred background
Lyric cover art

YYZ

Moving Pictures

Rush

1981

Apple Music logo
Apple Music logo

Deezer logo
Deezer logo

Spotify logo
Spotify logo
Lyric cover art

Moving Pictures

1981

From This Artist
\ No newline at end of file diff --git a/Tests/LyricsScraperNET.UnitTest/Providers/LyricFind/instrumental_test_data.json b/Tests/LyricsScraperNET.UnitTest/Providers/LyricFind/instrumental_test_data.json new file mode 100644 index 0000000..f9db80f --- /dev/null +++ b/Tests/LyricsScraperNET.UnitTest/Providers/LyricFind/instrumental_test_data.json @@ -0,0 +1,9 @@ +[ + { + "LyricPagePath": "Providers/LyricFind/Resources/Instrumental_HtmlPage_01.txt", + "LyricResultPath": null, + "ArtistName": "Rush", + "SongName": "YYZ", + "SongUri": null + } +] \ No newline at end of file diff --git a/Tests/LyricsScraperNET.UnitTest/Providers/SongLyrics/Resources/Instrumental_HtmlPage_01.txt b/Tests/LyricsScraperNET.UnitTest/Providers/SongLyrics/Resources/Instrumental_HtmlPage_01.txt new file mode 100644 index 0000000..814902c --- /dev/null +++ b/Tests/LyricsScraperNET.UnitTest/Providers/SongLyrics/Resources/Instrumental_HtmlPage_01.txt @@ -0,0 +1,1092 @@ + + + + RUSH - YYZ LYRICS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ +
+
+ + 55k + +
+ Like +
+ + +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + +
+ + + +
+
+
+ Lead RIFFs: +
+
+ +
+ +
+
Bad selection
+
+

Cannot annotate a non-flat selection. Make sure your selection + starts and ends within the same node.

+
+ (example of bad selection): This is bold + text and this is normal text. +
+
+ (example of good selection): This is bold + text and this is normal text. +
+
+
+ +
+
Bad selection
+
+

An annotation cannot contain another annotation.

+
+
+ + + + + +
+
+ + +
+
Anonymous
+ + + + +
+ + +
+ + +
+ +
+ + +
+
+ + +
+
+ Really delete this comment? +
+ + +
+
+
+ + +
+ +
+ +
+ + +
+ + + +
+ +
+ + + + +
+ + +
+ + +
+
Anonymous
+ + + + +
+ + +
+ + +
+ +
+ + +
+
+ + +
+
+ Really delete this comment? +
+ + +
+
+
+ +
+ +
+ +
+ + +
+ + + +
+ +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/Tests/LyricsScraperNET.UnitTest/Providers/SongLyrics/SongLyricsProviderTest.cs b/Tests/LyricsScraperNET.UnitTest/Providers/SongLyrics/SongLyricsProviderTest.cs index e24b44c..a45daf9 100644 --- a/Tests/LyricsScraperNET.UnitTest/Providers/SongLyrics/SongLyricsProviderTest.cs +++ b/Tests/LyricsScraperNET.UnitTest/Providers/SongLyrics/SongLyricsProviderTest.cs @@ -30,6 +30,29 @@ public void SearchLyric_UnitDynamicData_Success(LyricsTestData testData) Assert.True(string.IsNullOrEmpty(searchResult.ResponseMessage)); Assert.Equal(ExternalProviderType.SongLyrics, searchResult.ExternalProviderType); Assert.Equal(testData.LyricResultData.Replace("\r\n", "\n"), searchResult.LyricText.Replace("\r\n", "\n")); + Assert.False(searchResult.Instrumental); + } + + [Theory] + [MemberData(nameof(GetTestData), parameters: "Providers\\SongLyrics\\instrumental_test_data.json")] + public void SearchLyric_UnitDynamicData_Instrumental(LyricsTestData testData) + { + // Arrange + var lyricsClient = new SongLyricsProvider(); + lyricsClient.ConfigureExternalProvider(testData); + + SearchRequest searchRequest = CreateSearchRequest(testData); + + // Act + var searchResult = lyricsClient.SearchLyric(searchRequest); + + // Assert + Assert.NotNull(searchResult); + Assert.True(searchResult.IsEmpty()); + Assert.Equal(ResponseStatusCode.Success, searchResult.ResponseStatusCode); + Assert.True(string.IsNullOrEmpty(searchResult.ResponseMessage)); + Assert.Equal(ExternalProviderType.SongLyrics, searchResult.ExternalProviderType); + Assert.True(searchResult.Instrumental); } } } diff --git a/Tests/LyricsScraperNET.UnitTest/Providers/SongLyrics/instrumental_test_data.json b/Tests/LyricsScraperNET.UnitTest/Providers/SongLyrics/instrumental_test_data.json new file mode 100644 index 0000000..cd18b49 --- /dev/null +++ b/Tests/LyricsScraperNET.UnitTest/Providers/SongLyrics/instrumental_test_data.json @@ -0,0 +1,9 @@ +[ + { + "LyricPagePath": "Providers/SongLyrics/Resources/Instrumental_HtmlPage_01.txt", + "LyricResultPath": null, + "ArtistName": "Rush", + "SongName": "YYZ", + "SongUri": null + } +] \ No newline at end of file