public void NotMSBuildBasedProject() { MissingProject project = new MissingProject(@"C:\Projects\Test.proj", "Test"); UnitTestApplicationStartHelper helper = new UnitTestApplicationStartHelper(); helper.Initialize(project, null); Assert.AreEqual(project.GetType().BaseType, typeof(AbstractProject), "MissingProject should be derived from AbstractProject."); Assert.AreEqual(@"D:\SharpDevelop\bin\Tools\NUnit\nunit-console.exe", helper.UnitTestApplication); }
public void NotMSBuildBasedProject() { ProjectLoadInformation info = new ProjectLoadInformation(MockSolution.Create(), FileName.Create(@"C:\Projects\Test.proj"), "Test"); MissingProject project = new MissingProject(info); ITestProject testProject = new NUnitTestProject(project); NUnitConsoleApplication app = new NUnitConsoleApplication(new[] { testProject }); Assert.AreEqual(project.GetType().BaseType, typeof(AbstractProject), "MissingProject should be derived from AbstractProject."); Assert.AreEqual(@"D:\SharpDevelop\bin\Tools\NUnit\nunit-console.exe", app.FileName); }
public void NotMSBuildBasedProject() { MissingProject project = new MissingProject(@"C:\Projects\Test.proj", "Test"); SelectedTests selectedTests = new SelectedTests(project); NUnitConsoleApplication app = new NUnitConsoleApplication(selectedTests); Assert.AreEqual(project.GetType().BaseType, typeof(AbstractProject), "MissingProject should be derived from AbstractProject."); Assert.AreEqual(@"D:\SharpDevelop\bin\Tools\NUnit\nunit-console.exe", app.FileName); }
public static IProject LoadProject(IMSBuildEngineProvider provider, string location, string title, string projectTypeGuid) { if (provider == null) throw new ArgumentNullException("provider"); if (location == null) throw new ArgumentNullException("location"); if (title == null) throw new ArgumentNullException("title"); if (projectTypeGuid == null) throw new ArgumentNullException("projectTypeGuid"); IProject newProject; if (!File.Exists(location)) { newProject = new MissingProject(location, title); newProject.TypeGuid = projectTypeGuid; } else { ILanguageBinding binding = LanguageBindingService.GetBindingPerProjectFile(location); if (binding != null) { try { location = Path.GetFullPath(location); } catch (Exception) {} try { newProject = binding.LoadProject(provider, location, title); } catch (XmlException ex) { newProject = new UnknownProject(location, title, ex.Message, true); newProject.TypeGuid = projectTypeGuid; } catch (Microsoft.Build.BuildEngine.InvalidProjectFileException ex) { newProject = new UnknownProject(location, title, ex.Message, true); newProject.TypeGuid = projectTypeGuid; } catch (UnauthorizedAccessException ex) { newProject = new UnknownProject(location, title, ex.Message, true); newProject.TypeGuid = projectTypeGuid; } } else { newProject = new UnknownProject(location, title); newProject.TypeGuid = projectTypeGuid; } } return newProject; }
public static IProject LoadProject(IMSBuildEngineProvider provider, string location, string title, string projectTypeGuid, IProgressMonitor progressMonitor) { if (provider == null) throw new ArgumentNullException("provider"); if (location == null) throw new ArgumentNullException("location"); if (title == null) throw new ArgumentNullException("title"); if (projectTypeGuid == null) throw new ArgumentNullException("projectTypeGuid"); if (progressMonitor != null) { progressMonitor.BeginTask("Loading " + title, 0, false); } IProject newProject; if (!File.Exists(location)) { newProject = new MissingProject(location, title); newProject.TypeGuid = projectTypeGuid; } else { ILanguageBinding binding = LanguageBindingService.GetBindingPerProjectFile(location); if (binding != null) { location = FileUtility.NormalizePath(location); try { newProject = binding.LoadProject(provider, location, title); } catch (ProjectLoadException ex) { LoggingService.Warn("Project load error", ex); if (progressMonitor != null) progressMonitor.ShowingDialog = true; newProject = new UnknownProject(location, title, ex.Message, true); newProject.TypeGuid = projectTypeGuid; if (progressMonitor != null) progressMonitor.ShowingDialog = false; } catch (UnauthorizedAccessException ex) { LoggingService.Warn("Project load error", ex); if (progressMonitor != null) progressMonitor.ShowingDialog = true; newProject = new UnknownProject(location, title, ex.Message, true); newProject.TypeGuid = projectTypeGuid; if (progressMonitor != null) progressMonitor.ShowingDialog = false; } } else { string ext = Path.GetExtension(location); if (".proj".Equals(ext, StringComparison.OrdinalIgnoreCase) || ".build".Equals(ext, StringComparison.OrdinalIgnoreCase)) { newProject = new MSBuildFileProject(location, title); newProject.TypeGuid = projectTypeGuid; } else { newProject = new UnknownProject(location, title); newProject.TypeGuid = projectTypeGuid; } } } return newProject; }
public static IProject LoadProject(ProjectLoadInformation loadInformation) { if (loadInformation == null) throw new ArgumentNullException("loadInformation"); string location = FileUtility.NormalizePath(loadInformation.FileName); string title = loadInformation.ProjectName; IProgressMonitor progressMonitor = loadInformation.ProgressMonitor; progressMonitor.CancellationToken.ThrowIfCancellationRequested(); IProjectBinding binding = ProjectBindingService.GetBindingPerProjectFile(location); IProject newProject; if (!(binding != null && binding.HandlingMissingProject) && !File.Exists(location)) { newProject = new MissingProject(location, title); newProject.TypeGuid = loadInformation.TypeGuid; } else { if (binding != null) { try { newProject = binding.LoadProject(loadInformation); } catch (ProjectLoadException ex) { LoggingService.Warn("Project load error", ex); progressMonitor.ShowingDialog = true; newProject = new UnknownProject(location, title, ex.Message, true); newProject.TypeGuid = loadInformation.TypeGuid; progressMonitor.ShowingDialog = false; } catch (UnauthorizedAccessException ex) { LoggingService.Warn("Project load error", ex); progressMonitor.ShowingDialog = true; newProject = new UnknownProject(location, title, ex.Message, true); newProject.TypeGuid = loadInformation.TypeGuid; progressMonitor.ShowingDialog = false; } } else { string ext = Path.GetExtension(location); if (".proj".Equals(ext, StringComparison.OrdinalIgnoreCase) || ".build".Equals(ext, StringComparison.OrdinalIgnoreCase)) { newProject = new MSBuildFileProject(location, title); newProject.TypeGuid = loadInformation.TypeGuid; } else { newProject = new UnknownProject(location, title); newProject.TypeGuid = loadInformation.TypeGuid; } } } return newProject; }