你如何使用 ShouldThrow
How do you use ShouldThrow
我觉得应该是
Should.Throw<ArgumentNullException>(module.Execute(badArgument));
但是当我尝试在 Should class 或命名空间上没有 Throw 方法时。
但是有几个方法,但是当我调用 ShouldThrow
Should.ActionAssertionExtensions
.ShouldThrow<ArgumentNullException>(() => module.Execute(badArgument));
它说这是一个模棱两可的调用,因为有两个 ShouldThrow 方法签名
void ShouldThrow<TException>(this Should.Core.Assertions.Assert.ThrowsDelegate)
void ShouldThrow<TException>(this System.Action)
您should
正在使用:
Action action = () => module.Execute(badArgument);
action.ShouldThrow<ArgumentNullException>();
这些是在断言对象上调用的扩展方法。
我觉得应该是
Should.Throw<ArgumentNullException>(module.Execute(badArgument));
但是当我尝试在 Should class 或命名空间上没有 Throw 方法时。
但是有几个方法,但是当我调用 ShouldThrow
Should.ActionAssertionExtensions
.ShouldThrow<ArgumentNullException>(() => module.Execute(badArgument));
它说这是一个模棱两可的调用,因为有两个 ShouldThrow 方法签名
void ShouldThrow<TException>(this Should.Core.Assertions.Assert.ThrowsDelegate)
void ShouldThrow<TException>(this System.Action)
您should
正在使用:
Action action = () => module.Execute(badArgument);
action.ShouldThrow<ArgumentNullException>();
这些是在断言对象上调用的扩展方法。