Search code examples
rhino-mocks

What is Rhino.Mocks.Function


Rhino Mocks adds two overloaded Stub methods to System.Object. One is Stub<T>(Action<T>) the other is Stub<T, R>(Function<T, R>)

What (if any) are the differences between Rhino.Mocks.Function<T, R> and System.Func<T, R> They both behave the same, but I doubt Ayende would have gone through the trouble to make a new type that did the same thing as a built-in one that already existed.


Solution

  • The Rhino.Mocks.Function and Rhino.Mocks.Action delegates are there to simply allow for compatibility w/ .Net 2.0, which didn't have the Func and Action delegates in the framework. They both accomplish the same thing.

    https://github.com/ayende/rhino-mocks/blob/master/Rhino.Mocks/Delegates.cs