namespace Producer.UnitTests.Controllers
{
    public class ParticipantsControllerTests
    {
        private readonly Mock<IDbConnectionFactory> _mockDbConnectionFactory;
        private readonly Mock<ILogger<Participant>> _mockLogger;
        private readonly Mock<IMapper> _mapper;
        public ParticipantsControllerTests()
        {
            _mockDbConnectionFactory = new Mock<IDbConnectionFactory>();
            _mockLogger = new Mock<ILogger<Participant>>();
            _mapper = new Mock<IMapper>();
        }
        [Fact]
        public async Task Get_ShouldReturnOkResponse_WhenIdExists()
        {
            var expectedSport = new Participant { Id = 1, Name = "Matan"};
            var mockDb = new Mock<IDbConnection>();
            mockDb.Setup(x => x.LoadSingleByIdAsync<Participant>(1, It.IsAny<string[]>(), It.IsAny<CancellationToken>())).ReturnsAsync(expectedSport);
            _mockDbConnectionFactory.Setup(x => x.OpenAsync(It.IsAny<CancellationToken>())).ReturnsAsync(mockDb.Object);
            var controller = new ParticipantsController(_mockDbConnectionFactory.Object, _mockLogger.Object, _mapper.Object);
            var result = await controller.Get(1);
            Assert.IsType<OkObjectResult>(result);
            var okResult = (OkObjectResult)result;
            var sport = (Sport)okResult.Value;
            Assert.Equal(expectedSport.Id, sport.Id);
            Assert.Equal(expectedSport.Name, sport.Name);
        }
    }
}
the setup on LoadSingleByIdAsync and OpenAsync isn't working because they are extension methods. what can I do to fix that? The error I get: System.NotSupportedException : Unsupported expression: x => x.LoadSingleByIdAsync((object)1, It.IsAny<string[]>(), It.IsAny()) Extension methods (here: OrmLiteReadApiAsync.LoadSingleByIdAsync) may not be used in setup / verification expressions.
