This class provides instances for handling project parsing requests based on file extension.
示例#1
0
        public void CreateWithDefaultConfigurationTest()
        {
            ProjectHandlerConfiguration configuration = new ProjectHandlerConfiguration();
            ProjectHandler projectHandler = new ProjectHandler(configuration);

            Assert.IsNotNull(projectHandler.ProjectParser, "Expected a project parser instance.");
            Assert.IsInstanceOfType(typeof (MSBuildProjectParser), projectHandler.ProjectParser);
        }
示例#2
0
        public void CreateTest()
        {
            ProjectHandlerConfiguration configuration = new ProjectHandlerConfiguration();
            configuration.ParserType = "NArrange.Core.MonoDevelopProjectParser";

            ProjectHandler handler = new ProjectHandler(configuration);

            Assert.IsNotNull(handler.ProjectParser, "Project parser was not created.");
            Assert.IsInstanceOfType(typeof (MonoDevelopProjectParser), handler.ProjectParser);
        }
示例#3
0
        public void CreateWithAssemblyTest()
        {
            string assemblyName = "NArrange.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null";
            ProjectHandlerConfiguration configuration = new ProjectHandlerConfiguration();
            configuration.AssemblyName = assemblyName;
            configuration.ParserType = "NArrange.Core.MSBuildProjectParser";

            ProjectHandler handler = new ProjectHandler(configuration);

            Assert.IsNotNull(handler.ProjectParser, "Project parser was not created.");
            Assert.IsInstanceOfType(typeof (MSBuildProjectParser), handler.ProjectParser);
        }
示例#4
0
        /// <summary>
        /// Initializes the manager from the configuration supplied
        /// during constuction.
        /// </summary>
        private void Initialize()
        {
            //
            // Load extension handlers
            //
            _projectExtensionHandlers = new Dictionary <string, ProjectHandler>(
                StringComparer.OrdinalIgnoreCase);
            _sourceExtensionHandlers = new Dictionary <string, SourceHandler>(
                StringComparer.OrdinalIgnoreCase);
            foreach (HandlerConfiguration handlerConfiguration in _configuration.Handlers)
            {
                switch (handlerConfiguration.HandlerType)
                {
                case HandlerType.Source:
                    SourceHandlerConfiguration sourceConfiguration = handlerConfiguration as SourceHandlerConfiguration;
                    SourceHandler sourceHandler = new SourceHandler(sourceConfiguration);
                    foreach (ExtensionConfiguration extension in sourceConfiguration.SourceExtensions)
                    {
                        _sourceExtensionHandlers.Add(extension.Name, sourceHandler);
                    }
                    break;

                case HandlerType.Project:
                    ProjectHandlerConfiguration projectConfiguration = handlerConfiguration as ProjectHandlerConfiguration;
                    ProjectHandler projectHandler = new ProjectHandler(projectConfiguration);
                    foreach (ExtensionConfiguration extension in projectConfiguration.ProjectExtensions)
                    {
                        _projectExtensionHandlers.Add(extension.Name, projectHandler);
                    }
                    break;

                default:
                    throw new InvalidOperationException(
                              string.Format(
                                  CultureInfo.InvariantCulture,
                                  "Unrecognized handler configuration {0}",
                                  handlerConfiguration));
                }
            }
        }
示例#5
0
        /// <summary>
        /// Initializes the manager from the configuration supplied 
        /// during constuction.
        /// </summary>
        private void Initialize()
        {
            //
            // Load extension handlers
            //
            _projectExtensionHandlers = new Dictionary<string, ProjectHandler>(
                StringComparer.OrdinalIgnoreCase);
            _sourceExtensionHandlers = new Dictionary<string, SourceHandler>(
                StringComparer.OrdinalIgnoreCase);
            foreach (HandlerConfiguration handlerConfiguration in _configuration.Handlers)
            {
                switch (handlerConfiguration.HandlerType)
                {
                    case HandlerType.Source:
                        SourceHandlerConfiguration sourceConfiguration = handlerConfiguration as SourceHandlerConfiguration;
                        SourceHandler sourceHandler = new SourceHandler(sourceConfiguration);
                        foreach (ExtensionConfiguration extension in sourceConfiguration.SourceExtensions)
                        {
                            _sourceExtensionHandlers.Add(extension.Name, sourceHandler);
                        }
                        break;

                    case HandlerType.Project:
                        ProjectHandlerConfiguration projectConfiguration = handlerConfiguration as ProjectHandlerConfiguration;
                        ProjectHandler projectHandler = new ProjectHandler(projectConfiguration);
                        foreach (ExtensionConfiguration extension in projectConfiguration.ProjectExtensions)
                        {
                            _projectExtensionHandlers.Add(extension.Name, projectHandler);
                        }
                        break;

                    default:
                        throw new InvalidOperationException(
                            string.Format(
                                CultureInfo.InvariantCulture,
                                "Unrecognized handler configuration {0}",
                                handlerConfiguration));
                }
            }
        }