public void Test_Post_CreateBlogPostComment() { // Arrange var res = false; var postId = "5ef312a0f05009584c12a93f"; var comments = new Comment() { CommentMsg = "Post Title Comments -1 ", PostId = "5ef312a0f05009584c12a93f" }; // Act mockservice.Setup(blogRepo => blogRepo.Comments(postId, comments)); var result = _services.Comments(postId, comments); if (result != null) { res = true; } // Assert //writing tset boolean output in text file, that is present in project directory File.AppendAllText("../../../../output_revised.txt", "Test_Post_CreateBlogPostComment=" + res.ToString() + "\n"); }
public async Task <bool> Test_ValidateComment_CommentMsgProperty_Empty() { //Arrange bool res = false; try { //Act mockservice.Setup(repo => repo.Comments(_blogPost.PostId, _comment)).ReturnsAsync(_comment); var result = await _services.Comments(_blogPost.PostId, _comment); if (result.CommentMsg != null) { res = true; } //Assert //writing tset boolean output in text file, that is present in project directory File.AppendAllText("../../../output_boundary_revised.txt", "Test_ValidateComment_CommentMsgProperty_Empty=" + res + "\n"); } catch (Exception ex) { throw (ex); } return(res); }
public async void Test_Post_CreateBlogPostComment() { // Arrange var res = false; // Act mockservice.Setup(blogRepo => blogRepo.Comments(_blogPost.PostId, _comment)).ReturnsAsync(_comment); var result = await _services.Comments(_blogPost.PostId, _comment); if (result == _comment) { res = true; } // Assert //writing tset boolean output in text file, that is present in project directory File.AppendAllText("../../../output_revised.txt", "Test_Post_CreateBlogPostComment=" + res.ToString() + "\n"); }
public async Task <bool> Test_ValidateComment_CommentMsgProperty_Empty() { //Arrange bool res = false; string postid = "5ef312a0f05009584c12a93f"; try { //Assigning values for new post var comment = new Comment() { CommentMsg = "Comment -1 " }; //Act mockservice.Setup(repo => repo.Comments(postid, comment)).ReturnsAsync(comment); var result = await _services.Comments(postid, comment); if (result.CommentMsg != null) { res = true; } else { res = false; } //Assert //writing tset boolean output in text file, that is present in project directory File.AppendAllText("../../../../output_boundary_revised.txt", "Test_ValidateComment_CommentMsgProperty_Empty=" + res + "\n"); } catch (Exception ex) { File.AppendAllText("../../../../output_boundary_revised.txt", "Test_ValidateComment_CommentMsgProperty_Empty=" + res + "\n"); throw (ex); } return(res); }
public async Task CreateNewComment_Null_Failure() { // Arrange // Arrange var res = false; var commnet = new Comment() { CommentMsg = "Post Title Comments -1 ", PostId = 1, CommentedDate = DateTime.Now }; commnet = null; //Act mockservice.Setup(blogRepo => blogRepo.Comments(_blogPost.PostId, commnet)); var result = await _services.Comments(_blogPost.PostId, commnet); if (result == null) { res = true; } //writing tset boolean output in text file, that is present in project directory File.AppendAllText("../../../output_exception_revised.txt", "CreateNewComment_Null_Failure=" + res + "\n"); }