コード例 #1
0
        public void AddNewPost_NotVerified()
        {
            int postId = -1;

            _postsRepoMock.Setup(m => m.GetPost(postId)).Returns(new UserPost {
                Verified = false, RecordStatusId = (int)RecordStatus.Active, IdUser = 2, Text = "Test", PostId = postId
            });
            PostController controller = new PostController(_postsRepoMock.Object, _loginUser);

            PartialViewResult result = controller.AddNewPost(postId);

            Assert.IsNotNull(result);
            Assert.IsTrue(result.ViewName == "_AddNewPost");
            Assert.IsNull(result.Model);
            Assert.IsNotNull(controller.ViewBag.VisibilityOptions);
        }