Solution OpenSolution()
		{
			var solution = new Solution(new MockProjectChangeWatcher());
			solution.FileName = @"d:\projects\myprojects\test.csproj";
			fakeProjectService.FireSolutionLoadedEvent(solution);
			return solution;
		}
		public SolutionPackageRepository(Solution solution)
			: this(
				solution,
				new SharpDevelopPackageRepositoryFactory(),
				PackageManagementServices.Options)
		{
		}
Пример #3
0
 void OpenSolution()
 {
     FakeProjectService = new FakePackageManagementProjectService();
     MSBuildSolution    = CreateSharpDevelopSolution();
     FakeProjectService.OpenSolution = MSBuildSolution;
     Solution = new Solution(FakeProjectService);
 }
Пример #4
0
 public Solution(IPackageManagementProjectService projectService)
 {
     this.projectService = projectService;
     this.solution       = projectService.OpenSolution;
     this.Projects       = new Projects(projectService);
     this.Globals        = new SolutionGlobals(this);
 }
		public void Init()
		{
			solution = new Solution();
			project1 = new MockCSharpProject(solution);
			project1.Name = "A";
			ReferenceProjectItem refProjectItem = new ReferenceProjectItem(project1);
			refProjectItem.Include = "NUnit.Framework";
			ProjectService.AddProjectItem(project1, refProjectItem);
			solution.Folders.Add(project1);
			
			project2 = new MockCSharpProject(solution);
			project2.Name = "Z";
			refProjectItem = new ReferenceProjectItem(project2);
			refProjectItem.Include = "NUnit.Framework";
			ProjectService.AddProjectItem(project2, refProjectItem);
			solution.Folders.Add(project2);
			
			MockProjectContent projectContent = new MockProjectContent();
			projectContent.Project = project1;
			
			treeView = new DummyParserServiceTestTreeView();
			treeView.ProjectContentForProject = projectContent;
			treeView.AddSolution(solution);
			projects = treeView.GetProjects();
		}
		public void SetUp()
		{
			testFrameworks = new MockTestFrameworksWithNUnitFrameworkSupport();
			treeView = new DummyParserServiceTestTreeView(testFrameworks);
			
			// Create a solution with two test projects.
			solution = new Solution(new MockProjectChangeWatcher());
			
			// Create the first test project.
			firstProject = new MockCSharpProject(solution, "FirstTestProject");
			ReferenceProjectItem nunitFrameworkReferenceItem = new ReferenceProjectItem(firstProject);
			nunitFrameworkReferenceItem.Include = "NUnit.Framework";
			ProjectService.AddProjectItem(firstProject, nunitFrameworkReferenceItem);

			// Create the second test project.
			secondProject = new MockCSharpProject(solution, "SecondTestProject");
			nunitFrameworkReferenceItem = new ReferenceProjectItem(secondProject);
			nunitFrameworkReferenceItem.Include = "NUnit.Framework";
			ProjectService.AddProjectItem(secondProject, nunitFrameworkReferenceItem);
					
			// Add the projects to the solution.
			solution.Folders.Add(firstProject);
			solution.Folders.Add(secondProject);
			
			// Create a dummy project content so the projects will be added
			// to the tree.
			treeView.ProjectContentForProject = new MockProjectContent();
			
			// Add the solution to the tree.
			treeView.AddSolution(solution);
			
			allTestsTreeNode = treeView.Nodes[0] as AllTestsTreeNode;
			firstTestProject = treeView.GetTestProject(firstProject);
			secondTestProject = treeView.GetTestProject(secondProject);
		}
		public IPackageInitializationScripts CreatePackageInitializationScripts(
			Solution solution)
		{
			var repository = new SolutionPackageRepository(solution);
			var scriptFactory = new PackageScriptFactory();
			return new PackageInitializationScripts(repository, scriptFactory);
		}
 void CreateProperties()
 {
     solutionHelper  = new SolutionHelper();
     solution        = solutionHelper.Solution;
     msbuildSolution = solutionHelper.MSBuildSolution;
     properties      = (Properties)solution.Properties;
 }
		public void SetUp()
		{
			solution = new Solution();
			
			// Create a project to display in the test tree view.
			project = new MockCSharpProject(solution, "TestProject");
			ReferenceProjectItem nunitFrameworkReferenceItem = new ReferenceProjectItem(project);
			nunitFrameworkReferenceItem.Include = "NUnit.Framework";
			ProjectService.AddProjectItem(project, nunitFrameworkReferenceItem);
			
			// Add a test class with a TestFixture attributes.
			projectContent = new MockProjectContent();
			projectContent.Language = LanguageProperties.None;
			testClass1 = new MockClass(projectContent, "Project.Tests.MyTestFixture");
			testClass1.Attributes.Add(new MockAttribute("TestFixture"));
			projectContent.Classes.Add(testClass1);
			
			testClass2 = new MockClass(projectContent, "Project.MyTestFixture");
			testClass2.Attributes.Add(new MockAttribute("TestFixture"));
			projectContent.Classes.Add(testClass2);
						
			testFrameworks = new MockTestFrameworksWithNUnitFrameworkSupport();
			dummyTreeView = new DummyParserServiceTestTreeView(testFrameworks);
			dummyTreeView.ProjectContentForProject = projectContent;
			
			// Load the projects into the test tree view.
			treeView = dummyTreeView as TestTreeView;
			solution.Folders.Add(project);
			treeView.AddSolution(solution);
			nodes = treeView.Nodes;
			rootNode = (ExtTreeNode)treeView.Nodes[0];
			
			treeView.SelectedNode = rootNode;
			testProject = treeView.SelectedTestProject;
		}
