Implement color console for NUnitLite

This fixes #222

I couldn't use the code from nunit-console, because NUnitLite does all it's writing to a TextWriter that is passed in to it,  which may or may not be NUnitConsole. In order to make it work, I split off the write statements inside of ColorConsole and made a new class ExtendedTextWriter, which passes output on to another writer and implements the extended color stuff.

Other changes:
* WriteLabel takes an object as value and does the ToString() itself.
* Color is always disabled unless we know for sure we are writing to the console.
* The command line option to turn off color is not implemented, I'll push another commit with that.

In that case, since a simple ToString() is now being done in the WriteLabel
method, I may remove it the next time I'm in there. Doing it twice probably
takes almost no time, but it's confusing to anyone reading it.

On Mon, Sep 29, 2014 at 7:17 PM, Rob Prouse <notifications@github.com>
wrote:

> In src/NUnitFramework/framework/Runner/ResultReporter.cs:
>
> > -                summary.NotRunCount, summary.InvalidCount, summary.IgnoreCount, summary.SkipCount);
> > -            writer.WriteLine("     Start time: {0}", result.StartTime.ToString("u"));
> > -            writer.WriteLine("       End time: {0}", result.EndTime.ToString("u"));
> > -            writer.WriteLine("       Duration: {0} seconds", result.Duration.TotalSeconds.ToString("0.000"));
> > +            var status = result.ResultState.Status;
> > +            ColorStyle overall = status == TestStatus.Passed
> > +                ? ColorStyle.Pass
> > +                : status == TestStatus.Failed
> > +                    ? ColorStyle.Failure
> > +                    : ColorStyle.Warning;
> > +
> > +            _writer.WriteLine();
> > +            _writer.WriteLine(ColorStyle.SectionHeader, "Test Run Result -");
> > +            _writer.WriteLabelLine("   Overall result: ", result.ResultState, overall);
> > +
> > +            _writer.WriteLabel("   Tests run: ", summary.TestCount.ToString(CultureInfo.CurrentUICulture));
>
> The default is CurrentUICulture. This code just came from habit of
> explicitly stating the culture in all string methods. At my day job, we
> need to be vary careful that strings saved to the database are invariant
> and that strings displayed to the user are current culture. By explicitly
> stating it in the call, it means that you have thought about it and
> selected what is correct rather than accepting the default.
>
> Old habits die hard [image: :smile:]
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/nunit/nunit/pull/248/files#r18196259>.
>