You should have asked before buying...
There are 'modern' parts and 'not modern' parts. The modern parts have thin metal tabs that are expected to be soldered to a PCB heatsink. What you want is a 7812 with a thick metal tab to make good contact with the heat sink. Don't forget to order some heatsink compound...
To test the voltage regulator offline you just need a 16V (or so) power supply. Do you have a bench power supply?
If not, you can use a couple of 9V batteries. Connect the + (positive) lead to pin 1 of the voltage regulator and the - (negative) lead to pin 2 of the voltage regulator. Measure the DC output voltage using your multimeter. It should now be +12V.
This tests the voltage regulator off load - but it does indicate that it is basically working.
If you have a bench power supply - and a 12V lamp - you could apply a bit of load to see if everything is still good. Obviously, you will need some form of external heat sink if you start to push the current flowing through the voltage regulator. Don't exceed the rated current of 1A though. 12V at 1A = 12W lamp maximum (give or take). If you try to exceed the current rating of the voltage regulator, or it gets too warm, it should shut down.
These vintage linear voltage regulators are fairly good at protecting themselves, but (like everything) they get old...
Dave