title: How do microsoft fakes' shims actually work internally?
body: <p>So I am interested in the way that it is implemented.
  Basically: How can I re-implement the same thing myself?
  ... which I am not intending to do. Just understand.</p>
  
  <p>The fundamental question is:
  How is it possible to (?) intercept class instantiation at all?
  And how can it be replaced in one case with one implementation and in another occurence with it's original or an even different implementation?</p>
  
  <p>How is it even possible to intercept static methods or sealed classes.</p>
  
  <p>This is all about shims/moles not so much about stubs.</p>