gpt4 book ai didi

xunit - 如何实现 IXunitTestCollectionFactory

转载 作者:行者123 更新时间:2023-12-04 01:14:19 25 4
gpt4 key购买 nike

我找不到任何关于使用/实现的文档 IXunitTestCollectionFactory .
我有一些关于如何解决某些测试用例存在的自定义逻辑,从 xunit 源/示例中的翻找,这似乎是要走的路。

public class Foo : IXunitTestCollectionFactory
{
public Foo(ITestAssembly assembly, IMessageSink messageSink)
{
throw new NotImplementedException();
}

public ITestCollection Get(ITypeInfo testClass)
{
throw new NotImplementedException();
}

public string DisplayName
{
get { throw new NotImplementedException(); }
}
}
这似乎永远不会运行,或者至少异常被吞下,我放入的任何真实代码似乎也没有运行。
我尝试将其添加到测试程序集中,但无济于事
[assembly: CollectionBehavior("MyAssembly.Foo", "MyAssembly")]
我从哪里开始?是否有任何关于此的文档?

最佳答案

这个:

[assembly: CollectionBehavior("MyAssembly.Foo", "MyAssembly")]

应该是这样的:
[assembly: CollectionBehavior("MyNamespace.Foo", "MyAssembly")]

关于xunit - 如何实现 IXunitTestCollectionFactory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29413249/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com