Пример #10
0
		public Solution(IPackageManagementProjectService projectService)
		{
			this.projectService = projectService;
			this.solution = projectService.OpenSolution;
			this.Projects = new Projects(projectService);
			this.Globals = new SolutionGlobals(this);
		}
		public SolutionConfigurationEditor()
		{
			this.solution = ProjectService.OpenSolution;
			if (solution == null)
				throw new Exception("A solution must be opened");
			
			//
			// The InitializeComponent() call is required for Windows Forms designer support.
			//
			InitializeComponent();
			
			this.Text = StringParser.Parse(this.Text);
			label1.Text = StringParser.Parse(label1.Text);
			label2.Text = StringParser.Parse(label2.Text);
			okButton.Text = StringParser.Parse(okButton.Text);
			projectNameColumn.HeaderText = StringParser.Parse(projectNameColumn.HeaderText);
			configurationColumn.HeaderText = StringParser.Parse(configurationColumn.HeaderText);
			platformColumn.HeaderText = StringParser.Parse(platformColumn.HeaderText);
			
			inUpdate = true;
			UpdateAvailableSolutionConfigurationPlatforms();
			
			foreach (IProject p in solution.Projects) {
				DataGridViewRow row = grid.Rows[grid.Rows.Add()];
				row.Tag = p;
				row.Cells[0].Value = p.Name;
			}
			
			UpdateGrid();
		}
Пример #12
0
		void CreateProperties()
		{
			solutionHelper = new SolutionHelper();
			solution = solutionHelper.Solution;
			msbuildSolution = solutionHelper.MSBuildSolution;
			properties = (Properties)solution.Properties;
		}
Пример #13
0
		void OpenSolution()
		{
			FakeProjectService = new FakePackageManagementProjectService();
			MSBuildSolution = CreateSharpDevelopSolution();
			FakeProjectService.OpenSolution = MSBuildSolution;
			Solution = new Solution(FakeProjectService);
		}
Пример #14
0
		public static TestableProject CreateTestProject(string name)
		{
			Solution solution = new Solution(new MockProjectChangeWatcher());
			solution.FileName = @"d:\projects\Test\TestSolution.sln";
			
			return CreateTestProject(solution, name);
		}
Пример #15
0
		void CreateVsSolution(string solutionFileName = @"d:\projects\test\Test.sln")
		{
			var msbuildSolution = new Solution(new MockProjectChangeWatcher());
			msbuildSolution.FileName = solutionFileName;
			fakeProjectService = new FakePackageManagementProjectService();
			fakeProjectService.OpenSolution = msbuildSolution;
			solution = new VsSolution(fakeProjectService);
		}
Пример #16
0
 public Solution(IPackageManagementProjectService projectService)
 {
     this.projectService = projectService;
     this.solution       = projectService.OpenSolution;
     this.Projects       = new Projects(projectService);
     this.Globals        = new SolutionGlobals(this);
     this.SolutionBuild  = new SolutionBuild(this, projectService.ProjectBuilder);
     CreateProperties();
 }
Пример #17
0
		public Solution(IPackageManagementProjectService projectService)
		{
			this.projectService = projectService;
			this.solution = projectService.OpenSolution;
			this.Projects = new Projects(projectService);
			this.Globals = new SolutionGlobals(this);
			this.SolutionBuild = new SolutionBuild(this, projectService.ProjectBuilder);
			CreateProperties();
		}
		public void Save(Solution solution)
		{
			if (WorkbenchSingleton.InvokeRequired) {
				Action<Solution> action = Save;
				WorkbenchSingleton.SafeThreadCall<Solution>(action, solution);
			} else {
				solution.Save();
			}
		}
		IProject SolutionWithOneProjectOpen()
		{
			var solution = new Solution(new MockProjectChangeWatcher());
			var project = new MockCSharpProject(solution, "MyProject");
			solution.AddFolder(project);
			
			runTestCommandContext.Solution = solution;
			
			return project;
		}
Пример #20
0
		public MockCSharpProject(Solution solution, string name)
			: base(new ProjectCreateInformation {
					Solution = solution,
					ProjectName = name,
					TargetFramework = TargetFramework.Net40Client,
					OutputProjectFileName = "c:\\projects\\" + name + "\\" + name + ".csproj"
				})
		{
			OutputType = OutputType.Library;
		}
Пример #21
0
		static void RaiseThreadEnded(Solution solution)
		{
			Gui.WorkbenchSingleton.SafeThreadAsyncCall(
				delegate {
					// only raise the event if the solution is still open
					if (solution == ProjectService.OpenSolution) {
						isThreadRunning = false;
						ThreadEnded(null, EventArgs.Empty);
					}
				});
		}
		public SolutionPackageRepository(
			Solution solution,
			ISharpDevelopPackageRepositoryFactory repositoryFactory,
			PackageManagementOptions options)
		{
			this.repositoryFactory = repositoryFactory;
			repositoryPath = new SolutionPackageRepositoryPath(solution, options);
			CreatePackagePathResolver();
			CreateFileSystem();
			CreateRepository(ConfigSettingsFileSystem.CreateConfigSettingsFileSystem(solution));
		}
		public EditAvailableConfigurationsDialog(Solution solution, bool editPlatforms)
			: this()
		{
			this.solution = solution;
			this.editPlatforms = editPlatforms;
			InitList();
			
			if (editPlatforms)
				this.Text = StringParser.Parse("${res:Dialog.EditAvailableConfigurationsDialog.EditSolutionPlatforms}");
			else
				this.Text = StringParser.Parse("${res:Dialog.EditAvailableConfigurationsDialog.EditSolutionConfigurations}");
		}
Пример #24
0
		public SolutionItemNode(Solution solution, SolutionItem item)
		{
			sortOrder = 2;
			canLabelEdit = true;
			
			ContextmenuAddinTreePath = "/SharpDevelop/Pads/ProjectBrowser/ContextMenu/SolutionItemNode";
			
			this.solution = solution;
			this.item = item;
			this.Text = Path.GetFileName(FileName);
			SetIcon(IconService.GetImageForFile(FileName));
		}
		public ProjectLoadInformation(Solution parentSolution, string fileName, string projectName)
		{
			if (parentSolution == null)
				throw new ArgumentNullException("parentSolution");
			if (fileName == null)
				throw new ArgumentNullException("fileName");
			if (projectName == null)
				throw new ArgumentNullException("projectName");
			this.ParentSolution = parentSolution;
			this.FileName = fileName;
			this.ProjectName = projectName;
		}
		public EditAvailableConfigurationsDialog(IProject project, bool editPlatforms)
			: this()
		{
			this.project = project;
			this.solution = project.ParentSolution;
			this.editPlatforms = editPlatforms;
			InitList();
			
			if (editPlatforms)
				this.Text = StringParser.Parse("${res:Dialog.EditAvailableConfigurationsDialog.EditProjectPlatforms}");
			else
				this.Text = StringParser.Parse("${res:Dialog.EditAvailableConfigurationsDialog.EditProjectConfigurations}");
		}
		public void GetWorkingDirectory_SolutionOpen_ReturnsSolutionDirectory()
		{
			CreateWorkingDirectory();
			var solution = new Solution(new MockProjectChangeWatcher());
			solution.FileName = @"d:\projects\MyProject\myproject.sln";
			fakeProjectService.OpenSolution = solution;
			
			string directory = workingDirectory.GetWorkingDirectory();
			
			string expectedDirectory = @"'d:\projects\MyProject'";
			
			Assert.AreEqual(expectedDirectory, directory);
		}
