예제 #1
0
        public FakeCakeContext()
        {
            testsDir = new DirectoryPath(
                System.IO.Path.GetFullPath(AppContext.BaseDirectory));

            var fileSystem = new FileSystem();

            log = new FakeLog();
            var runtime     = new CakeRuntime();
            var platform    = new FakePlatform(PlatformFamily.OSX);
            var environment = new CakeEnvironment(platform, runtime);
            var globber     = new Globber(fileSystem, environment);

            var args     = new FakeCakeArguments();
            var registry = new WindowsRegistry();

            var          dataService            = new FakeDataService();
            var          toolRepository         = new ToolRepository(environment);
            var          config                 = new FakeConfiguration();
            var          toolResolutionStrategy = new ToolResolutionStrategy(fileSystem, environment, globber, config, log);
            IToolLocator tools         = new ToolLocator(environment, toolRepository, toolResolutionStrategy);
            var          processRunner = new ProcessRunner(fileSystem, environment, log, tools, config);

            context = new CakeContext(fileSystem, environment, globber, log, args, processRunner, registry, tools, dataService, config);
            context.Environment.WorkingDirectory = testsDir;
        }
예제 #2
0
        public FakeCakeContext()
        {
            testsDir = new DirectoryPath(System.IO.Path.Combine(AppContext.BaseDirectory, "..", "..", "..", "..", ".."));

            var fileSystem  = new FileSystem();
            var environment = new FakeEnvironment(PlatformFamily.OSX);
            var globber     = new Globber(fileSystem, environment);

            log = new FakeLog();
            var args     = new FakeCakeArguments();
            var registry = new WindowsRegistry();
            var toolRepo = new ToolRepository(environment);
            var config   = new Core.Configuration.CakeConfigurationProvider(fileSystem, environment).CreateConfiguration(testsDir, new Dictionary <string, string>());
            var toolResolutionStrategy = new ToolResolutionStrategy(fileSystem, environment, globber, config);
            var toolLocator            = new ToolLocator(environment, toolRepo, toolResolutionStrategy);
            var processRunner          = new ProcessRunner(fileSystem, environment, log, toolLocator, config);
            var dataService            = new FakeDataService();

            context = new CakeContext(fileSystem, environment, globber, log, args, processRunner, registry, toolLocator, dataService, config);
            context.Environment.WorkingDirectory = testsDir;
        }