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