You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CommentsControllerTests.cs 1004B

1234567891011121314151617181920212223242526272829303132
  1. using Diligent.WebAPI.Contracts.DTOs.Comment;
  2. namespace Diligent.WebAPI.Tests.Controllers
  3. {
  4. public class CommentsControllerTests
  5. {
  6. private ICommentService _commentService = Substitute.For<ICommentService>();
  7. public CommentsControllerTests()
  8. {
  9. }
  10. [Fact]
  11. public async Task Addcomment_ShouldReturn_201Created_Always()
  12. {
  13. int count = 0;
  14. _commentService.When(x => x.CreateComment(Arg.Any<CommentCreateDto>())).Do(x => { count++; });
  15. CommentsController commentsController = new(_commentService);
  16. CommentCreateDto commentCreateDto = new()
  17. {
  18. ApplicantId = 1000,
  19. Content = "some text",
  20. UserId = 1000,
  21. UsersToNotify = new List<string>()
  22. };
  23. var result = await commentsController.AddComment(commentCreateDto);
  24. (result as StatusCodeResult).StatusCode.Should().Be(201);
  25. }
  26. }
  27. }