本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例10: GetEmpty
public void GetEmpty()
{
Catalog catalog = new Catalog();
int expected = 0;
int actual = catalog.GetListContent("Java", 1).Count();
Assert.AreEqual(expected, actual);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}