public BuildFeatureFixture(
            FakeFileSystem fileSystem              = null,
            FakeEnvironment environment            = null,
            TestContainerConfigurator bootstrapper = null,
            FakeLog log                    = null,
            FakeConsole console            = null,
            IModuleSearcher moduleSearcher = null)
        {
            Environment    = environment ?? FakeEnvironment.CreateUnixEnvironment();
            FileSystem     = fileSystem ?? new FakeFileSystem(Environment);
            Bootstrapper   = bootstrapper ?? new TestContainerConfigurator();
            ScriptEngine   = new FakeScriptEngine();
            Debugger       = new FakeDebugger();
            Log            = log ?? new FakeLog();
            Console        = console ?? new FakeConsole();
            ModuleSearcher = moduleSearcher ?? Substitute.For <IModuleSearcher>();
            Processor      = Substitute.For <IScriptProcessor>();

            // Create working directory.
            FileSystem.CreateDirectory(Environment.WorkingDirectory);

            // Set the default script
            SetScript("/Working/build.cake", GetDefaultScriptContent());

            Bootstrapper.RegisterOverrides(registrar =>
            {
                registrar.RegisterInstance(FileSystem).As <IFileSystem>();
                registrar.RegisterInstance(Environment).As <ICakeEnvironment>();
                registrar.RegisterInstance(ScriptEngine).As <IScriptEngine>();
                registrar.RegisterInstance(Debugger).As <ICakeDebugger>();
                registrar.RegisterInstance(Log).As <ICakeLog>();
                registrar.RegisterInstance(Processor).As <IScriptProcessor>();
            });
        }
Exemple #2
0
 public BuildFeature(
     IFileSystem fileSystem,
     ICakeEnvironment environment,
     IContainerConfigurator configurator,
     IModuleSearcher searcher,
     ICakeLog log) : base(fileSystem, environment, configurator)
 {
     _environment = environment;
     _searcher    = searcher;
     _log         = log;
 }