Similar question on Stack Overflow
http://stackoverflow.com/questions/981889/connection-speed-test-in-silverlight[
^]
It depends how much functionality you want, but the concepts are going to be the same.
Download speed
Start a request to download some dummy payload data. Time how long it takes
Upsteam test
Start a request to send some dummy payload data to your server. Time how long it takes
Have a look at
http://www.speedtest.net/[
^] for functionality ideas