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


C# Catalog.AddContent方法代碼示例

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


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

示例1: TestAddContent_WithDuplicateItem

 public void TestAddContent_WithDuplicateItem()
 {
     Catalog catalog = new Catalog();
     Content firstItem = new Content(ContentType.Book, new string[] { "Intro C#", "S.Nakov", "12763892", "http://www.introprogramming.info" });
     Content secondItem = new Content(ContentType.Book, new string[] { "Intro C#", "S.Nakov", "12763892", "http://www.introprogramming.info" });
     catalog.AddContent(firstItem);
     catalog.AddContent(secondItem);
     Assert.AreEqual(2, catalog.Count);
 }
開發者ID:Cecosam,項目名稱:Csharp-Projects,代碼行數:9,代碼來源:TestCatalog.cs

示例2: TestAddContent_WithDifferentItemTypes

 public void TestAddContent_WithDifferentItemTypes()
 {
     Catalog catalog = new Catalog();
     Content firstItem = new Content(ContentType.Book, new string[] { "Intro C#", "S.Nakov", "12763892", "http://www.introprogramming.info" });
     Content secondItem = new Content(ContentType.Movie, new string[] { "Rocky", "Sylvester Stalone", "1353151", "http://www.rockymovie.info" });
     Content thirdItem = new Content(ContentType.Song, new string[] { "Master of puppets", "Metallica", "2342332", "http://www.metallica.info" });
     catalog.AddContent(firstItem);
     catalog.AddContent(secondItem);
     catalog.AddContent(thirdItem);
     Assert.AreEqual(3, catalog.Count);
 }
開發者ID:Cecosam,項目名稱:Csharp-Projects,代碼行數:11,代碼來源:TestCatalog.cs

示例3: TestUpdatedContent_WithValidUrl

        public void TestUpdatedContent_WithValidUrl()
        {
            Catalog catalog = new Catalog();
            Content firstItem = new Content(ContentType.Book, new string[] { "Intro C#", "S.Nakov", "12763892", "http://www.introprogramming.info" });
            Content secondItem = new Content(ContentType.Book, new string[] { "Intro C#", "S.Nakov", "12763892", "http://www.introprogramming.info" });
            Content thirdItem = new Content(ContentType.Song, new string[] { "Master of puppets", "Metallica", "2342332", "http://www.metallica.info" });
            catalog.AddContent(firstItem);
            catalog.AddContent(secondItem);
            catalog.AddContent(thirdItem);

            var result = catalog.UpdatedContent("http://www.introprogramming.info", "http://www.introprogramming.se");
            Assert.AreEqual(2, result);
        }
開發者ID:Cecosam,項目名稱:Csharp-Projects,代碼行數:13,代碼來源:TestCatalog.cs

示例4: TestAddAndFindFromMultipleItems

        public void TestAddAndFindFromMultipleItems()
        {
            Catalog catalog = new Catalog();
            Content firstItem = new Content(ContentType.Book, new string[] { "Intro C#", "S.Nakov", "12763892", "http://www.introprogramming.info" });
            Content secondItem = new Content(ContentType.Book, new string[] { "Intro C#", "S.Nakov", "12763892", "http://www.introprogramming.info" });
            Content thirdItem = new Content(ContentType.Song, new string[] { "Master of puppets", "Metallica", "2342332", "http://www.metallica.info" });
            catalog.AddContent(firstItem);
            catalog.AddContent(secondItem);
            catalog.AddContent(thirdItem);

            var contentList = catalog.GetListContent("Intro C#", 3);
            Assert.AreEqual(3, catalog.Count);
            Assert.AreEqual(2, contentList.Count());
            Assert.AreSame(contentList.ElementAt(0), firstItem);
            Assert.AreSame(contentList.ElementAt(1), secondItem);
        }
開發者ID:Cecosam,項目名稱:Csharp-Projects,代碼行數:16,代碼來源:TestCatalog.cs

示例5: TestAddContent_WithSingleItem

 public void TestAddContent_WithSingleItem()
 {
     Catalog catalog = new Catalog();
     Content item = new Content(ContentType.Book, new string[] { "Intro C#", "S.Nakov", "12763892", "http://www.introprogramming.info" });
     catalog.AddContent(item);
     Assert.AreEqual(1, catalog.Count);
 }
開發者ID:Cecosam,項目名稱:Csharp-Projects,代碼行數:7,代碼來源:TestCatalog.cs

示例6: TestAddAndFindItem

 public void TestAddAndFindItem()
 {
     Catalog catalog = new Catalog();
     Content item = new Content(ContentType.Book, new string[]{"Intro C#", "S.Nakov", "12763892", "http://www.introprogramming.info"});
     catalog.AddContent(item);
     var contentList = catalog.GetListContent("Intro C#", 1);
     Assert.AreEqual(1, contentList.Count());
     Assert.AreSame(contentList.ElementAt(0), item);
 }
開發者ID:Cecosam,項目名稱:Csharp-Projects,代碼行數:9,代碼來源:TestCatalog.cs


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