当前位置: 首页>>代码示例>>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;未经允许,请勿转载。