本文整理汇总了C#中DotNetNuke.Entities.Content.Taxonomy.TermController.GetTermsByContent方法的典型用法代码示例。如果您正苦于以下问题:C# TermController.GetTermsByContent方法的具体用法?C# TermController.GetTermsByContent怎么用?C# TermController.GetTermsByContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DotNetNuke.Entities.Content.Taxonomy.TermController
的用法示例。
在下文中一共展示了TermController.GetTermsByContent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TermController_GetTermsByContent_Returns_Terms_On_Valid_ContentItemId
public void TermController_GetTermsByContent_Returns_Terms_On_Valid_ContentItemId()
{
//Arrange
Mock<IDataService> mockDataService = new Mock<IDataService>();
mockDataService.Setup(ds => ds.GetTermsByContent(Constants.TERM_ValidContent1))
.Returns(MockHelper.CreateValidTermsReader(Constants.TERM_ValidCountForContent1,
v => Constants.TERM_ValidVocabularyId,
c => Constants.TERM_ValidContent1));
TermController termController = new TermController(mockDataService.Object);
//Act
List<Term> terms = termController.GetTermsByContent(Constants.TERM_ValidContent1).ToList();
//Assert
Assert.AreEqual(Constants.TERM_ValidCountForContent1, terms.Count);
for (int i = 0; i < Constants.TERM_ValidCountForContent1; i++)
{
Assert.AreEqual(i + Constants.TERM_ValidTermId, terms[i].TermId);
Assert.AreEqual(ContentTestHelper.GetTermName(i + Constants.TERM_ValidTermId), terms[i].Name);
}
}
示例2: TermController_GetTermsByContent_Throws_On_Invalid_ContentItemId
public void TermController_GetTermsByContent_Throws_On_Invalid_ContentItemId()
{
//Arrange
Mock<IDataService> mockDataService = new Mock<IDataService>();
TermController termController = new TermController(mockDataService.Object);
//Act, Arrange
Assert.Throws<ArgumentOutOfRangeException>(() => termController.GetTermsByContent(Null.NullInteger));
}
示例3: TermController_GetTermsByContent_Calls_DataService
public void TermController_GetTermsByContent_Calls_DataService()
{
//Arrange
Mock<IDataService> mockDataService = new Mock<IDataService>();
mockDataService.Setup(ds => ds.GetTermsByContent(Constants.TERM_ValidContent1))
.Returns(MockHelper.CreateValidTermsReader(Constants.TERM_ValidCountForContent1,
v => Constants.TERM_ValidVocabularyId,
c => Constants.TERM_ValidContent1));
TermController termController = new TermController(mockDataService.Object);
//Act
IQueryable<Term> terms = termController.GetTermsByContent(Constants.TERM_ValidContent1);
//Assert
mockDataService.Verify(ds => ds.GetTermsByContent(Constants.TERM_ValidContent1));
}