Using WatiN and SharpDevelop’s NUnit test runner.

As of SharpDevelop 2.1 Beta 3, running test in STA mode is supported. By default SharpDevelop runs tests in the MTA. This is the default behaviour of NUnit which is what SharpDevelop uses. To run your tests in an STA you can create an app.config file for your test project as shown below:

  <sectionGroup name="NUnit">
   <section name="TestRunner" type="System.Configuration.NameValueSectionHandler" />
  <!-- Valid values are STA,MTA. Others ignored. -->
  <add key="ApartmentState" value="STA" />