Example #1
0
        public void Saves_Correct_Values_CreatePost_BlogPanel()
        {
            // Arrange
            BlogPanelController cut = new BlogPanelController(FakePostRepository.Instance(), FakeTagRepository.Instance());

            // Act
            ViewResult result = cut.CreatePost("Zim za zoo", "bim ba boo <br />", "test1,test2", "#") as ViewResult;

            // Assert
            FakePostRepository.Instance().AssertWasCalled(x => x.Save());
            Assert.AreEqual(result.ViewName, "Poster");
        }
Example #2
0
        public void Delete_Calls_Save_Post_BlogPanel()
        {
            // Arrange
            BlogPanelController cut = new BlogPanelController(FakePostRepository.Instance(), FakeTagRepository.Instance());

            // Act
            ContentResult result = cut.DeletePost(2) as ContentResult;

            // Assert
            FakePostRepository.Instance().AssertWasCalled(x => x.Save());
            Assert.AreEqual(result.Content, "Done O.O");
        }
Example #3
0
        public void Returns_Correct_View_CreatePost_BlogPanel()
        {
            // Arrange
            BlogPanelController cut = new BlogPanelController(FakePostRepository.Instance(), FakeTagRepository.Instance());

            // Act
            ViewResult result = cut.CreatePost() as ViewResult;

            // Assert
            Assert.AreEqual(result.ViewName, "Poster");
        }
Example #4
0
        public void Returns_Correct_View_EditPost_BlogPanel()
        {
            // Arrange
            BlogPanelController cut = new BlogPanelController(FakePostRepository.Instance(), FakeTagRepository.Instance());
            long postId             = 2;
            Post post = FakePostRepository.Instance().Find(postId);
            // Act
            ViewResult result = cut.EditPost(postId) as ViewResult;

            // Assert
            Assert.AreEqual((result.Model as Post).PostId, postId);
            Assert.AreEqual(result.ViewName, "Poster");
        }