If you find yourself writing lots of tests for a single method on your tested class - consider making a specific fixture for just one method or feature. It would make the class more maintainable and logically sound.
For example, a complex Login class might have one "IsLoginOK" method that has dozens of unit test for various logical angles and features.
You might have a fixture that looks like this:
public class LoginManagerTests_IsLoginOK
public void ReturnsFalseOnNonExistingUser()
- The class name suggests the main feature or function being tested by postfixing it to the name
- The is no need to prefix methods in the class with the method name since it is clearly the only method being tests. Each test case is a variation of feature of this method.
- You might end up with multiple class test fixtures for one tested class. That's OK, just remember to put them under a specific folder in your test project with the name of the tested class like this
- You would probably end up with a class that tests various "small" features which were left over from other fixtures. name it to [TestedClass_General] or [TestedClass_Misc] so that it's testing purpose is understood.