Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/330.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何从NUnit3中的函数生成测试用例参数访问测试夹具参数?_C#_.net_Unit Testing_Nunit - Fatal编程技术网

C# 如何从NUnit3中的函数生成测试用例参数访问测试夹具参数?

C# 如何从NUnit3中的函数生成测试用例参数访问测试夹具参数?,c#,.net,unit-testing,nunit,C#,.net,Unit Testing,Nunit,我想基于NUnit3中的测试夹具参数(TestFixtureSource)生成测试用例参数(TestCaseSource) 如何访问测试用例源中的当前测试夹具参数 要访问TestFixture参数,需要fixture类的实例可用。在生成参数时,TestFixtureSource没有可用的特定实例,因此您所要求的是不可能的 您可以将夹具参数保存在构件变量或构造属性中,并从测试方法中访问它们。@Kritner您链接的问题是关于如何生成夹具参数。不是关于如何根据夹具参数生成测试用例参数。是的,对不起,

我想基于NUnit3中的测试夹具参数(TestFixtureSource)生成测试用例参数(TestCaseSource)


如何访问测试用例源中的当前测试夹具参数

要访问TestFixture参数,需要fixture类的实例可用。在生成参数时,TestFixtureSource没有可用的特定实例,因此您所要求的是不可能的


您可以将夹具参数保存在构件变量或构造属性中,并从测试方法中访问它们。

@Kritner您链接的问题是关于如何生成夹具参数。不是关于如何根据夹具参数生成测试用例参数。是的,对不起,在我reread@Chris
TestCaseSource
method/property可以使用一些静态方法/属性,例如
TestContext
,在这里可以存储信息。@TN.-对不起,我删除了我的注释-你说得对。