예제 #1
0
 public void AddDublicateContent()
 {
     ICatalog catalog = new Catalog();
     string[] parameters = new string[] { "Intro C#", "S.Nakov", " 12763892", "http://www.introprogramming.info" };
     IContent content = new Content(CatalogItem.Book, parameters);
     catalog.Add(content);
     catalog.Add(content);
 }
예제 #2
0
        public void GetOneContetWhenOneExists()
        {
            ICatalog catalog = new Catalog();
            string[] parameters = new string[] { "Intro C#", "S.Nakov", " 12763892", "http://www.introprogramming.info" };
            IContent content = new Content(CatalogItem.Book, parameters);
            catalog.Add(content);

            IEnumerable<IContent> actual = catalog.GetListContent(parameters[0], 1);

            foreach (IContent currContent in actual)
            {
                Assert.AreEqual(currContent, content);
            }
        }
예제 #3
0
        public void Get30ContentsWhen3AreExpected()
        {
            int contentsCount = 0;

            ICatalog catalog = new Catalog();
            string[] parameters = new string[] { "Intro C#", "S.Nakov", " 12763892", "http://www.introprogramming.info" };
            IContent content = new Content(CatalogItem.Book, parameters);

            catalog.Add(content);
            catalog.Add(content);
            catalog.Add(content);
            catalog.Add(content);
            catalog.Add(content);
            catalog.Add(content);
            catalog.Add(content);
            catalog.Add(content);
            catalog.Add(content);
            catalog.Add(content);
            catalog.Add(content);
            catalog.Add(content);
            catalog.Add(content);
            catalog.Add(content);
            catalog.Add(content);
            catalog.Add(content);
            catalog.Add(content);
            catalog.Add(content);
            catalog.Add(content);
            catalog.Add(content);
            catalog.Add(content);
            catalog.Add(content);
            catalog.Add(content);
            catalog.Add(content);
            catalog.Add(content);
            catalog.Add(content);
            catalog.Add(content);
            catalog.Add(content);
            catalog.Add(content);
            catalog.Add(content);
            catalog.Add(content);
            catalog.Add(content);
            catalog.Add(content);
            catalog.Add(content);
            catalog.Add(content);
            catalog.Add(content);
            catalog.Add(content);
            catalog.Add(content);
            catalog.Add(content);
            catalog.Add(content);

            IEnumerable<IContent> actual = catalog.GetListContent(parameters[0], 3);

            foreach (IContent currContent in actual)
            {
                Assert.AreEqual(currContent, content);
                contentsCount++;
            }

            Assert.AreEqual(3,contentsCount);
        }
예제 #4
0
        public void NoneAreUpdated()
        {
            ICatalog catalog = new Catalog();
            string[] parameters = new string[] { "Intro C#", "S.Nakov", " 12763892", "http://www.introprogramming.info" };
            IContent content = new Content(CatalogItem.Book, parameters);
            catalog.Add(content);
            catalog.Add(content);
            int actual = catalog.UpdateContent("www.somethingelse.com", "www.xxxx.net");

            Assert.AreEqual(0, actual);
        }
예제 #5
0
        public void GetTwoDifferentContentsWhenExists()
        {

            ICatalog catalog = new Catalog();

            string[] firsParameters = new string[] { "Intro C#", "S.Nakov", " 12763892", "http://www.introprogramming.info" };
            IContent firstContent = new Content(CatalogItem.Book, firsParameters);

            string[] secondParameters = new string[] { "Biology", "Mr.Cell", "3387", "www.xxxx.com" };
            IContent secondContent = new Content(CatalogItem.Movie, secondParameters);


            IEnumerable<IContent> contentOne = catalog.GetListContent(firsParameters[0], 1);
            IEnumerable<IContent> contentTwo = catalog.GetListContent(secondParameters[0], 1);

            foreach (IContent currContet in contentOne)
            {
                Assert.AreEqual(firstContent, currContet);
            }

            foreach (IContent currContet in contentTwo)
            {
                Assert.AreEqual(secondContent, currContet);
            }
        }