如何在 dotnet 测试中使用可变字符串参数(Visual Studio 2022)
[Test]
public void MyTest(string MyString)
{
Console.WriteLine(MyString);
}
并使用这个变量字符串通过命令行执行测试?
dotnet test "C:\MyPath\Test.dll" --filter "FullyQualifiedName=QualifyTest.ColorTest("This is my String")
是否也可以用同样的方式传递“D:\This\is\my\path.txt”这样的路径名?
我应该使用包含参数的 [TestCase] 或 [TestCaseSource] 以及如何使用? 我使用 NUnit 3.0
谢谢你。
您可以使用类似于如何在运行时读取给定项目中的 MSBuild 属性?的答案。
但这似乎是一个复杂的解决方案。您想要注入什么样的动态信息?