選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

ImportControllerTests.cs 1.1KB

123456789101112131415161718192021222324252627282930
  1. using Diligent.WebAPI.Contracts.DTOs.Applicant;
  2. using Microsoft.AspNetCore.Http;
  3. namespace Diligent.WebAPI.Tests.Controllers
  4. {
  5. public class ImportControllerTests
  6. {
  7. private readonly IFormFile file = Substitute.For<IFormFile>();
  8. private readonly IImportService _service = Substitute.For<IImportService>();
  9. private readonly IApplicantService _applicantService = Substitute.For<IApplicantService>();
  10. private readonly List<ApplicantImportDto> _applicants;
  11. public ImportControllerTests()
  12. {
  13. _applicants = new List<ApplicantImportDto>
  14. {
  15. new ApplicantImportDto{Email = "dzenis@dilig.net"}
  16. };
  17. }
  18. [Fact]
  19. public async Task Import_ShoudReutnr_200OK()
  20. {
  21. _service.Import(Arg.Any<IFormFile>()).Returns(_applicants);
  22. ImportController controller = new ImportController(_service, _applicantService);
  23. var result = await controller.Import(file);
  24. (result as OkResult).StatusCode.Should().Be(200);
  25. }
  26. }
  27. }