示例#1
0
        public void Configure(ILocateWriteLocation defaultConfigurationLocator)
        {
            _services = new ServiceLocator();
            _services.Container.Kernel.Resolver.AddSubResolver(new ArrayResolver(_services.Container.Kernel));
            _services.Container
            .Register(Component.For <IServiceLocator>().Instance(_services))
            .Register(Component.For <IMessageBus>().ImplementedBy <MessageBus>().LifeStyle.Singleton)
            .Register(Component.For <IFileSystemService>().ImplementedBy <FileSystemService>())
            .Register(Component.For <IProjectParser>().ImplementedBy <ProjectParser>())
            .Register(Component.For <ICreate <Project> >().ImplementedBy <ProjectFactory>())
            .Register(Component.For <IPrepare <Project> >().ImplementedBy <ProjectPreparer>())
            .Register(Component.For <IOverridingConsumer <ProjectChangeMessage> >().ImplementedBy <ProjectChangeConsumer>().LifeStyle.Singleton)
            .Register(Component.For <IConsumerOf <FileChangeMessage> >().ImplementedBy <FileChangeConsumer>().Named("MSBuild"))
            .Register(Component.For <IConsumerOf <FileChangeMessage> >().ImplementedBy <BinaryFileChangeConsumer>().Named("NoBuild"))
            .Register(Component.For <ICache>().ImplementedBy <Cache>().LifeStyle.Singleton)
            .Register(Component.For <IWatchValidator>().ImplementedBy <WatchValidator>())
            .Register(Component.For <ILocateProjects>().ImplementedBy <CSharpLocator>())
            .Register(Component.For <ILocateProjects>().ImplementedBy <VisualBasicLocator>())
            .Register(Component.For <IInformationFeedbackPresenter>().ImplementedBy <InformationFeedbackPresenter>())
            .Register(Component.For <IRunFeedbackPresenter>().ImplementedBy <RunFeedbackPresenter>())
            .Register(Component.For <IDirectoryWatcher>().ImplementedBy <DirectoryWatcher>().LifeStyle.Singleton)
            .Register(Component.For <IConfiguration>().ImplementedBy <Config>())
            .Register(Component.For <ICrawlForProjectFiles>().ImplementedBy <ProjectFileCrawler>())
            .Register(Component.For <IReload <Project> >().ImplementedBy <ProjectReloader>())
            .Register(Component.For <IPrioritizeProjects>().ImplementedBy <ProjectPrioritizer>())
            .Register(Component.For <IBuildRunner>().ImplementedBy <MSBuildRunner>())
            .Register(Component.For <ITestRunner>().ImplementedBy <NUnitTestRunner>())
            .Register(Component.For <ITestRunner>().ImplementedBy <MSTestRunner>())
            .Register(Component.For <ITestRunner>().ImplementedBy <XUnitTestRunner>())
            .Register(Component.For <ITestRunner>().ImplementedBy <MSpecTestRunner>())
            .Register(Component.For <ITestRunner>().ImplementedBy <AutoTestTestRunner>())
            .Register(Component.For <IExternalProcess>().ImplementedBy <HiddenExternalProcess>())
            .Register(Component.For <IMSpecCommandLineBuilder>().ImplementedBy <MSpecCommandLineBuilder>())
            .Register(Component.For <IGenerateBuildList>().ImplementedBy <BuildListGenerator>())
            .Register(Component.For <IMergeRunResults>().Forward <IRunResultCache>().ImplementedBy <RunResultCache>())
            .Register(Component.For <IRetrieveAssemblyIdentifiers>().ImplementedBy <AssemblyParser>())
            .Register(Component.For <IOverridingConsumer <AssemblyChangeMessage> >().ImplementedBy <AssemblyChangeConsumer>().LifeStyle.Singleton)
            .Register(Component.For <IDetermineIfAssemblyShouldBeTested>().ImplementedBy <TestRunValidator>())
            .Register(Component.For <IOptimizeBuildConfiguration>().ImplementedBy <BuildOptimizer>())
            .Register(Component.For <IPreProcessTestruns>().ImplementedBy <NullPreProcessor>())
            .Register(Component.For <IPreProcessBuildruns>().ImplementedBy <NullBuildPreProcessor>())
            .Register(Component.For <IHandleDelayedConfiguration>().ImplementedBy <DelayedConfigurer>())
            .Register(Component.For <IMarkProjectsForRebuild>().ImplementedBy <ProjectRebuildMarker>())
            .Register(Component.For <ILocateRemovedTests>().ImplementedBy <RemovedTestsLocator>())
            .Register(Component.For <ISolutionChangeConsumer>().ImplementedBy <SolutionChangeConsumer>())
            .Register(Component.For <ISolutionParser>().ImplementedBy <SolutionCrawler>())
            .Register(Component.For <IAssemblyReader>().ImplementedBy <AssemblyReader>())
            .Register(Component.For <IApplicatonLauncher>().ImplementedBy <ApplicatonLauncher>().LifeStyle.Singleton)
            .Register(Component.For <ICustomIgnoreProvider>().ImplementedBy <NullIgnoreProvider>())
            .Register(Component.For <IWriteDebugInfo>().ImplementedBy <DebugWriter>().LifeStyle.Singleton)
            .Register(Component.For <IWatchPathLocator>().ImplementedBy <WatchPathLocator>());

            if (defaultConfigurationLocator == null)
            {
                defaultConfigurationLocator = new DefaultConfigurationLocator();
            }
            _services.Container.Register(Component.For <ILocateWriteLocation>().Instance(defaultConfigurationLocator));

            initializeNotifiers();
        }
        public void Configure(ILocateWriteLocation defaultConfigurationLocator)
        {
            _services = new ServiceLocator();
            _services.Container.Kernel.Resolver.AddSubResolver(new ArrayResolver(_services.Container.Kernel));
            _services.Container
                .Register(Component.For<BuildConfiguration>().Instance(_buildConfig))
                .Register(Component.For<IServiceLocator>().Instance(_services))
                .Register(Component.For<IMessageBus>().ImplementedBy<MessageBus>().LifeStyle.Singleton)
                .Register(Component.For<IFileSystemService>().ImplementedBy<FileSystemService>())
                .Register(Component.For<IProjectParser>().ImplementedBy<ProjectParser>())
                .Register(Component.For<ICreate<Project>>().ImplementedBy<ProjectFactory>())
                .Register(Component.For<IPrepare<Project>>().ImplementedBy<ProjectPreparer>())
                .Register(Component.For<IOverridingConsumer<ProjectChangeMessage>>().Forward<IConsumerOf<AbortMessage>>().ImplementedBy<ProjectChangeConsumer>().LifeStyle.Singleton)
                .Register(Component.For<IConsumerOf<FileChangeMessage>>().ImplementedBy<FileChangeConsumer>().Named("MSBuild"))
				.Register(Component.For<IConsumerOf<FileChangeMessage>>().ImplementedBy<BinaryFileChangeConsumer>().Named("NoBuild"))
                .Register(Component.For<ICache>().ImplementedBy<Cache>().LifeStyle.Singleton)
                .Register(Component.For<IWatchValidator>().ImplementedBy<WatchValidator>())
                .Register(Component.For<ILocateProjects>().ImplementedBy<CSharpLocator>())
                .Register(Component.For<ILocateProjects>().ImplementedBy<VisualBasicLocator>())
                .Register(Component.For<ILocateProjects>().ImplementedBy<FSharpLocator>())
                .Register(Component.For<IInformationFeedbackPresenter>().ImplementedBy<InformationFeedbackPresenter>())
                .Register(Component.For<IRunFeedbackPresenter>().ImplementedBy<RunFeedbackPresenter>())
                .Register(Component.For<IDirectoryWatcher>().ImplementedBy<DirectoryWatcher>().LifeStyle.Singleton)
                .Register(Component.For<IConfiguration>().ImplementedBy<Config>())
                .Register(Component.For<ICrawlForProjectFiles>().ImplementedBy<ProjectFileCrawler>())
                .Register(Component.For<IReload<Project>>().ImplementedBy<ProjectReloader>())
                .Register(Component.For<IPrioritizeProjects>().ImplementedBy<ProjectPrioritizer>())
                .Register(Component.For<IBuildRunner>().ImplementedBy<MSBuildRunner>())
                .Register(Component.For<ITestRunner>().ImplementedBy<NUnitTestRunner>())
                .Register(Component.For<ITestRunner>().ImplementedBy<MSTestRunner>())
                .Register(Component.For<ITestRunner>().ImplementedBy<XUnitTestRunner>())
                .Register(Component.For<ITestRunner>().ImplementedBy<MSpecTestRunner>())
                .Register(Component.For<ITestRunner>().ImplementedBy<AutoTestTestRunner>())
                .Register(Component.For<IExternalProcess>().ImplementedBy<HiddenExternalProcess>())
                .Register(Component.For<IMSpecCommandLineBuilder>().ImplementedBy<MSpecCommandLineBuilder>())
                .Register(Component.For<IGenerateBuildList>().ImplementedBy<BuildListGenerator>())
                .Register(Component.For<IMergeRunResults>().Forward<IRunResultCache>().ImplementedBy<RunResultCache>())
				.Register(Component.For<IRetrieveAssemblyIdentifiers>().ImplementedBy<AssemblyParser>())
                .Register(Component.For<IOverridingConsumer<AssemblyChangeMessage>>().Forward<IConsumerOf<AbortMessage>>().ImplementedBy<AssemblyChangeConsumer>().LifeStyle.Singleton)
				.Register(Component.For<IDetermineIfAssemblyShouldBeTested>().ImplementedBy<TestRunValidator>())
				.Register(Component.For<IOptimizeBuildConfiguration>().ImplementedBy<BuildOptimizer>())
				.Register(Component.For<IPreProcessTestruns>().ImplementedBy<NullPreProcessor>())
                .Register(Component.For<IPreProcessBuildruns>().ImplementedBy<NullBuildPreProcessor>())
				.Register(Component.For<IHandleDelayedConfiguration>().ImplementedBy<DelayedConfigurer>())
				.Register(Component.For<IMarkProjectsForRebuild>().ImplementedBy<ProjectRebuildMarker>())
                .Register(Component.For<ILocateRemovedTests>().ImplementedBy<RemovedTestsLocator>())
                .Register(Component.For<ISolutionChangeConsumer>().ImplementedBy<SolutionChangeConsumer>())
                .Register(Component.For<ISolutionParser>().ImplementedBy<SolutionCrawler>())
                .Register(Component.For<IAssemblyPropertyReader>().ImplementedBy<AssemblyPropertyReader>())
                .Register(Component.For<IApplicatonLauncher>().ImplementedBy<ApplicatonLauncher>().LifeStyle.Singleton)
                .Register(Component.For<ICustomIgnoreProvider>().ImplementedBy<NullIgnoreProvider>())
				.Register(Component.For<ICustomIgnoreProvider>().ImplementedBy<DeveloperCustomIgnoreProvider>())
                .Register(Component.For<IWriteDebugInfo>().ImplementedBy<DebugWriter>().LifeStyle.Singleton)
                .Register(Component.For<IWatchPathLocator>().ImplementedBy<WatchPathLocator>())
                .Register(Component.For<IGenerateOrderedBuildLists>().ImplementedBy<BuildOrderHandler>())
				.Register(Component.For<EditorEngineLauncher>()
									.Forward<IConsumerOf<BuildRunMessage>>()
									.Forward<IConsumerOf<TestRunMessage>>()
									.Forward<IConsumerOf<RunStartedMessage>>()
									.Forward<IConsumerOf<RunFinishedMessage>>()
									.ImplementedBy<EditorEngineLauncher>()
									.LifeStyle.Singleton)
                .Register(Component.For<IOnDemanTestrunPreprocessor>()
                                    .Forward<IPreProcessBuildruns>()
                                    .Forward<IPreProcessTestruns>()
                                    .Forward<IConsumerOf<RunFinishedMessage>>()
                                    .ImplementedBy<OnDemanTestrunPreprocessor>().LifeStyle.Singleton)
                .Register(Component.For<IPreProcessBuildruns>().ImplementedBy<MSTestCrossPlatformPreProcessor>().LifeStyle.Singleton)
                .Register(Component.For<IBuildSessionRunner>().ImplementedBy<BuildSessionRunner>());

            if (defaultConfigurationLocator == null)
                defaultConfigurationLocator = new DefaultConfigurationLocator();
            _services.Container.Register(Component.For<ILocateWriteLocation>().Instance(defaultConfigurationLocator));

            var config = _services.Locate<IConfiguration>();
            initializeNotifiers(config);
        }
		public void SetUp()
		{
			_locator = new DefaultConfigurationLocator();
		}