title: Design considerations when including unit testing in a .Net application?
body: <p>All methods in .Net are considered final by default unless the virtual modifier is used. Java is the other way around. All methods are virtual and can be overridden. When it comes to unit testing with frameworks such as Moq, RhinoMock etc we can either create a mock or a stub. If we are to create a mock we need an interface. This forces us to use interfaces everywhere if it is not necessary just to be able to test our code.</p>
  
  <p>On the other hand we can create stubs but then the methods that we are stubbing out need to be virtual so that the framework can override them. </p>
  
  <p>There are other mocking frameworks out there that use AOP, such as TypeMock, but I am not sure I can motiviate spending money on a framework like that when there are such good open source and free ones.</p>
  
  <p>I know that non-virtual and interface methods are both slightly slower. But this shouldn't really impact an application on today's hardware. </p>
  
  <p>So my question is: Should almost everything be an interface, even if it is not really encapsulating some sort of behavior? Or should we make methods virtual as needed to aid our testing. Both feel a little hacky and unnecessary to me.</p>
  
  <p>What are you thoughts?</p>