コード例 #1
0
        public void Index_ReturnsCachedModels()
        {
            HttpConfiguration config = new HttpConfiguration();

            config.Routes.MapHttpRoute("Default", "{controller}/{id}", new { id = RouteParameter.Optional });
            HelpController controller = new HelpController(config);

            ViewResult result  = Assert.IsType <ViewResult>(controller.Index());
            ViewResult result2 = Assert.IsType <ViewResult>(controller.Index());

            Assert.NotNull(result.Model);
            Assert.NotNull(result2.Model);

            // Make sure the model is cached
            Assert.Same(config.Services.GetApiExplorer().ApiDescriptions, result.Model);
            Assert.Same(result.Model, result2.Model);
        }
コード例 #2
0
        public void Index_Should_Return_ViewResult()
        {
            // Arrange
            // Act
            ViewResult result = _helpController.Index() as ViewResult;

            // Assert
            Assert.That(result, Is.Not.Null);
        }
コード例 #3
0
        public void index_should_return_viewresult()
        {
            // Arrange
            _settingsRepository.SiteSettings.MarkupType = "Mediawiki";

            // Act
            ViewResult result = _helpController.Index() as ViewResult;

            // Assert
            Assert.That(result, Is.Not.Null);
        }
コード例 #4
0
        public void GetIndex_View()
        {
            //Arrange
            HelpController controller = new HelpController();

            //Act
            var result = controller.Index() as ViewResult;

            //Assert
            Assert.AreEqual("", result.ViewName);
        }
コード例 #5
0
        public void HelpController_Index_CallsGetByKeyAndDoesntCallCreateForExistingHelp()
        {
            #region Arrange

            const string helpKey = "homepage";

            #endregion

            #region Act

            var result = _mockController.Index(helpKey) as ViewResult;

            #endregion

            #region Assert


            Assert.IsNotNull(result);
            _mockContextHelpRefDataService.Verify(x => x.GetByHelpKey(helpKey), Times.Once);
            _mockContextHelpRefDataService.Verify(x => x.Create(It.IsAny <ContextHelpRefData>()), Times.Never);


            #endregion
        }
コード例 #6
0
        public void HelpController_Index_Get_ReturnsViewResult()
        {
            var result = _controller.Index("homepage") as ViewResult;

            Assert.IsNotNull(result);
        }