Пример #1
0
        public void Index()
        {
            // Arrange
            var controller = new ArticlesController();

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

            // Assert
            Assert.IsNotNull(result);
        }
Пример #2
0
        public void Admin()
        {
            // Arrange
            var controller = new ArticlesController();

            // Act
            var result = controller.Admin();

            // Assert
            Assert.IsNotNull(result);
        }
Пример #3
0
        public void Index_IsRequested_ReturnsViewResult()
        {
            // Arrange
            var mockHttpContext = new Mock<HttpContextBase>();
            mockHttpContext.Setup(x => x.Request.QueryString).Returns(new NameValueCollection());
            var articles = new Fake<IArticleRepository>();
            var comments = new Fake<ICommentRepository>();
            var controller = new ArticlesController(
                articles.FakedObject, comments.FakedObject, mockHttpContext.Object);
            A.CallTo(() => controller._articleRepository.GetsArticles(A<int>.Ignored, A<int>.Ignored)).Returns(null);

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

            // Assert
            Assert.IsInstanceOfType(result, typeof(ViewResult));
        }