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); }
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); }
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); }
/// <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)); } } }
/// <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)); } } }