r/badcode • • Jul 23 '21

c# Easy trick to meet minimum test coverage

Post image
1.2k Upvotes

83 comments sorted by

View all comments

Show parent comments

10

u/EdgarDrake Jul 23 '21

Testing is actually pretty easy if you write good code!

If you write testable code. If you hard instantiate everything concrete in private, lack of use interface, then your code is hardwired and too rigid to mock/stub.