Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

CommentsControllerTests.cs 865B

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