<commit_before>using System.Collections;
using System.Collections.Generic;
using System.IO;
using MasterDetails = FileHelpers.MasterDetail.MasterDetails<object, object>;

namespace FileHelpers.Tests
{
    /// <summary>
    /// This class only adds the relative path to the sample files. 
    /// </summary>
    public static class TestCommon
    {
        /// <summary>
        /// Create a path to a directory or file given a list of directories
        /// to get there.  Goes from project directory
        /// </summary>
        /// <remarks>.. takes it back from bin, Data is forward to data area</remarks>
        /// <param name="pathElements">list of directories to navigate with optional filename</param>
        /// <returns>Path to Data area</returns>
        public static string GetPath(params string[] pathElements)
        {
            var result = Path.GetFullPath(Path.Combine("..", "Data"));

            foreach (var element in pathElements)
                result = Path.Combine(result, element);

            return result;
        }

        /// <summary>
        /// Create a temporary filename for work
        /// </summary>
        /// <param name="fileName">Filename for test</param>
        /// <returns>Path to a working file</returns>
        public static string GetTempFile(string fileName)
        {
            return Path.Combine(Path.GetTempPath(), fileName);
        }

        /// <summary>
        /// Use an engine to read an array of objects
        /// </summary>
        /// <param name="engine">Engine to read file</param>
        /// <param name="pathElements">List of directories and a filename in Data area</param>
        /// <returns>objects from file</returns>
        public static T[] ReadTest<T>(FileHelperEngine<T> engine, params string[] pathElements) where T : class
        {
            return engine.ReadFile(GetPath(pathElements));
        }<commit_msg>Changed base directory for NUnit3<commit_after>using System.Collections;
using System.Collections.Generic;
using System.IO;
using NUnit.Framework;
using MasterDetails = FileHelpers.MasterDetail.MasterDetails<object, object>;

namespace FileHelpers.Tests
{
    /// <summary>
    /// This class only adds the relative path to the sample files. 
    /// </summary>
    public static class TestCommon
    {
        /// <summary>
        /// Create a path to a directory or file given a list of directories
        /// to get there.  Goes from project directory
        /// </summary>
        /// <remarks>.. takes it back from bin, Data is forward to data area</remarks>
        /// <param name="pathElements">list of directories to navigate with optional filename</param>
        /// <returns>Path to Data area</returns>
        public static string GetPath(params string[] pathElements)
        {
            var dataDirectory = Path.Combine(TestContext.CurrentContext.TestDirectory, "..", "Data");

            foreach (var element in pathElements)
                dataDirectory = Path.Combine(dataDirectory, element);

            return dataDirectory;
        }

        /// <summary>
        /// Create a temporary filename for work
        /// </summary>
        /// <param name="fileName">Filename for test</param>
        /// <returns>Path to a working file</returns>
        public static string GetTempFile(string fileName)
        {
            return Path.Combine(Path.GetTempPath(), fileName);
        }

        /// <summary>
        /// Use an engine to read an array of objects
        /// </summary>
        /// <param name="engine">Engine to read file</param>
        /// <param name="pathElements">List of directories and a filename in Data area</param>
        /// <returns>objects from file</returns>
        public static T[] ReadTest<T>(FileHelperEngine<T> engine, params string[] pathElements) where T : class
        {
            return engine.ReadFile(GetPath(pathElements));
        }
{'fraction_non_alphanumeric': 0.11368850369615091, 'fraction_numerical': 0.0002549069589599796, 'mean_word_length': 2.2006525285481238, 'pattern_counts': {'":': 0, '<': 57, '<?xml version=': 0, '>': 57, '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': '2115354', 'n_tokens_mistral': 968, 'n_tokens_neox': 960, 'n_words': 332}