예제 #1
0
        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);
        }
예제 #2
0
        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);
        }