<commit_before>﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AcadTestRunner
{
  public static class TestRunner
  {
    private const string AcadRootDir = "AcadRootDir";
    private static string coreConsolePath;

    public static void Init(string coreConsolePath)
    {
      if (!File.Exists(coreConsolePath))
      {
        throw new FileNotFoundException("Path " + coreConsolePath + " not found");
      }

      TestRunner.coreConsolePath = coreConsolePath;
    }

    public static TestResult Test(string commandMethod, string acadTestAssemblyPath)
    {
      #region Parameter checks

      if (string.IsNullOrEmpty(coreConsolePath))
      {
        var assemblyPath = typeof(TestRunner).Assembly.Location;
        var configuration = ConfigurationManager.OpenExeConfiguration(assemblyPath);

        if (configuration.AppSettings.Settings.AllKeys.Any(key => key == AcadRootDir))
        {
          var fileName = Path.Combine(configuration.AppSettings.Settings[AcadRootDir].Value, "AcCoreConsole.exe");

          if (Directory.Exists(fileName))
          {
            coreConsolePath = fileName;
          }
          else
          {
            throw new FileNotFoundException("Path " + coreConsolePath + " not found");
          }
        }
        else
        {
          throw new FileNotFoundException("AppSetting 'AcadRootDir' not found");
        }
      }
      else if (!File.Exists(acadTestAssemblyPath))
      {
        throw new FileNotFoundException("Path " + acadTestAssemblyPath + " not found");
      }

      #endregion

      // TODO: Add test runner code here
<commit_msg>TestRunner error fixed<commit_after>﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AcadTestRunner
{
  public static class TestRunner
  {
    private const string AcadRootDir = "AcadRootDir";
    private static string coreConsolePath;

    public static void Init(string coreConsolePath)
    {
      if (!File.Exists(coreConsolePath))
      {
        throw new FileNotFoundException("Path " + coreConsolePath + " not found");
      }

      TestRunner.coreConsolePath = coreConsolePath;
    }

    public static TestResult Test(string commandMethod, string acadTestAssemblyPath)
    {
      #region Parameter checks

      if (string.IsNullOrEmpty(coreConsolePath))
      {
        var assemblyPath = typeof(TestRunner).Assembly.Location;
        var configuration = ConfigurationManager.OpenExeConfiguration(assemblyPath);

        if (configuration.AppSettings.Settings.AllKeys.Any(key => key == AcadRootDir))
        {
          var fileName = Path.Combine(configuration.AppSettings.Settings[AcadRootDir].Value, "AcCoreConsole.exe");

          if (File.Exists(fileName))
          {
            coreConsolePath = fileName;
          }
          else
          {
            throw new FileNotFoundException("Path " + coreConsolePath + " not found");
          }
        }
        else
        {
          throw new FileNotFoundException("AppSetting 'AcadRootDir' not found");
        }
      }
      else if (!File.Exists(acadTestAssemblyPath))
      {
        throw new FileNotFoundException("Path " + acadTestAssemblyPath + " not found");
      }

      #endregion

      // TODO: Add test runner code here

{'fraction_non_alphanumeric': 0.08703170028818444, 'fraction_numerical': 0.0, 'mean_word_length': 2.6498422712933754, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '2984488', 'n_tokens_mistral': 906, 'n_tokens_neox': 895, 'n_words': 210}