Estou tentando utilizar XUnit
para fazer o teste de minha aplicação, mas estou recebendo esse erro na hora da injeção de dependência
. Recebo o seguinte erro:
Message: The following constructor parameters did not have matching fixture data: ICompetitionService competitionManager
Classe de Teste
:
public class CampeonatoTest
{
private const string IdReturnsOk = "2021";
private const string IdNotFound = "XXXX";
private readonly CampeonatosController _campeonato;
private readonly ICompetitionService _competitionManager;
public CampeonatoTest(
ICompetitionService competitionManager)
{
_competitionManager = competitionManager;
_campeonato = new CampeonatosController(_competitionManager);
}
[Fact]
public async Task Campeonato_GetById_ValuesReturnsOkResponse()
{
var response = await _campeonato.Get(IdReturnsOk);
var objectResponse = response as ObjectResult;
Assert.Equal(200, objectResponse.StatusCode);
}
[Fact]
public async Task Campeonato_GetById_ReturnsNotFoundResponse()
{
var response = await _campeonato.Get(IdNotFound);
var objectResponse = response as ObjectResult;
Assert.Equal(404, objectResponse.StatusCode);
}
}
E essa é minha Controller
:
private readonly ICompetitionService _competitionManager;
public CampeonatosController(ICompetitionService competitionManager)
{
_competitionManager = competitionManager;
}
Oque estou fazendo de errado ?