示例#1
0
		void CreateProjectItems()
		{
			project = new TestableDTEProject();
			msbuildProject = project.TestableProject;
			projectItems = project.ProjectItems;
			fakeFileService = project.FakeFileService;
		}
示例#2
0
		public TestableDTEProject(TestableProject project)
			: this(
			project,
			new FakePackageManagementProjectService(),
			new FakeFileService(project))
		{
		}
示例#3
0
		void CreateCodeModel()
		{
			helper = new ProjectContentHelper();
			msbuildProject = ProjectHelper.CreateTestProject();
			helper.SetProjectForProjectContent(msbuildProject);
			codeModel = new CodeModel(helper.ProjectContent);
		}
示例#4
0
		void CreateReferences()
		{
			project = new TestableDTEProject();
			msbuildProject = project.TestableProject;
			fakeProjectService = project.FakeProjectService;
			references = project.Object.References;
		}
		void CreateProperties()
		{
			project = new TestableDTEProject();
			msbuildProject = project.TestableProject;
			var factory = new ProjectPropertyFactory(project);
			properties = new ICSharpCode.PackageManagement.EnvDTE.Properties(factory);
		}
		void CreateProperties()
		{
			project = new TestableDTEProject();
			msbuildProject = project.TestableProject;
			var factory = new ProjectPropertyFactory(project);
			properties = new Properties(factory);
		}
		void CreateProjectItems(string fileName = @"d:\projects\MyProject\MyProject.csproj")
		{
			project = new TestableDTEProject();
			msbuildProject = project.TestableProject;
			msbuildProject.FileName = new FileName(fileName);
			projectItems = (ProjectItems)project.ProjectItems;
			fakeFileService = project.FakeFileService;
		}
		void CreateReference(string name)
		{
			project = new TestableDTEProject();
			msbuildProject = project.TestableProject;
			referenceProjectItem = msbuildProject.AddReference(name);
			fakeProjectService = project.FakeProjectService;
			CreateReference(project, referenceProjectItem);
		}
		void CreateProject()
		{
			fakeMSBuildProject = ProjectHelper.CreateTestProject();
			fakeMSBuildProject.SetProperty("TargetFrameworkIdentifier", null);
			fakeMSBuildProject.SetProperty("TargetFrameworkVersion", "v4.0");
			fakeMSBuildProject.SetProperty("TargetFrameworkProfile", null);
			CreateProject(fakeMSBuildProject);
		}
		void CreateProjectItemProperties()
		{
			project = new TestableDTEProject();
			msbuildProject = project.TestableProject;
			msbuildFileProjectItem = new SD.FileProjectItem(msbuildProject, SD.ItemType.Compile);
			projectItem = new ProjectItem(project, msbuildFileProjectItem);
			properties = projectItem.Properties;
		}
示例#11
0
		void CreateCmdlet()
		{
			cmdlet = new TestableGetProjectCmdlet();
			fakeTerminatingError = cmdlet.FakeCmdletTerminatingError;
			fakeCommandRuntime = cmdlet.FakeCommandRuntime;
			fakeConsoleHost = cmdlet.FakePackageManagementConsoleHost;
			fakeSolution = cmdlet.FakeSolution;
			defaultProject = base.AddDefaultProjectToConsoleHost();
		}
示例#12
0
        public SD.FileProjectItem AddFileToFirstProjectInSolution(string include)
        {
            TestableProject project = FakeProjectService
                                      .AllProjects
                                      .Select(p => p as TestableProject)
                                      .First();

            return(project.AddFile(include));
        }
示例#13
0
		public SD.FileProjectItem AddFileToSecondProjectInSolution(string include)
		{
			TestableProject project = FakeProjectService
				.FakeOpenProjects
				.Select(p => p as TestableProject)
				.Skip(1)
				.First();
			return project.AddFile(include);
		}
		void CreateInstaller()
		{
			project = ProjectHelper.CreateTestProject();
			packageReferences = new List<PackageReference>();
			fakeActionRunner = new FakePackageActionRunner();
			fakeProjectFactory = new FakePackageManagementProjectFactory();
			fakeRepositoryCache = new FakePackageRepositoryFactory();
			installer = new PackageReferenceInstaller(fakeRepositoryCache, fakeActionRunner, fakeProjectFactory);
		}
示例#15
0
		void CreateReference(string name)
		{
			project = new TestableDTEProject();
			msbuildProject = project.TestableProject;
			referenceProjectItem = msbuildProject.AddReference(name);
			fakeProjectService = project.FakeProjectService;
			CreateReference(project, referenceProjectItem);
			IWorkbench workbench = MockRepository.GenerateStub<IWorkbench>();
			ICSharpCode.SharpDevelop.SD.Services.AddService(typeof(IWorkbench), workbench);
		}
 public TestableDTEProject(
     TestableProject project,
     FakePackageManagementProjectService projectService,
     FakeFileService fileService)
     : base(project, projectService, fileService)
 {
     this.TestableProject    = project;
     this.FakeProjectService = projectService;
     this.FakeFileService    = fileService;
 }
