One thing I noticed while testing a WCF service endpoint via NUnit (v 2.2.8) is that if you mark a test with the ExpectedException attribute like this:
[Test]
[ExpectedException(typeof(FaultException))]
public void MyFancyWCFTest()
{
//some high-powered testing code here which is expecting an exception; e.g. testing incoming message validation
}
the NUnit framework will call this a failure because the FaultException uses a generic type, e.g. ExceptionDetail...
[Test]
[ExpectedException(typeof(FaultException<ExceptionDetail>))]
public void MyFancyWCFTest()
{
//some high-powered testing code here which is expecting an exception; e.g. testing incoming message validation
}
Hopefully this simple post will save someone time and/or a headache :)
cheers
jk
Edit: 6/17/2007 -- And as Jason correctly pointed out, you need to have includeExceptionDetailInFaults=True for this to work. I was in development during this post and had not considered this point.