The following constructor parameters did not have matching fixture data for unit testing using moq and xunit.
Already using dependency injection and mock to test the class.
//this is how i register the DI.
services.AddScoped<IWaktuSolatServiceApi, WaktuSolatServiceApi>();
public interface IWaktuSolatServiceApi
{
Task<Solat> GetAsyncSet();
}
// the unit test.
public class UnitTest1
{
Mock<IWaktuSolatServiceApi> waktu;
public UnitTest1(IWaktuSolatServiceApi waktu)
{
this.waktu = new Mock<IWaktuSolatServiceApi>();
}
[Fact]
public async Task ShoudReturn()
{
var request = new Solat
{
zone = "lala"
};
var response = waktu.Setup(x =>
x.GetAsyncSet()).Returns(Task.FromResult(request));
}
}
But i got this error The following constructor parameters did not have matching fixture data.
Aucun commentaire:
Enregistrer un commentaire