示例#17
0
		void CreateProjectWithOneFileInProjectFolder(
			string include,
			string projectFileName = @"c:\projects\MyProject\MyProject.csproj")
		{
			project = new TestableDTEProject();
			msbuildProject = project.TestableProject;
			fakeFileService = project.FakeFileService;
			msbuildProject.FileName = new FileName(projectFileName);
			msbuildProject.AddFile(include);
		}
示例#18
0
		TestableProject CreateProjectReference()
		{
			project = new TestableDTEProject();
			msbuildProject = project.TestableProject;
			TestableProject referencedProject = ProjectHelper.CreateTestProject();
			ProjectReferenceProjectItem referenceProjectItem = msbuildProject.AddProjectReference(referencedProject);
			fakeProjectService = project.FakeProjectService;
			CreateReference(project, referenceProjectItem);
			return referencedProject;
		}
		void CreateProjectWithOneFile(string fileName)
		{
			project = new TestableDTEProject();
			msbuildProject = project.TestableProject;
			fakeFileService = project.FakeFileService;
			
			fileProjectItem = new FileProjectItem(msbuildProject, ItemType.Compile) {
				FileName = fileName
			};
		}
示例#20
0
		public TestableDTEProject(
			TestableProject project,
			FakePackageManagementProjectService projectService,
			FakeFileService fileService)
			: base(project, projectService, fileService)
		{
			this.TestableProject = project;
			this.FakeProjectService = projectService;
			this.FakeFileService = fileService;
		}
