mikehadlow/EasyNetQ — pull request #73 by gshutler (2013-03-04 11:00:08+00:00)
Title: Introduced Preconditions class

I've been referring to the source of EasyNetQ a lot whilst working on a custom RabbitMQ client (there's some special cases I need to cover and I need it to compile to .NET 3.5) so I thought I'd try and give at least a little back.

I noticed a general pattern, that I also use, of checking method parameters for null to fail-fast with a more meaningful message. However, I usually use a `Preconditions` class along the lines of the one I've introduced here. I implemented it to throw the same kind of exception with the same message as existed before so it should be non-breaking (the tests still pass) but hopefully it's added some clarity to the methods utilising it.

To pull a single example out:

```csharp
public static void FuturePublish(this IPublishChannel publishChannel, DateTime timeToRespond, T message)
{
// Before (4 lines)
if (message == null)
{
throw new ArgumentNullException("message");
}

// After (1 line)
Preconditions.CheckNotNull(message, "message");

var advancedBus = publishChannel.Bus.Advanced;
// etc
```