0
I’m trying to use XUnit
to test my application, but I am getting this error at the time of injeção de dependência
. I get the following error:
Message: The following constructor Parameters Did not have matching fixture data: Icompetitionservice competitionManager
Class of 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);
}
}
And this is mine Controller
:
private readonly ICompetitionService _competitionManager;
public CampeonatosController(ICompetitionService competitionManager)
{
_competitionManager = competitionManager;
}
What am I doing wrong ?