public void CatalogAddTest_SingleItem()
        {
            Catalog catalog = new Catalog();
            var item = new ContentItem(ContentItemType.Book,
                new string[] { "Intro C#", "S.Nakov", "12763892", "http://www.introprogramming.info" });

            catalog.Add(item);
            Assert.AreEqual(1, catalog.Count);
        }
        public void CatalogGetTest_RequestedOneMatchingMissing()
        {
            Catalog catalog = new Catalog();
            var bookCsharp = new ContentItem(ContentItemType.Book,
                new string[] { "Intro C#", "S.Nakov", "12763892", "http://www.introprogramming.info" });
            var bookJava = new ContentItem(ContentItemType.Book,
                new string[] { "Intro Java", "S.Nakov", "12763892", "http://www.introprogramming.info" });
            var bookPerl = new ContentItem(ContentItemType.Book,
                new string[] { "Intro Perl", "S.Nakov", "12763892", "http://www.introprogramming.info" });

            catalog.Add(bookCsharp);
            catalog.Add(bookCsharp);
            catalog.Add(bookCsharp);
            catalog.Add(bookJava);
            catalog.Add(bookPerl);
            var matchingElements = catalog.GetListContent("Intro Javascript", 1);
            Assert.AreEqual(0, matchingElements.Count());
        }
        public void CatalogAddTest_DuplidcatedElements()
        {
            Catalog catalog = new Catalog();
            var item = new ContentItem(ContentItemType.Book,
                new string[] { "Intro C#", "S.Nakov", "12763892", "http://www.introprogramming.info" });
            var item1 = new ContentItem(ContentItemType.Book,
                new string[] { "Intro Java", "S.Nakov", "12763892", "http://www.introprogramming.info" });
            var item2 = new ContentItem(ContentItemType.Book,
                new string[] { "Intro Java", "S.Nakov", "12763892", "http://www.introprogramming.info" });
            var item3 = new ContentItem(ContentItemType.Book,
                new string[] { "Intro Perl", "S.Nakov", "12763892", "http://www.introprogramming.info" });
            var item4 = new ContentItem(ContentItemType.Book,
                new string[] { "Intro C", "S.Nakov", "12763892", "http://www.introprogramming.info" });

            catalog.Add(item);
            catalog.Add(item);
            catalog.Add(item1);
            catalog.Add(item2);
            catalog.Add(item3);
            catalog.Add(item4);
            Assert.AreEqual(4, catalog.Count);
        }
        public void CatalogGetTest_RequestedOnexagMissing()
        {
            Catalog catalog = new Catalog();
            var bookCsharp = new ContentItem(ContentItemType.Book,
                new string[] { "Intro C#", "C.Nakov", "12763892", "http://www.introprogramming.info" });
            var otherbookCsharp = new ContentItem(ContentItemType.Book,
                new string[] { "Intro C#", "B.Nakov", "12763892", "http://www.introprogramming.info" });
            var bookJava = new ContentItem(ContentItemType.Book,
                new string[] { "Intro C#", "A.Nakov", "12763892", "http://www.introprogramming.info" });
            var bookPerl = new ContentItem(ContentItemType.Book,
                new string[] { "Intro Perl", "S.Nakov", "12763892", "http://www.introprogramming.info" });

            catalog.Add(bookPerl);
            catalog.Add(otherbookCsharp);
            catalog.Add(bookCsharp);
            catalog.Add(bookJava);
            var matchingElements = catalog.GetListContent("Intro C#", 3);
            Assert.AreEqual(3, matchingElements.Count());

            string[] actual =
            {
               "Book: Intro C#; A.Nakov; 12763892; http://www.introprogramming.info",
               "Book: Intro C#; B.Nakov; 12763892; http://www.introprogramming.info",
               "Book: Intro C#; C.Nakov; 12763892; http://www.introprogramming.info"
                                                                                    };
            string[] expected = new string[3];

            var i=0;
            foreach (var item  in matchingElements)
            {
                expected[i] = item.ToString();
                i++;
            }

            CollectionAssert.AreEqual(actual, expected);
        }
        public void CatalogUpdateContent_ThreeMatchingElements()
        {
            Catalog catalog = new Catalog();
            var bookCsharp = new ContentItem(ContentItemType.Book,
                new string[] { "Intro C#", "S.Nakov", "12763892", "http://www.csharp.info" });
            var bookJava = new ContentItem(ContentItemType.Book,
                new string[] { "Intro Java", "S.Nakov", "12763892", "http://www.java.info" });
            var bookPerl = new ContentItem(ContentItemType.Book,
                new string[] { "Intro Perl", "S.Nakov", "12763892", "http://www.perl.info" });

            catalog.Add(bookCsharp);
               // catalog.Add(bookCsharp);
              //  catalog.Add(bookCsharp);
            catalog.Add(bookJava);
            catalog.Add(bookPerl);
            var updated1 = catalog.UpdateContent("http://www.java.info", "http://www.csharp.info");
            var updated = catalog.UpdateContent("http://www.csharp.info", "http://telerikacademy.com");
            var updated2 = catalog.UpdateContent("http://www.perl.info", "http://telerikacademy.com");
            var updated3 = catalog.UpdateContent("http://telerikacademy.com", "http://telerik.com");

            Assert.AreEqual(3, updated3);
        }
        public void CatalogUpdateContent_OneMatchingAndFewNot()
        {
            Catalog catalog = new Catalog();
            var bookCsharp = new ContentItem(ContentItemType.Book,
                new string[] { "Intro C#", "S.Nakov", "12763892", "http://www.csharp.info" });
            var bookJava = new ContentItem(ContentItemType.Book,
                new string[] { "Intro Java", "S.Nakov", "12763892", "http://www.java.info" });
            var bookPerl = new ContentItem(ContentItemType.Book,
                new string[] { "Intro Perl", "S.Nakov", "12763892", "http://www.perl.info" });

            catalog.Add(bookCsharp);
            // catalog.Add(bookCsharp);
            //  catalog.Add(bookCsharp);
            catalog.Add(bookJava);
            catalog.Add(bookPerl);
            var updatedItems = catalog.UpdateContent("http://www.java.info", "http://www.csharp.info");

            Assert.AreEqual(1, updatedItems);
        }