Is there a way or approach like a method decorator or attribute for a test method that can say for example:
“Run Method C Before running Method B”
So basically you are creating a dependancy between C and B. I know tests are better off being atomic and should be but sometimes in it’s better to keep your tests small and to the point. It makes sense not run a ‘RemoveItem’ test method when the item it is looking for is simply not there.
Most people would add the item before hand and then test to see if they can remove – ‘All In the same test‘. I don’t like this approach and want to make my tests smaller, more to to point and more atomic as possible.
Like you said, you dont want interdependencies between your test. If you are not comfortable having an “Add” before the “Remove” in your remove test, thus testing the Add method in the wrong place, then I recommend using testInitialize to setup some objects the tests can act on. I do however recommend the practice of actually running Add before you run Remove, in the test of Remove.