Discussed in #4823
Originally posted by Dreamescaper September 13, 2024
Is there any reason not to use Action and Func<T> instead? Since Action and Func<T> are natural types for delegates in C#, using other delegates causes some confusion, e.g. here:
var getActual = () => "/* get actual value */";
Assert.That(getActual, Is.EqualTo("expectedValue").After(10000, 500));
Since I'm passing a delegate to Assert method, I'd expect a delegate overload to be invoked. Instead, non-delegate TActual overload is used, and assertion fails - because getActual is Func<string>, not ActualValueDelegate<TActual>.
Therefore, my question is. Would it make sense to to replace TestDelegate and ActualValueDelegate with Action and Func<T> in the next major version?
Discussed in #4823
Originally posted by Dreamescaper September 13, 2024
Is there any reason not to use
ActionandFunc<T>instead? SinceActionandFunc<T>are natural types for delegates in C#, using other delegates causes some confusion, e.g. here:Since I'm passing a delegate to Assert method, I'd expect a delegate overload to be invoked. Instead, non-delegate
TActualoverload is used, and assertion fails - becausegetActualisFunc<string>, notActualValueDelegate<TActual>.Therefore, my question is. Would it make sense to to replace
TestDelegateandActualValueDelegatewithActionandFunc<T>in the next major version?