public void ApiCaller_FindTitles_IncorrectGuid_ReturnsCorrectData() { ApiCaller caller = new ApiCaller(); List <string> result = caller.FindSongTitlesByArtist(testIncorrectArtistId); Assert.IsNull(result); }
public void ApiCaller_FindTitles_EmptyGuid_ReturnsCorrectData() { ApiCaller caller = new ApiCaller(); List <string> result = caller.FindSongTitlesByArtist(Guid.Empty); Assert.IsNull(result); }
public void ApiCaller_FindTitles_Queen_ReturnsCorrectData() { ApiCaller caller = new ApiCaller(); List <string> result = caller.FindSongTitlesByArtist(testArtistId); Assert.IsNotNull(result); Assert.IsTrue(result.Count > 0); //I thought about asserting the exact number of songs that are returned 220. However if queen ever released another song //this unit test would break. }
public void ApiCaller_FindArtist_Queen_ReturnsExpectedData() { List <int> totalWordCount = new List <int>(); ApiCaller apiCaller = new ApiCaller(); LyricFormatter lyricFormatter = new LyricFormatter(); Guid artistId = apiCaller.FindArtist("queen"); List <string> songTitles = apiCaller.FindSongTitlesByArtist(artistId); foreach (string songTitle in songTitles) { //Only add item to word count if lyrics found. string lyrics = apiCaller.FindLyricsByArtistAndTitle(songTitle); if (!string.IsNullOrWhiteSpace(lyrics)) { totalWordCount.Add(lyricFormatter.GetTotalNumberOfWords(lyrics)); } } //RESULT! Math.Round(totalWordCount.Average()); var a = totalWordCount; }