本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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 };
}
示例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);
}