As (Async)TestDelegate ,Action and Func<Task> do not return actual values, their only use is to executed under a Throw constraint so we can catch any exceptions.
Currently we allow Assert.That(() => {}, Is.Not.Null); and all other useless combinations.
We should only allow Assert.That(() => {}, Throws.Nothing)
Suitable modifiers should still be supported:
Assert.That(SomeMethod, Throws.ArgumentExeption.With.ParamName("arg"));
Assert.That(SomeMethod, Throws.Exeption<ArgumentException>().With(x => Assert.That(x.ParamName, Is.EqualTo("arg"))));
Assert.That(SomeMethod, Throws.Exeption<ArgumentException>().With(x => x.ParamName).EqualTo("arg"));
As
(Async)TestDelegate,ActionandFunc<Task>do not return actual values, their only use is to executed under aThrowconstraint so we can catch any exceptions.Currently we allow
Assert.That(() => {}, Is.Not.Null);and all other useless combinations.We should only allow
Assert.That(() => {}, Throws.Nothing)Suitable modifiers should still be supported: