nunit/nunit — pull request #349 by CharliePoole (2014-11-09 19:16:16+00:00)
Title: Issue 238

**Not Complete Yet**

I'm creating this PR so we can discuss how the part of the engine related to choosing a runner works and so that @rprouse can take over issue #238.

What's done so far:

* Added a -x86 option to the command line to force running the tests in x86 mode even if NUnit would not normally detect the necessity. This is a fallback for whatever else we do. Since we don't examine all references in a test assembly - and have know way of finding out about dynamic loading - there can always be situations where the user simply has to tell us to run in x86 mode.

* Set up the app.config file so that nunit-console will run under .NET 4.0 by preference.

* Made --process:Separate the default for a single assembly, --process:Multiple for more than one.

* As a result of the preceeding, removed all calls to the RuntimeFrameworkSelector service from the DefaultTestRunnerFactory service. Now only the ProcessRunner needs to pre-read the assembly to determine what runtime it was built for. This may result in RuntimeFrameworkSelector no longer needing to be a service, but we can wait till the dust settles for that decision.

* Discovered and fixed a problem in AggregatingTestRunner, which was not terminating correctly. Implemented the Dispose pattern for runners while doing this.

Next Steps:

* DirectTestRunner should probably get the Dispose pattern as well. I didn't get that deep. It would be great if you reviewed my code in the other runners, particularly the interaction between dispose and unload. It should be possible to unload without disposing.

* I think the loop in ProcessRunner.LoadPackage() where AssemblyReader is used on each assembly can be eliminated. We should simply set the RunAsX86 setting value to true in the TestPackage in the RuntimeFrameworkSelector service when it is needed. Then we can eliminate passing a boolean down the long chain of methods that end up launching the agent process.

Hopefully, that will cover everything on the issue.