public void SetUp()
 {
     _fileSystemMock = MockRepository.GenerateStrictMock <IFileSystem> ();
     _factory        = new DLLBasedTransformationFactoryFactory(_fileSystemMock, ".");
 }
        private static void InitializeTransformer(IEnumerable <string> args)
        {
            var showHelp      = false;
            var globalOptions = new OptionSet {
                { "h|?", "Show this help message and exit.", v => showHelp = v != null }
            };

            globalOptions.Add("d|targetDir=", "The (root) directory containing the targeted assemblies.", dir => _workingDirectory = dir);

            var fileSystem = new FileSystem.FileSystem();
            Dictionary <string, OptionSet> options = new Dictionary <string, OptionSet>();

            globalOptions.Parse(args);

            // -- create AppDomainInfoBroker
            _workingDirectory = _workingDirectory.Replace("\"", "");
            _workingDirectory = _workingDirectory.TrimEnd(new[] { '\\' });
            _infoBroker       = new AppDomainInfoBroker(_workingDirectory);

            ((DefaultAssemblyResolver)GlobalAssemblyResolver.Instance).RemoveSearchDirectory(".");
            ((DefaultAssemblyResolver)GlobalAssemblyResolver.Instance).RemoveSearchDirectory("bin");
            ((DefaultAssemblyResolver)GlobalAssemblyResolver.Instance).AddSearchDirectory(_workingDirectory);

            // -- create all the transformations
            var transformationFactoryFactory = new DLLBasedTransformationFactoryFactory(fileSystem, _workingDirectory);

            transformationFactoryFactory.TransformationsDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            transformationFactoryFactory.AddOptions(globalOptions);

            // -- add the assembly tracker
            var trackerFactory = new DirectoryBasedAssemblyTrackerFactory(fileSystem, _workingDirectory);

            trackerFactory.AddOptions(globalOptions);

            // -- add the assembly signer
            _signerFactory = new AssemblySignerFactory(fileSystem);
            _signerFactory.AddOptions(globalOptions);

            // load the given transformations
            globalOptions.Parse(args);

            _transformationFactories = transformationFactoryFactory.CreateTrackerFactories();
            // -- add options of the transformations
            foreach (var factory in _transformationFactories)
            {
                var tempOptions = new OptionSet();
                factory.AddOptions(tempOptions);
                options[factory.GetType().Name] = tempOptions;
            }

            try
            {
                var allOptions = new OptionSet();
                foreach (var option in globalOptions)
                {
                    allOptions.Add(option);
                }
                foreach (var set in options.Values)
                {
                    foreach (var option in set)
                    {
                        allOptions.Add(option);
                    }
                }

                var leftOver = allOptions.Parse(args);
                trackerFactory.IncludeFiles = leftOver.Where(s => (!s.StartsWith("-") || !s.StartsWith("\\"))).ToList();
                _targetFiles = trackerFactory.IncludeFiles;
                leftOver.RemoveAll(s => (!s.StartsWith("-") || !s.StartsWith("\\")));

                if (showHelp || leftOver.Count != 0)
                {
                    ShowHelp(globalOptions, options, leftOver);
                }
            }
            catch (OptionException e)
            {
                Console.WriteLine(e.Message);
                ShowHelp(globalOptions, options, new string[0]);
            }
            _trackerFactory = trackerFactory;
        }