Just a quick note on using NUnit for testing classes working with ArcGIS Server. I had setup my testfixture so that it would get a server context in the <SetUp()> sub, and release it in the <TextFixtureTearDown()> sub. This is generally good form – get an expensive resource one, and use it for all the tests…
<SetUp()> _Public Sub Init()
‘Set up the connection to the GIS Server
_SC = ServerUtil.GetMapServerContext(_AGSHostName, _AGSContextName)
End Sub
<TestFixtureTearDown()> _
Public Sub TearDown()
_SC.ReleaseContext()
End Sub
And this works fine if you only run one test at a time, or if you only have one test in your test harness class. However, if you want to run a bunch of tests, you need to release the context at the end of each test, and thus also create it at the beginning. Simple enough, but somewhat confusing to see that you suddenly have 4 instances running when you only thought you had one.