I want to test the following code:
private bool TestException(Exception ex)
{
    if ((Marshal.GetHRForException(ex) & 0xFFFF) == 0x4005)
    {
        return true;
    }
    return false;
}
I'd like to set up the Exception object somehow to return the correct HResult, but I can't see a field in the Exception class which allows this.
How would I do this?