如何将 MSpec 测试设置为不确定



如何在测试中将MSpec测试设置为不确定?我正在寻找一个等价的Nunit Assert.Inconsignusive

我使用的是 0.9.3.0 版。

虽然 mspec 中没有不确定的状态,但您可以做的是跳过It委托的实现。这将使规范"未实现"。

It should_be_inconclusive;

另一种选择可能是使用 IgnoreAttribute 忽略上下文或特定It

[Ignore("This test is currently inconclusive")]
It should_not_be_null = () => Subject.ShouldNotBeNull();

https://github.com/machine/machine.specifications#usage

刚刚测试过在使用 Subject 注释的类的构造函数中抛出异常似乎可以解决问题。

我有一个弹出窗口,所以不理想..

最新更新