The first thing to try is a new SIM card. You don't have to buy one to test the SIM slot. For the slot test, just use an inactive or cheap prepaid SIM card and that will test it just fine, if all you want to test is how functional the slot is in reading a SIM card. If you want to test if it makes calls and connects to a cell tower, you need an active SIM. Borrow one or get one from the carrier to test if it gets an actual signal.
You could clean the SIM contacts, but SIM cards are cheap enough that I wouldn't bother. Most carriers give them away to postpaid customers. If they charge, it's very often no more then $15 at the extreme. Sometimes cleaning it helps, but only do that if it's small. If it's major, get a new SIM card.
If the SIM doesn't work, it's going to be the SIM contacts in the phone. You'll need to know how to solder at the component level to replace it, because of how it's mounted. If you can't, then use it as an iPod on WiFi.