In RhinoMocks, there's Stub extension method, that takes Action<T>
. For some reason this:
CurrentInvoice.Stub(i => i.TaxYear).Return(1);
works great, but this:
CurrentInvoice.Stub(new Action<Invoice>(i => i.TaxYear)).Return(1);
produces the compiler error: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
The intellisense for this method explicitly says that it expects Action<Invoice>
, so I can't understand why the first works, but not the second.
The main relevance of this is that I'd like to be able to pass some of these configuration lambdas as parameters to a method, and I run into this same issue.
Thanks