I was trying to use Rhino Mocks with F# code, and the following code was a problematic:
let service = MockRepository.GenerateMock<IMyService>()
service.Stub(s => s.Name).Return("Service");
This was no surprise, since Stub is not part of IMyService interface, it's a C# extension method that Rhino Mocks defines.
Slighltly modified code works:
let service = MockRepository.GenerateMock<IMyService>()
RhinoMocksExtensions.Stub<IMyService, string>(service, fun s -> s.Name).Return("Service");
However, it would be nice to define an extension method in F#, but then it will be a parameterized generic extension method that would take a tuple . I was trying varios syntax but without any luck. I didn't find information whether this is currently supported in F# or not. If anyone knows, please let me know.