Using the VS2008 unit testing framework, if you want to check for an expected exception, sometimes your test will pass because the exception was raised by another line of code - after the line you were specifically trying to test.
To resolve this you have to manually check for the expected exception - using a try-catch block.
However there is a catch (excuse the pun)....
Microsoft.VisualStudio.TestTools.UnitTesting.Assert.IsInstanceOfType() will not fail when types are different as long as the actual value is of a type within the inheritance hierarchy of the expected type.
Eg the following assertion will not fail if ex is of type ArgumentNullException - as it inherts from ArgumentException.
Assert.IsInstanceOfType(ex, typeof(ArgumentException));
One solution is to create your own assertion method eg: