Unprotected sex

How long after having unprotected sex should you take a pregnancy test??!!