我有基本固定装置和派生固定装置。
然后我尝试将类型参数基础夹具放入另一个。
合法吗?
因为出现此错误:
System.AggregateException:发生一个或多个错误。 (类 灯具类型“ WebApplicationFixture”有一个或多个未解析 构造函数参数:WebApplicationFactory
1 factory) (The following constructor parameters did not have matching fixture data: WebApplicationFixture fixture) ---- Class fixture type 'WebApplicationFixture' had one or more unresolved constructor arguments: WebApplicationFactory
1个工厂 ----以下构造函数参数没有匹配的夹具数据:WebApplicationFixture夹具-----内部堆栈跟踪#1(Xunit.Sdk.TestClassException)-----
-----内部堆栈跟踪#2(Xunit.Sdk.TestClassException)-----
public class WebApplicationFixture : IClassFixture<WebApplicationFactory<Startup>>, IDisposable
{
protected internal readonly string AbsoluteUri;
protected internal readonly HttpClient HttpClient;
protected internal readonly HttpMessageHandler HttpMessageHandler;
public WebApplicationFixture(WebApplicationFactory<Startup> factory)
{
HttpClient = factory.CreateClient();
HttpMessageHandler = factory.Server.CreateHandler();
AbsoluteUri = factory.Server.BaseAddress.AbsoluteUri;
}
public void Dispose()
{
HttpClient?.Dispose();
HttpMessageHandler?.Dispose();
}
}
public class BasicTests : IClassFixture<WebApplicationFixture>, IDisposable
{
public BasicTests(WebApplicationFixture fixture)
{
_fixture = fixture;
_clientBuilder = _fixture.ClientBuilder;
}
public void Dispose()
{
_fixture.Dispose();
}
private readonly WebApplicationFixture _fixture;
}