Question
Is there a way to have a method that will always run anytime the test build starts through MSTest?
Similar to how the [TestInitialize] and [ClassInitialize] attributes work, but for the entire assembly. I do not want to add code to every method of the [ClassInitialize] class.
Reasoning
Some of my tests interact with the database. They delete data and other things that will be very harmful to the production database. There is only a configuration file that tells my unit test project to work with a non-production database.
I would be better off if there was a method that started at startup that would say: "Database window is not" Production "
Ideas
Log4Net uses the assembly attribute to configure.
using log4net.Config; [assembly: XmlConfigurator()]
Maybe I can do something simliar?
[assembly: CheckDatabaseNameNot("production")]
mstest
quip
source share