When can i test?

My SO and I always use condoms except for this one day. I been on birth control pills for 5 years but the past 6 months I have not been taking them regularly. My periods are not consistent. When can I take a test after said unprotected sex date?