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


C# Catalog.Add方法代碼示例

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


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

示例1: Add_AddTwoIndenticalBooksAndThreeOtherItems

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

            string[] testMovieContentParams = new string[] { "The Secret", "Drew Heriot, Sean Byrne & others (2006)", "832763834", "http://t.co/dNV4d" };
            IContent testMovieContent = new Content(ContentType.Book, testMovieContentParams);
            currentCatalog.Add(testMovieContent);

            string[] testApplicationContentParams = new string[] { "Firefox v.11.0", "Mozilla", "16148072", "http://www.mozilla.org" };
            IContent testApplicationContent = new Content(ContentType.Book, testApplicationContentParams);
            currentCatalog.Add(testApplicationContent);

            string[] testSongContentParams = new string[] { "One", "Metallica", "8771120", "http://goo.gl/dIkth7gs" };
            IContent testSongContent = new Content(ContentType.Book, testSongContentParams);
            currentCatalog.Add(testSongContent);

            IEnumerable<IContent> currentContent = currentCatalog.GetListContent("One", 10);
            int numberOfRenurnedResults = currentContent.Count();

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

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

示例3: TestMethodAddDuplicatedItems

 public void TestMethodAddDuplicatedItems()
 {
     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);
     Assert.AreEqual(2, catalog.Count);
 }
開發者ID:diagara,項目名稱:Telerik-Academy,代碼行數:11,代碼來源:UnitTestICatalog.cs

示例4: Add_AddTwoIndenticalBooksAndGetOne

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

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

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

示例5: TestMethodAddMultipleItems

 public void TestMethodAddMultipleItems()
 {
     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.Movie,
        new string[] { "Intro C# Movie", "Kiril Petrov", "12231331", "http://www.introprogramming.info/movie" });
     catalog.Add(secondItem);
     Content thirdItem = new Content(ContentType.Song,
      new string[] { "Intro C# Song", "Petar Petrov", "12444455", "http://www.introprogramming.info/song" });
     catalog.Add(thirdItem);
     Assert.AreEqual(3, catalog.Count);
 }
開發者ID:diagara,項目名稱:Telerik-Academy,代碼行數:14,代碼來源:UnitTestICatalog.cs

示例6: TestMethodAddDuplicateItem

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

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

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

            Assert.AreEqual(3, catalog.Count);
        }
開發者ID:sabrie,項目名稱:TelerikAcademy,代碼行數:15,代碼來源:CatalogTests.cs

示例7: Add_AddOneBookWithParamsNull

 public void Add_AddOneBookWithParamsNull()
 {
     string[] testContentParams = new string[] { null };
     IContent testContent = new Content(ContentType.Book, testContentParams);
     ICatalog currentCatalog = new Catalog();
     currentCatalog.Add(testContent);
 }
開發者ID:quela,項目名稱:myprojects,代碼行數:7,代碼來源:ICatalogTests.cs

示例8: AddDuplicateValue

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

            catalog.Add(new Content(
                ContentType.Application, "C#", "Nakov", 7, "http://nakov.com/"
            ));
            catalog.Add(new Content(
                ContentType.Application, "C#", "Nakov", 7, "http://nakov.com/"
            ));

            int expected = 2;
            int actual = catalog.Count;

            Assert.AreEqual(expected, actual);
        }
開發者ID:dgrigorov,項目名稱:TelerikAcademy-1,代碼行數:16,代碼來源:ICatalogTests.cs

示例9: TestMethodAddSingleItem

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

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

示例11: TestMethodAdd500Items

 public void TestMethodAdd500Items()
 {
     Catalog catalog = new Catalog();
     for (int i = 0; i < 500; i++)
     {
         Content item = new Content(ContentType.Book,
             new string[] { "Intro C#" + (i % 5), "S.Nakov", "12763892",
                 "http://www.introprogramming.info" });
         catalog.Add(item);
     }
     Assert.AreEqual(500, catalog.Count);
 }
開發者ID:diagara,項目名稱:Telerik-Academy,代碼行數:12,代碼來源:UnitTestICatalog.cs

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

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

示例14: Index

 public void Index()
 {
     Indexer indexer = new Indexer(new string[] { Environment.GetFolderPath(Environment.SpecialFolder.StartMenu) });
     Catalog catalog = new Catalog();
     List<string> items = indexer.Index();
     foreach (string item in items)
     {
         string name = new FileInfo(item).Name;
         catalog.Add(new CatalogItem() { Path = item, Name = name.Substring(0, name.Length - 4) });
     }
     _catalog = catalog;
     _catalog.Meta = new CatalogMeta { LastGenerated = DateTime.Now };
 }
開發者ID:itsbth,項目名稱:DoIt,代碼行數:13,代碼來源:DoItManager.cs

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


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