public static CompareResult CompareFilesTest(CompareTest test,
                                                     string dataDir)
        {
            CompareResult result = new CompareResult();



            _fileIO = FileIOFactory.GetFileIO();

            string str = Directory.GetCurrentDirectory();

            Trace.TraceInformation("Current Directory = " + str, false);

            string actualFileName = GetDeployedString(test.Actual, dataDir);

            string[] files1 = LoadStrings(actualFileName);
            string[] files2 = FileFactory.LoadFileStrings(test.Expected);
            if (files1 != null)
            {
                result.File1Count = files1.Length;
            }
            if (files2 != null)
            {
                result.File2Count = files2.Length;
            }
            if ((files1 != null) &&
                (files2 != null) &&
                (files1.Length == files2.Length))
            {
                result.CountDifferent = false;
                if (CompareStringArrays(files1, files2))
                {
                    result.ContentsDifferent = false;
                }
            }
            str = "#### File1 [" + test.Actual + "] Count=" + result.File1Count.ToString();
            Trace.TraceInformation(str);
            _fileIO.WriteLog(str, false);
            str = "#### File2 [" + test.Expected + "] Count=" + result.File2Count.ToString();
            Trace.TraceInformation(str);
            _fileIO.WriteLog(str, false);
            str = "#### Files Contents Is Different = " + result.ContentsDifferent.ToString();
            Trace.TraceInformation(str);
            _fileIO.WriteLog(str, false);
            return(result);
        }
 public static void LogFailure(bool result,
                               bool expected,
                               string msg)
 {
     if (result != expected)
     {
         _fileIO = FileIOFactory.GetFileIO();
         string str = "##### Failure: Result=" + result.ToString() + " Expected=" + expected.ToString() + " Message=[" + msg + "]";
         _fileIO.WriteLog(str, false);
     }
 }
        static bool CompareStringArrays(string[] array1, string[] array2)
        {
            bool   result = false;
            string str1, str2;

            if (array1.Length == array2.Length)
            {
                int count = array1.Length;
                result = true;
                for (int index = 0; index < count; index++)
                {
                    str1 = array1[index];
                    str2 = array2[index];
                    if ((string.IsNullOrEmpty(str1)) ||
                        (string.IsNullOrEmpty(str2)))
                    {
                        if (str1.Length != str2.Length)
                        {
                            string str = "#### String 1 Lenght of " + str1.Length.ToString() + " does not equal String 2 Lenght of " + str1.Length.ToString();
                            Trace.TraceWarning(str);
                            _fileIO.WriteLog(str, false);
                            result = false;
                            index  = count;
                        }
                    }
                    else if (str1.CompareTo(str2) != 0)
                    {
                        string str = "#### String 1: [" + str1 + "]";
                        Trace.TraceWarning(str);
                        _fileIO.WriteLog(str, false);
                        str = "#### String 2: [" + str2 + "]";
                        Trace.TraceWarning(str);
                        _fileIO.WriteLog(str, false);
                        result = false;
                        index  = count;
                    }
                }
            }
            return(result);
        }
        public bool Exists(string fileName, bool traceException)
        {
            string str = Directory.GetCurrentDirectory();

            _fileIO.WriteLog("Current Directory = " + str, traceException);
            string actualFileName = GetActualFileName(fileName);

            _fileIO.WriteLog("Actual FileName = " + actualFileName, traceException);
            return(_fileIO.Exists(actualFileName, traceException));
        }
        private static string[] LoadStrings(string fileName)
        {
            string[] output;

            _fileIO = FileIOFactory.GetFileIO();

            if (_fileIO.Exists(fileName, false) == false)
            {
                string str = "#### " + fileName + " does not exist";
                Trace.TraceWarning(str);
                _fileIO.WriteLog(str, false);
            }

            output = _fileIO.ReadAllLines(fileName, false);


            return(output);
        }