using AutoMapper; using CleanArchitecture.Application.Contracts.Persistence; using CleanArchitecture.Application.Features.Videos.Queries.GetVideosList; using CleanArchitecture.Application.Mappings; using CleanArchitecture.Application.UnitTests.Mocks; using CleanArchitecture.Infrastructure.Repositories; using Moq; using Shouldly; using Xunit; namespace CleanArchitecture.Application.UnitTests.Features.Video.Queries { public class GetVideosListQueryHandlerXUnitTests { private readonly IMapper mapper; private Mock mockUnitOfWork; public GetVideosListQueryHandlerXUnitTests() { mockUnitOfWork = MockUnitOfWork.GetUnitOfWork(); var mapperConfiguration = new MapperConfiguration(cfg => { cfg.AddProfile(); }); mapper = mapperConfiguration.CreateMapper(); MockVideoRepository.AddDataVideoRepository(mockUnitOfWork.Object.StreamerDbContext); } [Fact] public async Task GetVideoListTest() { var handler = new GetVideosListQueryHandler(mockUnitOfWork.Object, mapper); var request = new GetVideosListQuery("Alex"); var result = await handler.Handle(request, CancellationToken.None); result.ShouldBeOfType>(); result.Count.ShouldBe(1); } } }