goncalopereira/statsd-csharp-client — pull request #19 by elijahandrews (2013-06-25 22:24:26+00:00)
Title: Add ability to test Metrics

I noticed that there aren't currently any tests for calls via the static `Metrics` class, so I wrote a way to test them.

When I initially went to write tests I thought it would be as simple as mocking out StatsUDP. However, I quickly found out that [Rhino Mocks doesn't support mocking static methods and variables](http://stackoverflow.com/questions/540239/mocking-static-methods-using-rhino-mocks). One solution could have been to create a proxy class that wraps Metrics methods into instance methods, but I wasn't thrilled with this solution. Instead, I figured it would be better to just write some full blown integration tests.

You may have to change the test App.config to set `StatsdServerName` to `127.0.0.1` in order for this to work. Also, if you run it on port `8125` make sure that you don't have another statsd running server running on the machine.

Please let me know if you can think of a better way to do this :)

Right now there are minimal tests, but I'll probably expand them out in the next few days. If you want this PR I can add tests that are not Datadog-specific to your repo too.