예제 #1
0
        public async Task Article_When_Called_Should_Return_ViewResult()
        {
            mapperMock.Setup(x => x.Map <Article, ArticleViewModel>(It.IsAny <Article>()))
            .Returns(MockData.TestArticleViewModelMock());

            commentServiceMock.Setup(x => x.GetArticleComments(It.IsAny <int>())).Returns(MockData.TestArticleCommentsMock());

            mapperMock.Setup(x => x.Map <List <Comment>, List <CommentViewModel> >(It.IsAny <List <Comment> >()))
            .Returns(new List <CommentViewModel>());

            int articleId = 1;
            var result    = await appController.Article(articleId) as ViewResult;

            result.Should().BeOfType <ViewResult>();
        }