Пример #28
0
		public SolutionNode(Solution solution)
		{
			sortOrder = -1;
			this.solution = solution;
			UpdateText();;
			autoClearNodes = false;
			canLabelEdit = true;
			
			ContextmenuAddinTreePath = "/SharpDevelop/Pads/ProjectBrowser/ContextMenu/SolutionNode";
			
			SetIcon("ProjectBrowser.Solution");
			Tag = solution;
		}
		public void SetUp()
		{
			Solution solution = new Solution();
			MockCSharpProject project = new MockCSharpProject();
			MockProjectContent projectContent = new MockProjectContent();
			projectContent.Project = project;
			projectContent.Language = LanguageProperties.None;
			ReferenceProjectItem refProjectItem = new ReferenceProjectItem(project);
			refProjectItem.Include = "NUnit.Framework";
			ProjectService.AddProjectItem(project, refProjectItem);
			solution.Folders.Add(project);
			
			pad = new DerivedUnitTestsPad(solution);
		}
		public TestableInvokeUpdateWorkingDirectoryCmdlet(
			FakePackageManagementProjectService projectService,
			FakePackageManagementConsoleHost consoleHost,
			FakeCmdletTerminatingError cmdletTerminatingError)
			: base(projectService, consoleHost, cmdletTerminatingError)
		{
			this.FakeProjectService = projectService;
			this.FakePackageManagementConsoleHost = consoleHost;
			this.FakeCmdletTerminatingError = cmdletTerminatingError;
			
			Solution = new Solution();
			Solution.FileName = @"d:\projects\MyProject\MyProject.sln";
			projectService.OpenSolution = Solution;
		}
		public void Init()
		{
			projectContent = new MockProjectContent();
			pad.ProjectContent = projectContent;
			solution = new Solution();
			project = new MockCSharpProject();
			projectContent.Project = project;
			projectContent.Language = LanguageProperties.None;
			ReferenceProjectItem refProjectItem = new ReferenceProjectItem(project);
			refProjectItem.Include = "NUnit.Framework";
			ProjectService.AddProjectItem(project, refProjectItem);
			solution.Folders.Add(project);
			
			pad.CallSolutionLoaded(solution);
		}
		protected virtual void DoTearDown()
		{
			if (this.defaultPC != null) {
				this.defaultPC.Dispose();
				this.defaultPC = null;
			}
			if (this.project != null) {
				this.project.Dispose();
				this.project = null;
			}
			if (this.solution != null) {
				this.solution.Dispose();
				this.solution = null;
			}
		}
		protected virtual void DoSetUp()
		{
			TestHelper.InitializeParsers();
			
			this.solution = new Solution(new MockProjectChangeWatcher());
			this.project = this.CreateTestProject();
			ProjectService.CurrentProject = this.project;
			
			DefaultProjectContent pc = this.CreateNewProjectContent(this.project);
			HostCallback.GetCurrentProjectContent = delegate {
				return pc;
			};
			ResourceResolverService.SetProjectContentUnitTestOnly(this.project, pc);
			this.defaultPC = pc;
		}
		public void SetUpFixture()
		{
			PythonMSBuildEngineHelper.InitMSBuildEngine();

			List<ProjectBindingDescriptor> bindings = new List<ProjectBindingDescriptor>();
			using (TextReader reader = PythonBindingAddInFile.ReadAddInFile()) {
				AddIn addin = AddIn.Load(reader, String.Empty);
				bindings.Add(new ProjectBindingDescriptor(AddInHelper.GetCodon(addin, "/SharpDevelop/Workbench/ProjectBindings", "Python")));
			}
			ProjectBindingService.SetBindings(bindings);
			
			// Set up IProjectContent so the ConvertProjectToPythonProjectCommand can
			// locate the startup object and determine it's filename.
			
			mockProjectContent = new ICSharpCode.Scripting.Tests.Utils.MockProjectContent();
			MockClass mainClass = new MockClass(mockProjectContent, startupObject);
			mainClass.CompilationUnit.FileName = @"d:\projects\test\src\Main2.cs";
			mockProjectContent.SetClassToReturnFromGetClass(startupObject, mainClass);
			
			convertProjectCommand = new DerivedConvertProjectToPythonProjectCommand();
			convertProjectCommand.ProjectContent = mockProjectContent;
			convertProjectCommand.FileServiceDefaultEncoding = Encoding.Unicode;
			
			Solution solution = new Solution(new MockProjectChangeWatcher());
			sourceProject = new MSBuildBasedProject(
				new ProjectCreateInformation() {
					Solution = solution,
					OutputProjectFileName = @"d:\projects\test\source.csproj",
					ProjectName = "source"
				});
			sourceProject.Parent = solution;
			sourceProject.SetProperty(null, null, "StartupObject", startupObject, PropertyStorageLocations.Base, true);
			mainFile = new FileProjectItem(sourceProject, ItemType.Compile, @"src\Main.cs");
			targetProject = (PythonProject)convertProjectCommand.CallCreateProject(@"d:\projects\test\converted", sourceProject);
			convertProjectCommand.CallCopyProperties(sourceProject, targetProject);
			targetMainFile = new FileProjectItem(targetProject, mainFile.ItemType, mainFile.Include);
			mainFile.CopyMetadataTo(targetMainFile);
			
			main2File = new FileProjectItem(sourceProject, ItemType.Compile, @"src\Main2.cs");
			targetMain2File = new FileProjectItem(targetProject, main2File.ItemType, main2File.Include);
			main2File.CopyMetadataTo(targetMain2File);
			
			convertProjectCommand.AddParseableFileContent(mainFile.FileName, mainSource);
			convertProjectCommand.AddParseableFileContent(main2File.FileName, main2Source);
			
			convertProjectCommand.CallConvertFile(mainFile, targetMainFile);
			convertProjectCommand.CallConvertFile(main2File, targetMain2File);
		}
