Hi, I'd like to Assert that an exception is being thrown and then check some of the properties of the thrown exception.
I was under the impression that I could do something like the following:
ICommand command = CreateCommandObj();
Assert.That( () => command.DoWork(), Throws.TypeOf<ArgumentException>(),
Has.Property("ParamName").EqualTo("myParam") &
Has.Property("Message").EqualTo("myMessage") );
However this doesn't even compile and looking at the expected parameters for Assert.That I can't see how I would be able to do this? I'm sure I have used this before though...
Note the above is a contrived example to illustrate the point, ignore the fact I am looking for an ArgumentException on a method that doesnt except any parameters :)
Any help appreciated.
1) Cannot convert lambda expression to type 'object' because it is not a delegate type.