NServiceBus/NServiceBus — pull request #1033 by thirkcircus (2013-02-28 20:49:51+00:00)
Title: Refactor endpoint type determination

Hi, this PR probably looks a lot bigger than it actually is.

couple of really minor changes - adding ncrunch to gitignore, adding R# settings for test proj.
the rest of the PR...

## Why:
I refactored the logic for determining the type of the Endpoint because in my application code I wanted the ability to get the name of the endpoint so I can specify the process name (ie endpoint name) in logs.
Initially I wanted to just borrow the NSB assemblyscanning logic but as this was private static methods I decided to make this public.
Now in an external application you can get the name of the endpoint using public non-static NSB types, like so:
```cs
var endpointTypeDeterminer = new EndpointTypeDeterminer(AssemblyScanner.GetScannableAssemblies(), () => null);
var endpointConfigurationType = endpointTypeDeterminer.GetEndpointConfigurationType();
string applicationName = endpointConfigurationType.EndpointName;
```

## Changes:
I thought I'd clean up the logic for determining the type of the endpoint - by making this (EndpointTypeDeterminer) a public class it's now testable (so I wrote a bunch of tests) and it made sense to also encapsulate and test EndpointType and its associated getters.
Now the host program only deals with Topshelf concerns - and the Endpoint type stuff is encapsulated in separate classes which can be and are tested.
So basically a whole lot of stuff has just been moved (and tests added) - out of Program and into SRP classes.

## Testing:
Unit tests cover almost every part (except use of INameThisEndpoint as it's obsolete and so causes compilation to fail) and hopefully also document the intended logic (ie priority of determining the endpoint name).
I've also manually tested the actual host with the relevant hostargs, config settings, attributes and fallback to assembly scanning. It all seems to work as before.