testing for pregnancy

If I have sex on my period, can I test for pregnancy two weeks later (which would be two weeks BEFORE my next period) or would that be unreliable?