xUnit:从代码中停止测试执行
本文关键字:测试 执行 代码 xUnit | 更新日期: 2023-09-27 18:02:28
我可以从代码中完成单元测试吗?有可能这样做吗?
[Fact]
public void Test()
{
code;
code;
code;
StopUnitTest(success: true);
code;
code;
}
不太确定为什么会这样做,我知道现在回复可能有点晚了。但是,使用goto
关键字可以潜在地解决这个问题。
参考:https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/goto