0

I recently got introduced to unit testing and I have been doing some exercises. My question is regarding this image:

Picture in question

Should I write two individual tests to check if both the exceptions are being thrown or is it ok to bundle them in one test? What is the right way?

vassdeniss
  • 79
  • 1
  • 8
  • @JesseGood From what I understand then I should write then individually so that my unit tests assert only one specific thing. Is that right? – vassdeniss Mar 22 '22 at 20:26
  • 1
    Yes, that is the general guidance. It's even written in [Microsoft's documentation](https://learn.microsoft.com/en-us/dotnet/core/testing/unit-testing-best-practices#avoid-multiple-acts). (I recommend reading the whole page). – Jesse Good Mar 22 '22 at 20:36
  • I will do that now, thank you for pointing me in the right direction. – vassdeniss Mar 22 '22 at 20:37

0 Answers0