using AutoMapper; using Diligent.WebAPI.Business.MappingProfiles; using Diligent.WebAPI.Business.Services; using Diligent.WebAPI.Contracts.DTOs.Schedule; using Diligent.WebAPI.Data.Entities; using Microsoft.Extensions.Logging; namespace Diligent.WebAPI.Tests.Services { public class ScheduleServiceTests { private readonly IMapper _mapper; private ILogger _logger = Substitute.For>(); public ScheduleServiceTests() { var configuration = new MapperConfiguration(cfg => cfg.AddProfiles( new List { new ApplicantMappingProfile(), new SelectionProcessMappingProfile(), new SelectionLevelMappingProfile() })); _mapper = new Mapper(configuration); } [Fact] public async Task GetScheduleForCertainPeriod_ShouldReturnListOfSchedules_Always() { var selectionProcesses = MockData.GetListOfSelectionProcess(); var databaseContext = await Helpers.GetDatabaseContext(selectionProcesses); ScheduleService scheduleService = new(databaseContext, _mapper, _logger); var result = await scheduleService.GetScheduleForCertainPeriod(DateTime.Now.Month, DateTime.Now.Year); result.Should().BeEquivalentTo(_mapper.Map>(selectionProcesses)); } } }