Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

ScheduleServiceTests.cs 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using AutoMapper;
  2. using Diligent.WebAPI.Business.MappingProfiles;
  3. using Diligent.WebAPI.Business.Services;
  4. using Diligent.WebAPI.Contracts.DTOs.Schedule;
  5. using Diligent.WebAPI.Data.Entities;
  6. using Microsoft.Extensions.Logging;
  7. namespace Diligent.WebAPI.Tests.Services
  8. {
  9. public class ScheduleServiceTests
  10. {
  11. private readonly IMapper _mapper;
  12. private ILogger<ScheduleService> _logger = Substitute.For<ILogger<ScheduleService>>();
  13. public ScheduleServiceTests()
  14. {
  15. var configuration = new MapperConfiguration(cfg => cfg.AddProfiles(
  16. new List<Profile>
  17. {
  18. new ApplicantMappingProfile(),
  19. new SelectionProcessMappingProfile(),
  20. new SelectionLevelMappingProfile()
  21. }));
  22. _mapper = new Mapper(configuration);
  23. }
  24. [Fact]
  25. public async Task GetScheduleForCertainPeriod_ShouldReturnListOfSchedules_Always()
  26. {
  27. var selectionProcesses = MockData.GetListOfSelectionProcess();
  28. var databaseContext = await Helpers<SelectionProcess>.GetDatabaseContext(selectionProcesses);
  29. ScheduleService scheduleService = new(databaseContext, _mapper, _logger);
  30. var result = await scheduleService.GetScheduleForCertainPeriod(DateTime.Now.Month, DateTime.Now.Year);
  31. result.Should().BeEquivalentTo(_mapper.Map<List<ScheduleViewDto>>(selectionProcesses));
  32. }
  33. }
  34. }