public void MatchedItemsSortTest()
{
Catalog catalog = new Catalog();
List<string[]> contentItemParams = new List<string[]>()
{
new string[] { "Firefox v.11.0", "Mozilla", "16148072", "http://www.mozilla.org" },
new string[] { "One", "Metallica", "8771120", "http://goo.gl/dIkth7gs" },
new string[] { "One", "Unknown group", "8771120", "http://goo.gl/dIkth7gs" },
new string[] { "One", "Metallica", "124124241", "http://goo.gl/dIkth7gs" },
new string[] { "Intro C#", "S.Nakov", "12763892", "http://www.introprogramming.info" },
new string[] { "The Secret", "Drew Heriot, Sean Byrne & others (2006)", "832763834", "http://t.co/dNV4d" }
};
IContent application = new ContentItem(ContentType.Application, contentItemParams[0]);
IContent song1 = new ContentItem(ContentType.Song, contentItemParams[1]);
IContent song2 = new ContentItem(ContentType.Song, contentItemParams[2]);
IContent song3 = new ContentItem(ContentType.Song, contentItemParams[3]);
IContent book = new ContentItem(ContentType.Book, contentItemParams[4]);
IContent movie = new ContentItem(ContentType.Movie, contentItemParams[5]);
catalog.Add(application);
catalog.Add(application);
catalog.Add(song1);
catalog.Add(song2);
catalog.Add(song3);
catalog.Add(book);
catalog.Add(book);
catalog.Add(movie);
catalog.Add(movie);
IEnumerable<IContent> matchedItems = catalog.GetListContent("One", 3);
string[] actualTextRepresentations = GetTextRepresentationsOfMatchedItems(matchedItems);
string[] expectedTextRepresentations = new string[]
{
"Song: One; Metallica; 124124241; http://goo.gl/dIkth7gs",
"Song: One; Metallica; 8771120; http://goo.gl/dIkth7gs",
"Song: One; Unknown group; 8771120; http://goo.gl/dIkth7gs"
};
CollectionAssert.AreEqual(expectedTextRepresentations, actualTextRepresentations);
Assert.AreEqual(3, matchedItems.Count());
}
#endregion