Esempio n. 1
0
 public void GetListContentSingleItemTest()
 {
     string[] commandParams = { "Firefox v.11.0", "Mozilla", "16148072", "http://www.mozilla.org" };
     Content testContent = new Content(ContentType.Application, commandParams);
     Catalog testCatalog = new Catalog();
     testCatalog.Add(testContent);
     IEnumerable<IContent> resultList = testCatalog.GetListContent("Firefox v.11.0", 2);
     Assert.AreEqual(1, resultList.Count());
     Assert.AreSame(testContent, resultList.First());
 }
        public void GetListContetnTest()
        {
            ICatalog catalog = new Catalog();

            catalog.Add(new Content(ContentType.Book, new string[]{"Intro c#", "S.Nakov",
                "12763892", "http://www.introprogramming.info"}));
            catalog.Add(new Content(ContentType.Application, new string[]{"Firefox v.11.0",
                "Mozilla", "16148072", "http://www.mozilla.org"}));
            catalog.Add(new Content(ContentType.Song, new string[]{"One",
                "Metallica", "8771120", "http://goo.gl/dIkth7gs"}));
            catalog.Add(new Content(ContentType.Movie, new string[]{"The Secret",
                "Drew Heriot, Sean Byrne & others (2006)", "832763834", "http://t.co/dNV4d"}));
            catalog.Add(new Content(ContentType.Movie, new string[]{"One",
                "James Wong (2001)", "969763002", "http://www.imdb.com/title/tt0267804/"}));

            var list = catalog.GetListContent("Intro c#", 1).GetEnumerator();
            IContent expected = new Content(ContentType.Book, new string[]{"Intro c#", "S.Nakov",
                "12763892", "http://www.introprogramming.info"});

            list.MoveNext();
            Assert.IsTrue(expected.CompareTo(list.Current) == 0);
        }