How soon to take test ?

How soon after unprotected sex can u take a pregnancy test?