public virtual void RunInstrumentation(FileInstrumenter fileInstrumenter)
        {
            var filesToProcess = fileListBuilder.BuildFileList(settings.IsConfig, settings.IsDirectory, settings.InputTarget);

            foreach (var javaScriptFile in filesToProcess)
            {
                if (!diskIo.Exists(javaScriptFile))
                {
                    if (settings.Verbose)
                    {
                        Console.WriteLine("Could not file to be processed: {0}", javaScriptFile);
                    }

                    continue;
                }

                var inputStream = new MemoryStream(diskIo.ReadAllBytes(javaScriptFile));
                var inputReader = new StreamReader(inputStream, true);
                var outputStream = new MemoryStream();
                var outputWriter = new StreamWriter(outputStream, Encoding.UTF8);

                fileInstrumenter.Instrument(inputReader, outputWriter, javaScriptFile);

                inputReader.Close();

                var outputFile = GetOutputFilePath(javaScriptFile);

                diskIo.WriteAllBytes(outputFile, outputStream.ToArray());
                outputWriter.Close();
            }
        }
        public void Instrument(string inputDir, string outputDir, List<string> excludes)
        {
            var fileInstrumenter = new FileInstrumenter(null, Verbose);

            //normalize
            if (!inputDir.EndsWith(Path.DirectorySeparatorChar.ToString()))
            {
                inputDir = inputDir + Path.DirectorySeparatorChar;
            }

            if (!outputDir.EndsWith(Path.DirectorySeparatorChar.ToString()))
            {
                outputDir = outputDir + Path.DirectorySeparatorChar;
            }

            var filenames = GetFilenames(inputDir, excludes);

            foreach (var filename in filenames)
            {
                var outputFilename = Path.Combine(outputDir, filename);
                var outputFullPath = Path.GetFullPath(outputFilename);

                //create the directories if necessary
                if (!Directory.Exists(outputFullPath))
                {
                    if (Verbose)
                    {
                        Console.WriteLine("[INFO] Creating directory {0}", outputFullPath);
                    }
                    Directory.CreateDirectory(outputFullPath);
                }

                //fileInstrumenter.Instrument(Path.Combine(inputDir, filename), outputFilename, Encoding.UTF8);
            }

            //copy files and directories excluded from instrumentation, still need them to run tests
            CopyExcludes(inputDir, outputDir, excludes);
        }
        public void Setup()
        {
            fileInstrumenter = Substitute.For<FileInstrumenter>(false);
            fileListBuilder = Substitute.For<FileListBuilder>();
            diskIo = Substitute.For<IDisk>();
            settings = new Settings();

            controller = new CoverController(settings, fileListBuilder, diskIo);
        }
        public void Setup()
        {
            instrumenter = Substitute.For<IInstrumenter>();

            fileInstrumenter = new FileInstrumenter(instrumenter, false);
        }