示例#1
0
 public void AddSingleItemTest()
 {
     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);
     int result = testCatalog.Count;
     Assert.AreEqual(1, result);
 }
示例#2
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());
 }
示例#3
0
 public void AddMultipleItemTest()
 {
     Catalog testCatalog = new Catalog();
     string[] commandParams = { "Firefox v.11.0", "Mozilla", "16148072", "http://www.mozilla.org" };
     Content testContent = new Content(ContentType.Application, commandParams);
     testCatalog.Add(testContent);
     string[] commandParams2 = { "TheMatrix", "Wasovski brothers", "18072", "http://www.imdb.com" };
     Content testContent2 = new Content(ContentType.Movie, commandParams);
     testCatalog.Add(testContent);
     string[] commandParams3 = { "Intro C#", "S.Nakov", "12763892", "http://www.introprogramming.info" };
     Content testContent3 = new Content(ContentType.Book, commandParams);
     testCatalog.Add(testContent);
     string[] commandParams4 = { "One", "Metallica", "8771120", "http://goo.gl/dIkth7gs" };
     Content testContent4 = new Content(ContentType.Song, commandParams);
     testCatalog.Add(testContent);
     int result = testCatalog.Count;
     Assert.AreEqual(4, result);
 }
        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);
        }