- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我一直使用 Nunit,现在转向 XUnit。
当我没有实现 IClassFixture
时,我成功地使用了 ITestOutputHelper
,例如:
public myClassTest(ITestOutputHelper outputHelper)
{
this.outputHelper = outputHelper;
}
然而,当我实现 IClassFixture
时,我找不到注入(inject) ITestOutputHelper
的方法。
无法实现 ITestOutputHelper 的示例
public class MyIntegrationTests : IClassFixture<TestServerFixture<Startup>>
{
public MyIntegrationTests (TestServerFixture<Startup> testServerFixture)
{
client = testServerFixture.Client;
}
}
我是否遗漏了显而易见的东西?
最佳答案
它应该只是通过做来工作:
public class MyIntegrationTests : IClassFixture<TestServerFixture<Startup>>
{
public MyIntegrationTests (TestServerFixture<Startup> testServerFixture, ITestOutputHelper outputHelper)
{
client = testServerFixture.Client;
this.outputHelper = outputHelper;
}
}
作为 ITestOutputHelper
,所有声明的类和共享装置都可以通过这种方式提供。
在输出窗口 (Ctrl-Alt-O) 的测试面板中,您得到了什么消息?
关于c# - 使用 IClassFixture 时输出测试结果 XUnit .net core,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50780626/
我有以下简化的伪代码 class CommonSetup { public void CommonSetup() { // do stuff once per cla
我的问题是如何在一个测试类中设置多个夹具? 但是 Zoo 类的构造函数不能处理多个 fixture。 例如: public class Zoo : IClassFixture, IClassFixtu
TextFixture 和测试 public class TestFixture : IDisposable { public TestFixture() { var
我正在使用 xUnit 进行集成测试。为此,我使用了一个 localdb 实例。话虽如此,我想用一些预定义的数据启动一次数据库实例,当然我希望所有测试用例都如此。我可以编写隔离的每个测试用例,这样它们
我一直使用 Nunit,现在转向 XUnit。 当我没有实现 IClassFixture 时,我成功地使用了 ITestOutputHelper,例如: public myClassTest(ITes
我为集成测试升级到 .net core 3.0 时遇到的问题做了一个 repo : https://github.com/ranouf/TestingWithDotNetCore3_0 当我启动测试时
我为集成测试升级到 .net core 3.0 时遇到的问题做了一个 repo : https://github.com/ranouf/TestingWithDotNetCore3_0 当我启动测试时
我是一名优秀的程序员,十分优秀!