當前位置: 首頁>>代碼示例>>C#>>正文


C# Catalog.UpdateContent方法代碼示例

本文整理匯總了C#中Catalog.UpdateContent方法的典型用法代碼示例。如果您正苦於以下問題:C# Catalog.UpdateContent方法的具體用法?C# Catalog.UpdateContent怎麽用?C# Catalog.UpdateContent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Catalog的用法示例。


在下文中一共展示了Catalog.UpdateContent方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: UpdateCatalog_TryToUpdateMissingUrl

        public void UpdateCatalog_TryToUpdateMissingUrl()
        {
            string[] testContentParams = new string[] { "Intro C#", "S.Nakov", "12763892", "http://www.introprogramming.info" };
            IContent testContent = new Content(ContentType.Book, testContentParams);
            ICatalog currentCatalog = new Catalog();
            currentCatalog.Add(testContent);

            string oldURL = "http://www.missingURL.info";
            string newURL = "http://www.introprogramming.com";
            int updatedItems = currentCatalog.UpdateContent(oldURL, newURL);

            Assert.AreEqual(0, updatedItems);
        }
開發者ID:quela,項目名稱:myprojects,代碼行數:13,代碼來源:ICatalogTests.cs

示例2: UpdateCatalog_AddTwoIndenticalBooksAndUpdateURLsCheckIsAllUpdated

        public void UpdateCatalog_AddTwoIndenticalBooksAndUpdateURLsCheckIsAllUpdated()
        {
            string[] testContentParams = new string[] { "Intro C#", "S.Nakov", "12763892", "http://www.introprogramming.info" };
            IContent testContent = new Content(ContentType.Book, testContentParams);
            ICatalog currentCatalog = new Catalog();
            currentCatalog.Add(testContent);
            currentCatalog.Add(testContent);

            string oldURL = "http://www.introprogramming.info";
            string newURL = "http://www.introprogramming.com";
            currentCatalog.UpdateContent(oldURL, newURL);

            IEnumerable<IContent> currentContent = currentCatalog.GetListContent("Intro C#", 1);
            bool isAllUpdated = true;

            foreach (IContent content in currentContent)
            {
                if (oldURL == content.URL)
                {
                    isAllUpdated = false;
                    break;
                }
            }

            Assert.IsTrue(isAllUpdated);
        }
開發者ID:quela,項目名稱:myprojects,代碼行數:26,代碼來源:ICatalogTests.cs

示例3: UpdateCatalog_AddFiveItemsAndUpdateAll

        public void UpdateCatalog_AddFiveItemsAndUpdateAll()
        {
            string[] testContentParams = new string[] { "Intro C#", "S.Nakov", "12763892", "http://www.introprogramming.info" };
            IContent testContent = new Content(ContentType.Book, testContentParams);
            ICatalog currentCatalog = new Catalog();
            currentCatalog.Add(testContent);
            currentCatalog.Add(testContent);

            string[] testMovieContentParams = new string[] { "IndenticalTitle", "Drew Heriot, Sean Byrne & others (2006)", "832763834", "http://www.introprogramming.info" };
            IContent testMovieContent = new Content(ContentType.Book, testMovieContentParams);
            currentCatalog.Add(testMovieContent);

            string[] testApplicationContentParams = new string[] { "IndenticalTitle", "Mozilla", "16148072", "http://www.introprogramming.info" };
            IContent testApplicationContent = new Content(ContentType.Book, testApplicationContentParams);
            currentCatalog.Add(testApplicationContent);

            string[] testSongContentParams = new string[] { "DifferentTitle", "Metallica", "8771120", "http://www.introprogramming.info" };
            IContent testSongContent = new Content(ContentType.Book, testSongContentParams);
            currentCatalog.Add(testSongContent);

            string oldURL = "http://www.introprogramming.info";
            string newURL = "http://www.introprogramming.com";
            int updatedItems = currentCatalog.UpdateContent(oldURL, newURL);

            Assert.AreEqual(5, updatedItems);
        }
開發者ID:quela,項目名稱:myprojects,代碼行數:26,代碼來源:ICatalogTests.cs

示例4: UpdateContent_WithSingleMatchingElement_ShouldReturn1

        public void UpdateContent_WithSingleMatchingElement_ShouldReturn1()
        {
            string oldUrl = "http://www.test0.com/";
            string newUrl = "http://www.modified.com/";
            ICatalog catalog = new Catalog();
            for (int i = 0; i < 10; ++i)
            {
                catalog.Add(new Content(ContentType.Music, new string[]
                {
                    "TestTitle", "TestMusicAuthor", "3333", @"http://www.test" + i + ".com/"
                }));
            }

            int itemsUpdated = catalog.UpdateContent(oldUrl, newUrl);

            Assert.AreEqual(1, itemsUpdated);
        }
開發者ID:androidejl,項目名稱:Telerik,代碼行數:17,代碼來源:ICatalogTests.cs

