Skip to main content

All Questions

88 votes
11 answers
19k views

Is it a bad practice to modify code strictly for testing purposes

I have a debate with a programmer colleague about whether it is a good or bad practice to modify a working piece of code only to make it testable (via unit tests for example). My opinion is that it ...
liortal's user avatar
  • 1,185
-2 votes
2 answers
3k views

Best practices around writing testable extension methods

I’m currently working in C# and I’d like to write and extension method against a type. There is a small amount of repeated logic between classes surrounding JSON deserialization, using the ...
RTT's user avatar
  • 1
1 vote
1 answer
277 views

NUnit specify TestCaseAttribute on implementation or create a test method

Based on this question about the correct usage of nUnit's TestCaseAttribute, I was wondering whether to specify the test case directly on the implementation or create test methods (as when using ...
user avatar
3 votes
3 answers
636 views

Is it considered a bad coding practice to write methods/properties that support (only) testing? [duplicate]

When I write (unit) tests I always try to avoid for example microsoft fakes because then the edit&continue feature no longer works. However this often requires refactoring... and sometimes methods ...
t3chb0t's user avatar
  • 2,602