当前位置: 首页>>代码示例>>C#>>正文


C# Catalog.GetListContent方法代码示例

本文整理汇总了C#中Catalog.GetListContent方法的典型用法代码示例。如果您正苦于以下问题:C# Catalog.GetListContent方法的具体用法?C# Catalog.GetListContent怎么用?C# Catalog.GetListContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Catalog的用法示例。


在下文中一共展示了Catalog.GetListContent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Add_DuplicateAndNonDuplicateItems

        public void Add_DuplicateAndNonDuplicateItems()
        {
            ICatalog catalog = new Catalog();
            for (int i = 0; i < 10; ++i)
            {
                catalog.Add(new Content(ContentType.Book, new string[]
                {
                    "TestTitle", "TestAuthor", "432943", @"http://www.testingcatalog.com/"
                }));
            }

            catalog.Add(new Content(ContentType.Application, new string[]
            {
                "TestTitle", "TestAppAuthor", "111", @"http://www.testingappcatalog.com/"
            }));

            catalog.Add(new Content(ContentType.Movie, new string[]
            {
                "TestTitle", "TestMoveAuthor", "22", @"http://www.testingmoviecatalog.com/"
            }));

            catalog.Add(new Content(ContentType.Music, new string[]
            {
                "TestTitle", "TestMusicAuthor", "3333", @"http://www.testingmusiccatalog.com/"
            }));

            IEnumerable<IContent> foundContent = catalog.GetListContent("TestTitle", 100);
            int numberOfItemsFound = this.CountContentFound(foundContent);

            Assert.AreEqual(13, numberOfItemsFound);
        }
开发者ID:androidejl,项目名称:Telerik,代码行数:31,代码来源:ICatalogTests.cs

示例2: 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

示例3: Add_AddOneBookAndGetIt

        public void Add_AddOneBookAndGetIt()
        {
            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);

            IEnumerable<IContent> currentContent = currentCatalog.GetListContent("Intro C#", 2);
            var numberOfRenurnedResults = currentContent.Count();

            Assert.AreEqual(1, numberOfRenurnedResults);
        }
开发者ID:quela,项目名称:myprojects,代码行数:12,代码来源:ICatalogTests.cs

示例4: TestMethodAddAndFindItem

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

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

               var result = catalog.GetListContent("Intro C#", 1);
               Assert.AreEqual(result.Count(), 1);
               Assert.AreSame(result.First(), item);
        }
开发者ID:sabrie,项目名称:TelerikAcademy,代码行数:12,代码来源:CatalogTests.cs

示例5: TestMethodGetListContent500Items

 public void TestMethodGetListContent500Items()
 {
     Catalog catalog = new Catalog();
     for (int i = 0; i < 500; i++)
     {
         Content item = new Content(ContentType.Book,
             new string[] { "Intro C#", "S.Nakov", "12763892", "http://www.introprogramming.info" });
         catalog.Add(item);
     }
     var result = catalog.GetListContent("Intro C#", 500);
     Assert.AreEqual(result.Count(), 500);
 }
开发者ID:diagara,项目名称:Telerik-Academy,代码行数:12,代码来源:UnitTestICatalog.cs

示例6: Add_SingleBook

        public void Add_SingleBook()
        {
            ICatalog catalog = new Catalog();
            catalog.Add(new Content(ContentType.Book, new string[]
            {
                "TestTitle", "TestAuthor", "432943", "http://www.testingcatalog.com/"
            }));

            IEnumerable<IContent> foundContent = catalog.GetListContent("TestTitle", 10);
            int numberOfItemsFound = this.CountContentFound(foundContent);

            Assert.AreEqual(1, numberOfItemsFound);
        }
开发者ID:androidejl,项目名称:Telerik,代码行数:13,代码来源:ICatalogTests.cs

示例7: 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

示例8: 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

