views:

95

answers:

3

I am currently using NUnit and testing a class library. Up until now, I have used a list of constants at the top of the test class to hold some static test variables. Is this the best way to do this, or is there a more fluent way to handle it?

+3  A: 

By "static test variables" do you actually mean constants (whether genuine constant, immutable instances or just ones you don't change)? I use those frequently, and just put them at the top of the test class.

If there are several related test classes, it can be handy to separate out common values into a different class though. (It could act as your base class, but I'm not terribly fond of using inheritance just to get access to things more easily. Java static imports are handy there...)

Jon Skeet
Yes, I meant constants. I'm always looking for a better way to do things, and was just wondering if this was the best method to use. Sounds like it is. Thanks for your input. BTW - I was just listening to your DNR interview - good stuff!
Mark Struzinski
+1  A: 

Whenever I can, I store data externally in an xml file that we check into source control.

A: 

Is there a way to store static in a sealed contaner

Parker