<commit_before>﻿// Copyright 2016, 2015, 2014 <NAME>
// 
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// 
// http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using TestFx.Console.HtmlReport;
using TestFx.Console.TeamCity;
using TestFx.Evaluation;
using TestFx.Evaluation.Reporting;
using TestFx.Evaluation.Utilities;

namespace TestFx.Console
{
  public partial class Program
  {
    private static void Main (string[] args)
    {
      InitializeOptions(args);

      if (Debug)
        Debugger.Launch();

      var assemblies = AssemblyPaths.Select(Assembly.LoadFrom);
      var appDomain = AppDomain.CreateDomain("External");
      var listeners = CreateListener(appDomain).ToArray();
      var result = Evaluator.Run(assemblies, listeners);
      AppDomain.Unload(appDomain);

      if (Pause)
      {
        System.Console.WriteLine("Press any key to terminate...");
        System.Console.ReadKey(intercept: true);
      }

      var exitCode = -1 * (int) result.State;
      Environment.Exit(exitCode);
    }

    private static IEnumerable<IRunListener> CreateListener (AppDomain domain)
    {
      if (!string.IsNullOrWhiteSpace(HtmlReport))
        yield return domain.CreateProxy<IRunListener>(typeof(HtmlReportRunListener), HtmlReport, Output);

      if (TeamCity)
        yield return new TeamCityRunListener(new TeamCityServiceMessageWriter(System.Console.WriteLine));
    }
  }
}<commit_msg>Fixed creation of HtmlReportRunListener. Addresses #7.<commit_after>﻿// Copyright 2016, 2015, 2014 <NAME>
// 
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// 
// http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using TestFx.Console.HtmlReport;
using TestFx.Console.TeamCity;
using TestFx.Evaluation;
using TestFx.Evaluation.Reporting;
using TestFx.Evaluation.Utilities;
using TestFx.Utilities.Reflection;

namespace TestFx.Console
{
  public partial class Program
  {
    private static void Main (string[] args)
    {
      InitializeOptions(args);

      if (Debug)
        Debugger.Launch();

      var assemblies = AssemblyPaths.Select(Assembly.LoadFrom);
      var appDomain = CreateAppDomain();
      var listeners = CreateListener(appDomain).ToArray();
      var result = Evaluator.Run(assemblies, listeners);
      AppDomain.Unload(appDomain);

      if (Pause)
      {
        System.Console.WriteLine("Press any key to terminate...");
        System.Console.ReadKey(intercept: true);
      }

      var exitCode = -1 * (int) result.State;
      Environment.Exit(exitCode);
    }

    private static AppDomain CreateAppDomain ()
    {
      var binPath1 = Path.GetDirectoryName(typeof(Program).Assembly.Location);
      var binPath2 = Path.GetDirectoryName(typeof(IRunListener).Assembly.Location);
      return AppDomain.CreateDomain("External", AppDomain.CurrentDomain.Evidence, new AppDomainSetup { ApplicationBase = binPath1, PrivateBinPath = binPath2 });
    }

    private static IEnumerable<IRunListener> CreateListener (AppDomain domain)
    {
      if (!string.IsNullOrWhiteSpace(HtmlReport))
        yield return domain.CreateProxy<Factory>(typeof(Factory)).Create<IRunListener>(typeof(HtmlReportRunListener), HtmlReport, Output);
      //  yield return domain.CreateProxy<IRunListener>(typeof(HtmlReportRunListener), HtmlReport, Output);
      //  yield return new HtmlReportRunListener(HtmlReport, Output);

      if (TeamCity)
        yield return new TeamCityRunListener(new TeamCityServiceMessageWriter(System.Console.WriteLine));
    }
  }
}
{'fraction_non_alphanumeric': 0.09818731117824774, 'fraction_numerical': 0.008416055243849805, 'mean_word_length': 3.7103658536585367, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5190960', 'n_tokens_mistral': 1284, 'n_tokens_neox': 1241, 'n_words': 376}