-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#5 Added Musixmatch provider integration test. Exclude integration te…
…sts during CI.
- Loading branch information
Showing
7 changed files
with
103 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
Tests/LyricsScraperNET.IntegrationTest/Providers/Musixmatch/MusixmatchProviderTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using LyricsScraperNET.Models.Requests; | ||
using LyricsScraperNET.Providers.Models; | ||
using LyricsScraperNET.Providers.Musixmatch; | ||
using LyricsScraperNET.UnitTest.TestModel; | ||
using LyricsScraperNET.UnitTest.Utils; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using System.Collections.Generic; | ||
|
||
namespace LyricsScraperNET.IntegrationTest.Providers.Musixmatch | ||
{ | ||
[TestClass] | ||
public class MusixmatchProviderTest | ||
{ | ||
private static readonly string[] TEST_DATA_PATH = { "Providers", "Musixmatch", "test_data.json" }; | ||
|
||
[TestMethod] | ||
[DynamicData(nameof(GetTestData), DynamicDataSourceType.Method)] | ||
public void SearchLyric_IntegrationDynamicData_AreEqual(LyricsTestData testData) | ||
{ | ||
// Arrange | ||
var lyricsClient = new MusixmatchProvider(); | ||
|
||
SearchRequest searchRequest = !string.IsNullOrEmpty(testData.SongUri) | ||
? new UriSearchRequest(testData.SongUri) | ||
: new ArtistAndSongSearchRequest(testData.ArtistName, testData.SongName); | ||
|
||
// Act | ||
var searchResult = lyricsClient.SearchLyric(searchRequest); | ||
|
||
// Assert | ||
Assert.IsNotNull(searchResult); | ||
Assert.IsFalse(searchResult.IsEmpty()); | ||
Assert.AreEqual(ExternalProviderType.Musixmatch, searchResult.ExternalProviderType); | ||
Assert.AreEqual(testData.LyricResultData, searchResult.LyricText); | ||
} | ||
|
||
public static IEnumerable<object[]> GetTestData() | ||
{ | ||
foreach (var testData in Serializer.Deseialize<List<LyricsTestData>>(TEST_DATA_PATH)) | ||
{ | ||
yield return new object[] { testData }; | ||
} | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
Tests/LyricsScraperNET.IntegrationTest/Providers/Musixmatch/Resources/Lyrics_Result_01.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
Now your heroes have fallen | ||
Championless, the seas are rising | ||
So torch every banner | ||
Every hope of surviving | ||
This storm is breaking | ||
Security has left you treading water | ||
|
||
Now taste the fear | ||
Taste the uncertainty | ||
What will you do (what will you do) | ||
When there's nothing left for you to cling to? | ||
What will you do (what will you do) | ||
With your one last breath? | ||
|
||
Thrive in your emptiness | ||
Burn all you love | ||
There's no hope for the weak | ||
Our heroes have died | ||
|
||
No heart, no hope | ||
Face to face with the abyss (with the abyss) | ||
One by one they fall away and won't be missed | ||
|
||
Can you hear it? | ||
Can you hear the sound? | ||
As our broken idols | ||
Come crashing down | ||
Now taste the fear | ||
Now taste the fear | ||
|
||
Burn all you love | ||
There's no hope for the weak | ||
Our heroes have died | ||
Burn all you love | ||
There's no hope for the weak | ||
Burn all you love |
8 changes: 8 additions & 0 deletions
8
Tests/LyricsScraperNET.IntegrationTest/Providers/Musixmatch/test_data.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[ | ||
{ | ||
"LyricResultPath": "Providers/Musixmatch/Resources/Lyrics_Result_01.txt", | ||
"ArtistName": "Parkway Drive", | ||
"SongName": "Idols and Anchors", | ||
"SongUri": null | ||
} | ||
] |