示例#21
0
		public static TestableProject CreateTestProject(
			ISolution parentSolution,
			string name,
			string fileName = null)
		{
			var createInfo = new ProjectCreateInformation(parentSolution, new FileName(fileName ?? (@"d:\projects\Test\TestProject\" + name + ".csproj")));
			
			var project = new TestableProject(createInfo);
			((ICollection<IProject>)parentSolution.Projects).Add(project);
			return project;
		}
		void CreateProjectItemProperties()
		{
			project = new TestableDTEProject();
			msbuildProject = project.TestableProject;
			msbuildFileProjectItem = new SD.FileProjectItem(msbuildProject, SD.ItemType.Compile);
			projectItem = new ProjectItem(project, msbuildFileProjectItem);
			properties = (ICSharpCode.PackageManagement.EnvDTE.Properties)projectItem.Properties;
			
			IWorkbench workbench = MockRepository.GenerateStub<IWorkbench>();
			ICSharpCode.SharpDevelop.SD.Services.AddService(typeof(IWorkbench), workbench);
		}
示例#23
0
		void CreateProject()
		{
			msbuildProject = ProjectHelper.CreateTestProject();
			helper = new ProjectContentHelper();
			
			fakeProjectService = MockRepository.GenerateStub<IPackageManagementProjectService>();
			fakeProjectService.Stub(service => service.GetProjectContent(msbuildProject)).Return(helper.ProjectContent);
			
			fakeFileService = MockRepository.GenerateStub<IPackageManagementFileService>();
			project = new Project(msbuildProject, fakeProjectService, fakeFileService);
		}
示例#24
0
		void CreateProject(string fileName = @"d:\projects\MyProject\MyProject.csproj", string language = "C#")
		{
			msbuildProject = ProjectHelper.CreateTestProject();
			msbuildProject.FileName = new FileName(fileName);
			//helper = new ProjectContentHelper();
			
			fakeProjectService = MockRepository.GenerateStub<IPackageManagementProjectService>();
			//fakeProjectService.Stub(service => service.GetProjectContent(msbuildProject)).Return(helper.ProjectContent);
			
			fakeFileService = MockRepository.GenerateStub<IPackageManagementFileService>();
			project = new Project(msbuildProject, fakeProjectService, fakeFileService);
		}
示例#25
0
		public static FileProjectItem GetFileFromInclude(TestableProject project, string include)
		{
			foreach (ProjectItem projectItem in project.Items) {
				FileProjectItem fileItem = projectItem as FileProjectItem;
				if (fileItem != null) {
					if (fileItem.Include == include) {
						return fileItem;
					}
				}
			}
			return null;
		}
        public static TestableProject CreateTestProject(
            ISolution parentSolution,
            string name,
            string fileName = null)
        {
            var createInfo = new ProjectCreateInformation(parentSolution, new FileName(fileName ?? (@"d:\projects\Test\TestProject\" + name + ".csproj")));

            var project = new TestableProject(createInfo);

            ((ICollection <IProject>)parentSolution.Projects).Add(project);
            ((ICollection <ISolutionItem>)parentSolution.Items).Add(project);
            return(project);
        }
示例#27
0
		TestableProject CreateProjectReference(string parentProjectFileName, string referencedProjectFileName)
		{
			project = new TestableDTEProject();
			msbuildProject = project.TestableProject;
			msbuildProject.FileName = new FileName(parentProjectFileName);
			TestableProject referencedProject = ProjectHelper.CreateTestProject();
			referencedProject.FileName = new FileName(referencedProjectFileName);
			((ICollection<IProject>)msbuildProject.ParentSolution.Projects).Add(referencedProject);
			IWorkbench workbench = MockRepository.GenerateStub<IWorkbench>();
			ICSharpCode.SharpDevelop.SD.Services.AddService(typeof(IWorkbench), workbench);
			ProjectReferenceProjectItem referenceProjectItem = msbuildProject.AddProjectReference(referencedProject);
			fakeProjectService = project.FakeProjectService;
			CreateReference(project, referenceProjectItem);
			return referencedProject;
		}
示例#28
0
 public static FileProjectItem GetFileFromInclude(TestableProject project, string include)
 {
     foreach (ProjectItem projectItem in project.Items)
     {
         FileProjectItem fileItem = projectItem as FileProjectItem;
         if (fileItem != null)
         {
             if (fileItem.Include == include)
             {
                 return(fileItem);
             }
         }
     }
     return(null);
 }
		void CreateProject()
		{
			fakePackageManagerFactory = new FakePackageManagerFactory();
			fakePackageManager = fakePackageManagerFactory.FakePackageManager;
			fakeProjectManager = fakePackageManager.FakeProjectManager;
			fakeSourceRepository = new FakePackageRepository();
			fakeMSBuildProject = ProjectHelper.CreateTestProject();
			fakePackageManagementEvents = new FakePackageManagementEvents();
			
			project = new PackageManagementProject(
				fakeSourceRepository,
				fakeMSBuildProject,
				fakePackageManagementEvents,
				fakePackageManagerFactory);
		}
示例#30
0
		public static TestableProject CreateTestProject(string name)
		{
			Solution solution = new Solution(new MockProjectChangeWatcher());
			solution.FileName = @"d:\projects\Test\TestSolution.sln";
			
			ProjectCreateInformation createInfo = new ProjectCreateInformation();
			createInfo.Solution = solution;
			createInfo.ProjectName = name;
			createInfo.SolutionPath = @"d:\projects\Test";
			createInfo.ProjectBasePath = @"d:\projects\Test\TestProject";
			createInfo.OutputProjectFileName = @"d:\projects\Test\TestProject\TestProject.csproj";
			
			var project = new TestableProject(createInfo);
			project.Parent = solution;
			return project;
		}
		void CreateSolution(PackageManagementOptions options)
		{
			testProject = ProjectHelper.CreateTestProject();
			fakeRegisteredPackageRepositories = new FakeRegisteredPackageRepositories();
			fakeProjectFactory = new FakePackageManagementProjectFactory();
			fakeProjectService = new FakePackageManagementProjectService();
			var packageManagementEvents = new FakePackageManagementEvents();
			
			fakeProjectService.CurrentProject = testProject;
			solution =
				new PackageManagementSolution(
					fakeRegisteredPackageRepositories,
					packageManagementEvents,
					fakeProjectService,
					fakeProjectFactory);
		}
		void CreatePackageManagementService(PackageManagementOptions options)
		{
			testProject = ProjectHelper.CreateTestProject();
			fakePackageRepositoryFactory = new FakePackageRepositoryFactory();
			fakePackageManagerFactory = new FakePackageManagerFactory();
			fakeProjectService = new FakePackageManagementProjectService();
			fakeOutputMessagesView = new FakePackageManagementOutputMessagesView();
			fakeProjectService.CurrentProject = testProject;
			packageManagementService = 
				new PackageManagementService(options,
					fakePackageRepositoryFactory,
					fakePackageManagerFactory,
					fakeProjectService,
					fakeOutputMessagesView);

			installPackageHelper = new InstallPackageHelper(packageManagementService);
		}
示例#33
0
		public static TestableProject CreateTestProject(
			Solution parentSolution,
			string name,
			string fileName = @"d:\projects\Test\TestProject\TestProject.csproj")
		{
			ProjectCreateInformation createInfo = new ProjectCreateInformation();
			createInfo.Solution = parentSolution;
			createInfo.ProjectName = name;
			createInfo.SolutionPath = @"d:\projects\Test";
			createInfo.ProjectBasePath = @"d:\projects\Test\TestProject";
			createInfo.OutputProjectFileName = fileName;
			
			var project = new TestableProject(createInfo);
			project.Parent = parentSolution;
			parentSolution.AddFolder(project);
			return project;
		}
		protected void CreateCodeModel()
		{
			msbuildProject = ProjectHelper.CreateTestProject();
			
			projectService = MockRepository.GenerateStub<IPackageManagementProjectService>();
			fileService = MockRepository.GenerateStub<IPackageManagementFileService>();
			dteProject = new Project(msbuildProject, projectService, fileService);
			codeModelContext.DteProject = dteProject;
			
			codeModel = new CodeModel(codeModelContext, dteProject);
			
			msbuildProject.SetAssemblyModel(assemblyModel);
			project.Stub(p => p.AssemblyModel).Return(assemblyModel);
			
			fileService
				.Stub(fs => fs.GetCompilationUnit(msbuildProject))
				.WhenCalled(compilation => compilation.ReturnValue = CreateCompilation());
		}
示例#35
0
        public static TestableProject CreateTestProject()
        {
            Solution solution = new Solution();

            solution.FileName = @"d:\projects\Test\TestSolution.sln";

            ProjectCreateInformation createInfo = new ProjectCreateInformation();

            createInfo.Solution              = solution;
            createInfo.ProjectName           = "TestProject";
            createInfo.SolutionPath          = @"d:\projects\Test";
            createInfo.ProjectBasePath       = @"d:\projects\Test\TestProject";
            createInfo.OutputProjectFileName = @"d:\projects\Test\TestProject\TestProject.csproj";

            var project = new TestableProject(createInfo);

            project.Parent = solution;
            return(project);
        }
示例#36
0
        public static TestableProject CreateTestProject(
            Solution parentSolution,
            string name,
            string fileName = @"d:\projects\Test\TestProject\TestProject.csproj")
        {
            ProjectCreateInformation createInfo = new ProjectCreateInformation();

            createInfo.Solution              = parentSolution;
            createInfo.ProjectName           = name;
            createInfo.SolutionPath          = @"d:\projects\Test";
            createInfo.ProjectBasePath       = @"d:\projects\Test\TestProject";
            createInfo.OutputProjectFileName = fileName;

            var project = new TestableProject(createInfo);

            project.Parent = parentSolution;
            parentSolution.AddFolder(project);
            return(project);
        }
示例#37
0
        public static TestableProject CreateTestProject(string name)
        {
            Solution solution = new Solution(new MockProjectChangeWatcher());

            solution.FileName = @"d:\projects\Test\TestSolution.sln";

            ProjectCreateInformation createInfo = new ProjectCreateInformation();

            createInfo.Solution              = solution;
            createInfo.ProjectName           = name;
            createInfo.SolutionPath          = @"d:\projects\Test";
            createInfo.ProjectBasePath       = @"d:\projects\Test\TestProject";
            createInfo.OutputProjectFileName = @"d:\projects\Test\TestProject\TestProject.csproj";

            var project = new TestableProject(createInfo);

            project.Parent = solution;
            solution.AddFolder(project);
            return(project);
        }
		void CreateSolution(PackageManagementOptions options)
		{
			testProject = ProjectHelper.CreateTestProject();
			fakeRegisteredPackageRepositories = new FakeRegisteredPackageRepositories();
			fakeProjectFactory = new FakePackageManagementProjectFactory();
			fakeProjectService = new FakePackageManagementProjectService();
			
			fakeProjectService.CurrentProject = testProject;
			fakeProjectService.OpenSolution = testProject.ParentSolution;
			
			fakeSolutionPackageRepositoryFactory = new FakeSolutionPackageRepositoryFactory();
			fakeSolutionPackageRepository = fakeSolutionPackageRepositoryFactory.FakeSolutionPackageRepository;
			
			solution =
				new PackageManagementSolution(
					fakeRegisteredPackageRepositories,
					fakeProjectService,
					fakeProjectFactory,
					fakeSolutionPackageRepositoryFactory);
		}
示例#39
0
        public void AddProjectToSolution(string projectName)
        {
            TestableProject project = ProjectHelper.CreateTestProject(projectName);

            FakeProjectService.AddFakeProject(project);
        }
示例#40
0
		public TestableProject AddProjectToSolutionWithFileName(string projectName, string fileName)
		{
			TestableProject project = ProjectHelper.CreateTestProject(MSBuildSolution, projectName, fileName);
			FakeProjectService.AddFakeProject(project);
			return project;
		}
 public static void AddWebSiteProjectType(TestableProject project)
 {
     AddProjectType(project, ProjectTypeGuids.WebSite);
 }