<commit_before>﻿using rosette_api;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.IO.Compression;
using System.Net;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using System.Web;
using System.Web.Script.Serialization;

namespace rosette_apiUnitTests
{
    /// <summary>Mock Data Handler
    /// <para>Provides support for getting data from the request/response directories of the mockdata folder</para>
    /// </summary>
    class CMockData
    {
        private static string mockDir = null;
        public static string requestDir = null;
        public static string responseDir = null;
        public CMockData()
        {
            string baseDirectory = Directory.GetCurrentDirectory();
            baseDirectory = baseDirectory.Remove(baseDirectory.IndexOf("ws1") + 4);
            mockDir = baseDirectory + "mock-data";
            if (!Directory.Exists(mockDir))
            {
                mockDir = "\\..\\..\\mock-data";
            }

            requestDir = mockDir + "\\request\\";
            responseDir = mockDir + "\\response\\";
            RequestDir = requestDir;
            ResponseDir = responseDir;
        }

        public string RequestDir { get; set; }
        public string ResponseDir { get; set; }

        /// <summary>getAllRequests
        /// <para>Gets all the Request file names</para><commit_msg>updated unit tests to find the correct path to mock-data<commit_after>﻿using rosette_api;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.IO.Compression;
using System.Net;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using System.Web;
using System.Web.Script.Serialization;

namespace rosette_apiUnitTests
{
    /// <summary>Mock Data Handler
    /// <para>Provides support for getting data from the request/response directories of the mockdata folder</para>
    /// </summary>
    class CMockData
    {
        private static string mockDir = null;
        public static string requestDir = null;
        public static string responseDir = null;
        public CMockData()
        {
            string baseDirectory = Directory.GetCurrentDirectory();
            int retry = 0;
            while (!Directory.Exists(mockDir) && retry < 10)
            {
                baseDirectory = Directory.GetParent(baseDirectory).FullName;
                mockDir = baseDirectory + "\\mock-data";
                retry = retry + 1;
            }
                       
            if (!Directory.Exists(mockDir))
            {
                mockDir = "\\..\\..\\..\\mock-data";
            }

            requestDir = mockDir + "\\request\\";
            responseDir = mockDir + "\\response\\";
            RequestDir = requestDir;
            ResponseDir = responseDir;
        }

        public string RequestDir { get; set; }
        public string ResponseDir { get; set; }

        /// <summary>getAllRequests
        /// <para>Gets all the Request file names</para>
{'fraction_non_alphanumeric': 0.10401744004982871, 'fraction_numerical': 0.0018685767673621925, 'mean_word_length': 2.1960199004975123, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 17, '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': '5994973', 'n_tokens_mistral': 847, 'n_tokens_neox': 824, 'n_words': 229}