示例9: GetListContent_CheckSorting

        public void GetListContent_CheckSorting()
        {
            ICatalog catalog = new Catalog();
            for (int i = 9; i >= 0; --i)
            {
                catalog.Add(new Content(ContentType.Book, new string[]
                {
                    "TestTitle", "TestAuthor" + i, "432943" + i, "http://www.testingcatalog.com/"
                }));
            }

            IEnumerable<IContent> foundContent = catalog.GetListContent("TestTitle", 100);

            bool contentIsSorted = true;
            int currentIndex = 0;
            foreach (var item in foundContent)
            {
                if (!item.Author.EndsWith(currentIndex.ToString()))
                {
                    contentIsSorted = false;
                    break;
                }
                currentIndex++;
            }

            Assert.IsTrue(contentIsSorted);
        }
开发者ID:androidejl,项目名称:Telerik,代码行数:27,代码来源:ICatalogTests.cs

示例10: GetEmpty

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

            int expected = 0;
            int actual = catalog.GetListContent("Java", 1).Count();

            Assert.AreEqual(expected, actual);
        }
开发者ID:dgrigorov,项目名称:TelerikAcademy-1,代码行数:9,代码来源:ICatalogTests.cs

示例11: GetListContent_WithoutMatchingElement

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

            IEnumerable<IContent> foundContent = catalog.GetListContent("TestTitle1", 100);
            int numberOfItemsFound = this.CountContentFound(foundContent);

            Assert.AreEqual(0, numberOfItemsFound);
        }
开发者ID:androidejl,项目名称:Telerik,代码行数:13,代码来源:ICatalogTests.cs

示例12: GetListContent_WithMathingElementsMoreThanTheRequestedCount

        public void GetListContent_WithMathingElementsMoreThanTheRequestedCount()
        {
            ICatalog catalog = new Catalog();
            for (int i = 0; i < 10; ++i)
            {
                catalog.Add(new Content(ContentType.Book, new string[]
                {
                    "TestTitle", "TestAuthor", "432943", "http://www.testingcatalog.com/"
                }));
            }

            IEnumerable<IContent> foundContent = catalog.GetListContent("TestTitle", 3);
            int numberOfItemsFound = this.CountContentFound(foundContent);

            Assert.AreEqual(3, numberOfItemsFound);
        }
开发者ID:androidejl,项目名称:Telerik,代码行数:16,代码来源:ICatalogTests.cs

示例13: TestMethodGetListContentNoMatchingItem

 public void TestMethodGetListContentNoMatchingItem()
 {
     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.GetListContent("No Match C#", 0);
     Assert.AreEqual(result.Count(), 0);
 }
开发者ID:diagara,项目名称:Telerik-Academy,代码行数:9,代码来源:UnitTestICatalog.cs

示例14: TestMethodGetListContentDuplicatedItems

 public void TestMethodGetListContentDuplicatedItems()
 {
     Catalog catalog = new Catalog();
     Content firstItem = new Content(ContentType.Book,
         new string[] { "Intro C#", "S.Nakov", "12763892", "http://www.introprogramming.info" });
     catalog.Add(firstItem);
     Content secondItem = new Content(ContentType.Book,
         new string[] { "Intro C#", "S.Nakov", "12763892", "http://www.introprogramming.info" });
     catalog.Add(secondItem);
     var result = catalog.GetListContent("Intro C#", 2);
     Assert.AreEqual(result.Count(), 2);
     Assert.AreSame(result.First(), firstItem);
 }
开发者ID:diagara,项目名称:Telerik-Academy,代码行数:13,代码来源:UnitTestICatalog.cs

示例15: TestMethodGetListContentCheckOrder

        public void TestMethodGetListContentCheckOrder()
        {
            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);

            var result = catalog.GetListContent("Intro C#", 10);
            Assert.AreEqual(result.Count(), 3);

            string[] expected = new string[]
            {
                "Application: Intro C#; Adam Salin; 23569842; http://www.app.com",
                "Book: Intro C#; S.Nakov; 12763892; http://www.introprogramming.info",
                "Movie: Intro C#; James Gosling; 53265489; http://www.java.com"
            };

            string[] actual = new string[]
            {
                result.First().ToString(),
                result.Skip(1).First().ToString(),
                result.Skip(2).First().ToString()
            };

            CollectionAssert.AreEqual(expected, actual);
        }
开发者ID:sabrie,项目名称:TelerikAcademy,代码行数:38,代码来源:CatalogTests.cs


注:本文中的Catalog.GetListContent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。