private static void SetMinFileIO(string dir)
        {
            string dataDir = ".\\" + dir + "\\";

            _fileIO = new MinTestFileIO(dataDir);
            FileIOFactory.SetFileIO(_fileIO);
        }
 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);
     }
 }
 public Test()
 {
     if (_enableLogging)
     {
         string  strFile = @"c:\temp\log\wpfdemo.log";
         IFileIO fileIO  = new LogFileIO(strFile);
         FileIOFactory.SetFileIO(fileIO);
     }
     else
     {
         IFileIO fileIO = new FileIO();
         FileIOFactory.SetFileIO(fileIO);
     }
     InitializeComponent();
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="BootstrapImport"/> class.
        /// </summary>
        public BootstrapImport() : base(null)
        {
            this.Caption = "Bootstrap Importer";

            // This is the user control hosted by the tool window; Note that, even if this class implements IDisposable,
            // we are not calling Dispose on this object. This is because ToolWindowPane calls Dispose on
            // the object returned by the Content property.
            this.Content = new BootstrapImportControl();


            // set file io factory, tempory set to FileIO which is existing file io.
            IFileIO fileIO = new FileIO();

            FileIOFactory.SetFileIO(fileIO);
        }
        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);
        }
        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);
        }
 private static void SetDefaultFileIO()
 {
     _fileIO = new FileIO();
     FileIOFactory.SetFileIO(_fileIO);
 }