Keeping interfaces just used for mocking in the same file as the implementation

When creating an interface purely for the ability to mock I do like to keep both the class and interface in the SAME FILE just like Ben Foster below.

Not one for the purists perhaps but it’s so practical as they will often change together. Do anyone else do this?

Note …. I create interfaces for testing only very selectively though and try to avoid mocking where possible in favour of testing the actual components which a production instance will need.

Leave a Reply

Your email address will not be published. Required fields are marked *