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


C# TermController.GetTermsByContent方法代码示例

本文整理汇总了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);
            }
        }
开发者ID:neogic,项目名称:DotNetNuke_SVN,代码行数:23,代码来源:TermControllerTests.cs

示例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));
        }
开发者ID:neogic,项目名称:DotNetNuke_SVN,代码行数:9,代码来源:TermControllerTests.cs

示例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));
        }
开发者ID:neogic,项目名称:DotNetNuke_SVN,代码行数:16,代码来源:TermControllerTests.cs


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