sequenceSetup.ReturnsRange(Enumerable.Repeat(lastValue, int.MaxValue))
though that hasn't been implemented. We've briefly discussed this in moq/moq4#573.
mock.SetReturnsDefault
. (Though take note that this is not specific to one method setup, but to all of a mock's methods.)
Arguments
get boxed as object
s (boxing isn't allowed for by-ref structs, i.e. stack-only types). But as far as my current understanding of Moq 5 goes, that at least would be a limitation caused by its own API, and not by the underlying technology.
Type
, MethodInfo
etc. Try to do something with the much lower-level System.Reflection.Metadata or Mono.Cecil, and you'll soon see what System.Reflection provides beyond those. Like other parts in the BCL (say, LINQ expression trees, or CodeDOM), Reflection would ideally be updated together with C# language innovation... and that hasn't fully happened for quite a few years now. For example, try DynamicInvoke
-ing a delegate that has spans in its signature; or try reflecting over all the custom modifiers that the C# compiler rmits these days. Yes, Reflection isn't the only limiting factor. You're already aware of some LINQ expression tree limitations (no assignment, no async
/await
, no default parameters, etc.) though Moq 4 can partly work around rhose. But at the end of the day, those parts of the BCL lag behind Roslyn.