7 votes
Accepted

Is it worth unit testing hardcoded values?

Worth is subjective "Is it worth it" is generally not objectively answerable when talking about realistic testing expectations. Generally speaking, we don't get as much time to write tests ...
Flater's user avatar
  • 45.7k
4 votes

Should Acceptance Criteria be mapped to unit tests?

I feel that part of this is common, BDD/Gherkin/Cucumber style testing where you write tests as acceptance tests and have them print out whether they work or not in that human readable format. Adding ...
Ewan's user avatar
  • 71k
4 votes

How do I mock API responses with security in mind?

Rather than sprinkle such conditionals throughout your program, refactor the code so that all communication goes through a single, minimal communications specialist. Then replace that specialist with ...
Kilian Foth's user avatar
4 votes
Accepted

Where to put interface files for mocking aka what are best practices for organizing interfaces in a C#/.NET Core project with NSubstitute, Moq etc.?

Decisions like this are usually best guided by the Principle of Least Astonishment: What pattern will other developers recognize and understand quickly? First, C# projects have a very common ...
Stephen Jennings's user avatar
3 votes

Best practices for unit testing when breaking down functions into smaller ones

I'm sure someone will provide you with a more detailed answer, but here are some things to consider: Unit tests are used to verify that the behavior of a function is correct and to prevent regressions ...
sfiss's user avatar
  • 725
3 votes
Accepted

Should Acceptance Criteria be mapped to unit tests?

I've said it before and I'll say it again: the most important thing to consider is a test's audience You're grating at this request precisely because this busy work could force the tests audience to ...
candied_orange's user avatar
3 votes

Should Acceptance Criteria be mapped to unit tests?

People often abuse the term "unit test" for any kind of automated test which is executed by some unit testing tool. So first thing you should do here is make a clear distinction between ...
Doc Brown's user avatar
  • 201k
2 votes
Accepted

Best practices for unit testing when breaking down functions into smaller ones

Don't try make such decisions up-front - it is way easier to decide when growing your unit tests alongside with the development of your functions. You wrote let us act like each line is a long ...
Doc Brown's user avatar
  • 201k
1 vote

Where to put interface files for mocking aka what are best practices for organizing interfaces in a C#/.NET Core project with NSubstitute, Moq etc.?

Your first two disadvantages are odd and suggest to me that your whole approach to coding might be different from 'normal' Disadvantage: Accessing the interface from the class may require tools like ...
Ewan's user avatar
  • 71k

Only top scored, non community-wiki answers of a minimum length are eligible