When I'm testing my simple geometric library, I usually have one or two methods in every test class. All I check is whether objects do proper coordinates calculation or not. Is it okay (meaning the number of methods)?
Don't get hung up on the number of methods. Just think about the ways in which your code could fail and add tests, preferably as separate methods, as you think of them.
The reason for separate methods is mostly to allow each test to be focused on just one aspect of your code and therefore keeping the test code short and simple to understand.
It's also acceptable to have a test method perform a number of Assertions, but once again these assertions should be checking a similar aspect of your code.
In some cases test code may need to be more complex eg: longer methods with calls to helper methods, but in general it is often possible to avoid this.
A good practical book that I've read on unit testing is Pragmatic Unit Testing in C# with nUnit. It provides handy guidance on many questions such as this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With