Пример #35
0
        public Solution(ICSharpCode.SharpDevelop.Project.Solution solution)
        {
            foreach (var p in solution.Projects.OfType <MSBuildBasedProject>())
            {
                if (p.FileName.ToString().EndsWith(".csproj", StringComparison.OrdinalIgnoreCase))
                {
                    Projects.Add(new CSharpProject(p));
                }
            }
            var snapshot = SD.ParserService.GetCurrentSolutionSnapshot();

            foreach (var p in Projects)
            {
                p.Compilation = snapshot.GetCompilation(p.IProject);
            }
        }
Пример #36
0
 public Solution(SD.Solution solution)
 {
     this.solution = solution;
 }
Пример #37
0
 public SD.Solution OpenDifferentSolution()
 {
     SD.Solution solution = CreateSharpDevelopSolution();
     FakeProjectService.OpenSolution = solution;
     return(solution);
 }
Пример #38
0
 void ProjectServiceSolutionClosed(object sender, EventArgs e)
 {
     this.solutionToLoadWhenHandleIsCreated = null;
     projectBrowserPanel.Clear();
 }
Пример #39
0
 internal bool IsSameSolution(SD.Solution solution)
 {
     throw new NotImplementedException();
 }
Пример #40
0
 public void ViewSolution(Solution solution)
 {
     UpdateToolStrip(null);
     projectBrowserControl.ViewSolution(solution);
 }