我不确定是否可能,但我相信应该。我希望我不会错过一些很容易的事情。
我正在使用.Net CorewithXUnit并尝试在Assert.All.
一个断言正常工作,而两个断言导致编译时错误Operator '&&' cannot be applied to operands of type 'void' and 'void'.。不知道是什么意思。
这编译。
Assert.All(users, user => Assert.True(user.IsAdministrator));
Assert.All(users, user => Assert.True(user.Age >= YOUNG_AGE));
Run Code Online (Sandbox Code Playgroud)
这不编译。
Assert.All(users, user => (Assert.True(user.IsAdministrator) && Assert.True(user.Age >= YOUNG_AGE)));
Run Code Online (Sandbox Code Playgroud)
如果您能帮助我,我将不胜感激,谢谢!