public void PutBlog_Should_Return_No_Content() { var result = controller.PutBlog(1, modifyBlog); var action = Assert.IsAssignableFrom <NoContentResult>(result); mockService.Verify(x => x.ModifyBlog(It.IsAny <Blog>()), Times.Once()); }
public void PutBlogUnauthorizedUserReturnsUnauthorized() { // Arrange _userRepositoryMock.Setup(pr => pr.FirstOrDefault(It.IsAny <Expression <Func <User, bool> > >())) .Returns(_users[_userUnauthorizedIndexInArray]); // Act IHttpActionResult actionResult = _controller.PutBlog( _blogIDApprovedNoMockPosts, new BlogModel { BlogID = _blogIDApprovedNoMockPosts, BlogType = BlogTypes.WordPress, CreatedDate = new DateTime(2015, 12, 2, 14, 55, 32), Approved = false, AuthorEmail = "*****@*****.**", AuthorName = "Testy McTesterson", Description = "Testing", Link = "http://testy.wordpress.com", Title = "Testy's Blog" }); // Assert // Verify that HTTP status code result of update is unauthorized Assert.IsInstanceOfType(actionResult, typeof(UnauthorizedResult)); }