Move Xml Result output to the engine as a service

**For Discussion**

All classes related to creating of result files have been moved from the console runner to the engine, so that the features are available to other runners as well.

ResultWriters will be one of the types of addins we support, so the code is set up with that in mind even though we are still creating all the writer classes internally.

Let's look at and discuss the interfaces in particular. Remember that the engine.api assembly is intended to be non-versioned, so we want to leave as much runtime flexibility in the interfaces as we can.
Exactly. In the Mono.Addins tree, we would likely have something like
/TestEngine/Services/ResultService/ResultWriters where various writers
would be attached. Once we have that, we will need to decide how much of it
to expose to users and how much to keep under wraps. I figured we would
need a list of valid formats at a minimum so I included that. In the final
release we might end up exposing more.

Charlie

On Wed, Dec 3, 2014 at 1:17 PM, Rob Prouse <notifications@github.com> wrote:

> In src/NUnitEngine/nunit.engine/Services/ResultService.cs:
>
> > +        }
> > +
> > +        /// <summary>
> > +        /// Gets a ResultWriter for a given format and set of arguments.
> > +        /// </summary>
> > +        /// <param name="format">The name of the format to be used</param>
> > +        /// <param name="args">A set of arguments to be used in constructing the writer or null if non arguments are needed</param>
> > +        /// <returns>An IResultWriter</returns>
> > +        public IResultWriter GetResultWriter(string format, object[] args)
> > +        {
> > +            // NOTE: When we switch to having ResultWriters as addins, this
> > +            // construction will have to be done by reflection, so we keep
> > +            // the method signature as general as possible, even though
> > +            // we currently make assumptions about what is being passed.
> > +            // TODO: Handle invalid arguments.
> > +            switch (format)
>
> This is the sort of place some sort of dependency injection would come in
> handy. Hopefully Mono.Addins or whatever we settle on will do that for us.
> It would be nice to get a list of everything that implements IResultWriter
> and have them return the string key that they answer to. Obviously not for
> this iteration, but something to think about later [image: :smile:]
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/nunit/nunit/pull/385/files#r21265694>.
>