Assembly Initialize and CleanUp in Test Projects
If you are using remoting and want to run some tests you may have to configure the remoting framework using the
RemotingConfiguration's Configure function. This function should only be called once so the perfect place to make this call is in a function marked with the
[AssemblyInitialize] attribute.
Clean up or tear down code would be placed in the method marked with the
[AssemblyCleanup] attribute.
I like to put assembly initialization and clean up code into a separate test file and call it something obvious like indicated below:
Only one method in an assembly can be marked with the AssemblyInitialize and AssemblyCleanup attribute respectively.
Note: The underscore in the class name is simply a personal preference so that the class ends up at the top when viewing the Test Project in the VS.NET solution explorer.