public void Parse() { var xelement = XElement.Load(testFilePath + "lastfmUserTopArtistsResponse.xml"); var result = new UserTopArtistResponseParser().Parse(xelement); var topArtist = result.Items.First() as LastfmUserTopArtist; Assert.That(topArtist.Name, Is.EqualTo("Miles Davis")); Assert.That(topArtist.PlayCount, Is.EqualTo(3247)); Assert.That(topArtist.Rank, Is.EqualTo(1)); Assert.That(topArtist.MegaImageLocation, Is.EqualTo("http://userserve-ak.last.fm/serve/500/11251985/Miles+Davis+Miles.jpg")); Assert.That(topArtist.ExtraLargeImageLocation, Is.EqualTo("http://userserve-ak.last.fm/serve/252/11251985.jpg")); Assert.That(topArtist.LargeImageLocation, Is.EqualTo("http://userserve-ak.last.fm/serve/126/11251985.jpg")); Assert.That(topArtist.MediumImageLocation, Is.EqualTo("http://userserve-ak.last.fm/serve/64/11251985.jpg")); Assert.That(topArtist.SmallImageLocation, Is.EqualTo("http://userserve-ak.last.fm/serve/34/11251985.jpg")); }
public void Parse_Removes_Whitespace_from_Artwork_Location_URLs() { var xelement = XElement.Load(testFilePath + "lastfmUserTopArtistsResponse.xml"); var result = new UserTopArtistResponseParser().Parse(xelement); var topArtist = result.Items.First() as LastfmUserTopArtist; Assert.That(topArtist.MegaImageLocation, Is.Not.StringMatching("^\\s+")); Assert.That(topArtist.MegaImageLocation, Is.Not.StringMatching("\\s+$")); Assert.That(topArtist.ExtraLargeImageLocation, Is.Not.StringMatching("^\\s+")); Assert.That(topArtist.ExtraLargeImageLocation, Is.Not.StringMatching("\\s+$")); Assert.That(topArtist.LargeImageLocation, Is.Not.StringMatching("^\\s+")); Assert.That(topArtist.LargeImageLocation, Is.Not.StringMatching("\\s+$")); Assert.That(topArtist.MediumImageLocation, Is.Not.StringMatching("^\\s+")); Assert.That(topArtist.MediumImageLocation, Is.Not.StringMatching("\\s+$")); Assert.That(topArtist.SmallImageLocation, Is.Not.StringMatching("^\\s+")); Assert.That(topArtist.SmallImageLocation, Is.Not.StringMatching("\\s+$")); }