示例5: UpdateCatalog_AddTwoIndenticalBooksAndUpdateURLs

        public void UpdateCatalog_AddTwoIndenticalBooksAndUpdateURLs()
        {
            string[] testContentParams = new string[] { "Intro C#", "S.Nakov", "12763892", "http://www.introprogramming.info" };
            IContent testContent = new Content(ContentType.Book, testContentParams);
            ICatalog currentCatalog = new Catalog();
            currentCatalog.Add(testContent);
            currentCatalog.Add(testContent);

            string oldURL = "http://www.introprogramming.info";
            string newURL = "http://www.introprogramming.com";
            currentCatalog.UpdateContent(oldURL, newURL);

            IEnumerable<IContent> currentContent = currentCatalog.GetListContent("Intro C#", 1);
            string currentContentNewURL = currentContent.First().URL;

            Assert.AreEqual(newURL, currentContentNewURL);
        }
開發者ID:quela,項目名稱:myprojects,代碼行數:17,代碼來源:ICatalogTests.cs

示例6: UpdateContent_WithNoMatchingElemet

        public void UpdateContent_WithNoMatchingElemet()
        {
            ICatalog catalog = new Catalog();
            catalog.Add(new Content(ContentType.Music, new string[]
            {
                "TestTitle", "TestMusicAuthor", "3333", @"http://www.test1.com/"
            }));

            int itemsUpdated = catalog.UpdateContent("http://www.test.com/", "http://www.modified.com/");

            Assert.AreEqual(0, itemsUpdated);
        }
開發者ID:androidejl,項目名稱:Telerik,代碼行數:12,代碼來源:ICatalogTests.cs

示例7: UpdateContent_WithMultipleItemsmatch_TestIfUrlsAreUpdated

        public void UpdateContent_WithMultipleItemsmatch_TestIfUrlsAreUpdated()
        {
            string oldUrl = "http://www.test0.com/";
            string newUrl = "http://www.modified.com/";
            ICatalog catalog = new Catalog();
            for (int i = 0; i < 10; ++i)
            {
                catalog.Add(new Content(ContentType.Music, new string[]
                {
                    "TestTitle", "TestMusicAuthor", "3333", @"http://www.test" + (i % 2) + ".com/"
                }));
            }

            int itemsUpdated = catalog.UpdateContent(oldUrl, newUrl);
            IEnumerable<IContent> updated = catalog.GetListContent("TestTitle", 1000);

            bool allAreUpdated = true;
            foreach (var item in updated)
            {
                if (item.Url == oldUrl)
                {
                    allAreUpdated = false;
                    break;
                }
            }

            Assert.IsTrue(allAreUpdated);
        }
開發者ID:androidejl,項目名稱:Telerik,代碼行數:28,代碼來源:ICatalogTests.cs

示例8: UpdateContent_WithAllElementsMatching

        public void UpdateContent_WithAllElementsMatching()
        {
            string oldUrl = "http://www.test.com/";
            string newUrl = "http://www.modified.com/";

            ICatalog catalog = new Catalog();
            for (int i = 0; i < 10; ++i)
            {
                catalog.Add(new Content(ContentType.Music, new string[]
                {
                    "TestTitle", "TestMusicAuthor", "3333", oldUrl
                }));
            }

            int itemsUpdated = catalog.UpdateContent(oldUrl, newUrl);

            Assert.AreEqual(10, itemsUpdated);
        }
開發者ID:androidejl,項目名稱:Telerik,代碼行數:18,代碼來源:ICatalogTests.cs

示例9: TestMethodUpdateOneItem

 public void TestMethodUpdateOneItem()
 {
     Catalog catalog = new Catalog();
     Content item = new Content(ContentType.Book,
         new string[] { "Intro C#", "S.Nakov", "12763892", "http://www.introprogramming.info" });
     catalog.Add(item);
     var result = catalog.UpdateContent("http://www.introprogramming.info", "http://introprograming.info/en/");
     Assert.AreEqual(result, 1);
 }
開發者ID:diagara,項目名稱:Telerik-Academy,代碼行數:9,代碼來源:UnitTestICatalog.cs

示例10: TestMethodUpdateOneItem

        public void TestMethodUpdateOneItem()
        {
            Catalog catalog = new Catalog();

            ContentItem book = new ContentItem(ContentItemType.Book,
                new string[] { "Intro C#", "S.Nakov", "12763892",
                    "http://www.introprogramming.info" });
            catalog.Add(book);

            ContentItem application = new ContentItem(ContentItemType.Application,
                new string[] { "Intro C#", "Adam Salin", "23569842",
                    "http://www.app.com" });
            catalog.Add(application);

            ContentItem movie = new ContentItem(ContentItemType.Movie,
                new string[] { "Intro C#", "James Gosling", "53265489",
                    "http://www.java.com" });
            catalog.Add(movie);

            int updatedCount = catalog.UpdateContent("http://www.java.com", "http://new.com");
            Assert.AreEqual(1, updatedCount);

            updatedCount = catalog.UpdateContent("http://www.java.com", "http://new.com");
            Assert.AreEqual(0, updatedCount);

            updatedCount = catalog.UpdateContent("http://www.app.com", "http://new.com");
            Assert.AreEqual(1, updatedCount);

            updatedCount = catalog.UpdateContent("http://new.com", "http://alabala.com");
            Assert.AreEqual(2, updatedCount);
        }
開發者ID:sabrie,項目名稱:TelerikAcademy,代碼行數:31,代碼來源:CatalogTests.cs


注:本文中的Catalog.UpdateContent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。