Update: the version that works with .net 4.0 is here (link to InjecttionExample3.zip in that page). the examples from the link below work in .net 3.5 and under.
While I was doing my TDD course at Soluto this week, One of the architects, Shai, Found an interesting article on CodeProject that shows how to change the pointer of a managed method in C# to redirect to a different method.
They even tried it and showed it can work to allow changing the behavior of a static method by intercepting it. This does not use the profiler API at all (like typemock or Justmock do), but it is a non-safe (unsafe) way to do it in a managed way.
This needs more examination, but if this works out, it could be the beginning of a new era of unconstrained Isolation frameworks in .NET, that are fully open source. It’s not just static methods that can be replaced, and that’s where it gets REALLY interesting.
Let’s keep our fingers crossed, and I expect the devs of Moq, FakeItEasy and NSubstitue to work on that. If they don’t , I certainly will!