void CreateCmdlet() { cmdlet = new TestableGetProjectCmdlet(); fakeTerminatingError = cmdlet.FakeCmdletTerminatingError; fakeCommandRuntime = cmdlet.FakeCommandRuntime; fakeConsoleHost = cmdlet.FakePackageManagementConsoleHost; fakeSolution = cmdlet.FakeSolution; defaultProject = base.AddDefaultProjectToConsoleHost(); }
void CreateInstaller() { project = ProjectHelper.CreateTestProject(); packageReferences = new List <PackageReference>(); fakeActionRunner = new FakePackageActionRunner(); fakeProjectFactory = new FakePackageManagementProjectFactory(); fakeRepositoryCache = new FakePackageRepositoryFactory(); installer = new PackageReferenceInstaller(fakeRepositoryCache, fakeActionRunner, fakeProjectFactory); }
void CreateReferences() { project = new TestableDTEProject(); msbuildProject = project.TestableProject; fakeProjectService = project.FakeProjectService; ProjectObject projectObject = (ProjectObject)project.Object; references = (References)projectObject.References; }
Solution CreateSolutionWithOneProject() { TestableProject project = ProjectHelper.CreateTestProject(); Solution solution = project.ParentSolution; solution.AddFolder(project); return(solution); }
void CreateReference(string name) { project = new TestableDTEProject(); msbuildProject = project.TestableProject; var referenceProjectItem = msbuildProject.AddReference(name); fakeProjectService = project.FakeProjectService; reference = new Reference(project, referenceProjectItem); }
ProjectNode AddProjectToProjectBrowser(string projectFileName) { project = ProjectHelper.CreateTestProject(); project.FileName = projectFileName; projectBrowser.ViewSolution(project.ParentSolution); var solutionNode = projectBrowser.RootNode as SolutionNode; return(solutionNode.FirstNode as ProjectNode); }
public void BuildProject_OneProjectInSubFolderInsideSolutionFolderAndUniqueNameMatchesProject_ProjectPassedToProjectBuilder() { CreateSolutionBuild(@"d:\projects\MyProject\MySolution.sln"); string projectFileName = @"d:\projects\MyProject\SubFolder\MyProject.csproj"; TestableProject expectedProject = solutionHelper.AddProjectToSolutionWithFileName("MyProject", projectFileName); solutionBuild.BuildProject("Debug", @"SubFolder\MyProject.csproj", true); Assert.AreEqual(expectedProject, projectBuilder.ProjectPassedToBuild); }
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); }
void CreateSelectedFolderNode(string folder) { projectForSelectedFolder = TestableProject.CreateProject(); projectNode = new ProjectNode(projectForSelectedFolder); directoryNode = new DirectoryNode(folder); directoryNode.AddTo(projectNode); selectedFolderNode = new SelectedFolderNodeInProjectsView(directoryNode); }
void RunCommandWithExceptionThrowingPackageReferences(Exception exception) { var exceptionThrowingPackageReferences = new ExceptionThrowingPackageReferencesForProject(); exceptionThrowingPackageReferences.ExceptionToThrowOnInstall = exception; command.FakePackageReferencesForProject = exceptionThrowingPackageReferences; TestableProject project = CreateFakeProject("Test"); RunCommandWithProjectCreateInfoAsOwner(project); }
public void SourceProject_ReferenceIsProjectReference_ReturnsReferencedProject() { TestableProject referencedProject = CreateProjectReference(); referencedProject.FileName = @"d:\projects\referencedproject.csproj"; global::EnvDTE.Project project = reference.SourceProject; Assert.AreEqual(@"d:\projects\referencedproject.csproj", project.FileName); }
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 void BuildProject_ProjectIsSecondProjectInSolution_CorrectProjectPassedToProjectBuilder() { CreateSolutionBuild(@"d:\projects\MyProject\MySolution.sln"); solutionHelper.AddProjectToSolution("FirstProject"); string projectFileName = @"d:\projects\MyProject\MyProject.csproj"; TestableProject expectedProject = solutionHelper.AddProjectToSolutionWithFileName("MyProject", projectFileName); solutionBuild.BuildProject("Debug", "MyProject.csproj", true); Assert.AreEqual(expectedProject, projectBuilder.ProjectPassedToBuild); }
List <IProject> AddSolutionWithTwoProjectsToProjectService() { ISolution solution = ProjectHelper.CreateSolution(); TestableProject project1 = ProjectHelper.CreateTestProject(solution, "Test1"); TestableProject project2 = ProjectHelper.CreateTestProject("Test2"); fakeSolution.FakeMSBuildProjects.Add(project1); fakeSolution.FakeMSBuildProjects.Add(project2); return(fakeSolution.FakeMSBuildProjects); }
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); }
public void Run_OneProjectCreatedByNewProjectDialog_ProjectUsedToCreatePackageReferences() { CreateCommand(); TestableProject expectedProject = CreateFakeProject("Test"); RunCommandWithProjectCreateInfoAsOwner(expectedProject); MSBuildBasedProject project = command.ProjectPassedToCreatePackageReferencesForProject; Assert.AreEqual(expectedProject, project); }
public void Run_OneProjectCreatedByNewProjectDialog_ProjectReferencesAreRemoved() { CreateCommand(); TestableProject project = CreateFakeProject("Test"); RunCommandWithProjectCreateInfoAsOwner(project); bool removed = command.FakePackageReferencesForProject.IsRemovePackageReferencesCalled; Assert.IsTrue(removed); }
public void GetProjects_SolutionHasOneProject_MSBuildProjectUsedToCreateProject() { CreateSolution(); TestableProject expectedProject = AddProjectToOpenProjects("MyProject"); var repository = new FakePackageRepository(); List <IPackageManagementProject> projects = solution.GetProjects(repository).ToList(); MSBuildBasedProject project = fakeProjectFactory.FirstProjectPassedToCreateProject; Assert.AreEqual(expectedProject, project); }
void CreateProjectWithOneFile(string fileName) { project = new TestableDTEProject(); msbuildProject = project.TestableProject; fakeFileService = project.FakeFileService; fileProjectItem = new FileProjectItem(msbuildProject, ItemType.Compile) { FileName = fileName }; }
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); }
public void HasMultipleProjects_OneProjectInSolution_ReturnsFalse() { CreateSolution(); TestableProject project = ProjectHelper.CreateTestProject(); fakeProjectService.AddFakeProject(project); bool hasMultipleProjects = solution.HasMultipleProjects(); Assert.IsFalse(hasMultipleProjects); }
public void GetProject_PackagesRepositoryAndProjectPassed_CreatesProjectUsingRepository() { CreateSolution(); TestableProject expectedProject = AddProjectToOpenProjects("Test"); var expectedRepository = new FakePackageRepository(); solution.GetProject(expectedRepository, expectedProject); IPackageRepository repository = fakeProjectFactory.FirstRepositoryPassedToCreateProject; Assert.AreEqual(expectedRepository, repository); }
public void ActiveSolutionProjects_SolutionHasOneProject_ReturnsArrayContainingProject() { CreateDTE(); TestableProject expectedProject = AddProjectToSolution("ProjectA"); Array projects = dte.ActiveSolutionProjects as Array; Project project = projects.GetValue(0) as Project; string name = project.Name; Assert.AreEqual("ProjectA", name); }
public void Run_OneProjectCreatedByNewProjectDialog_PackageRepositoryCacheUsedToCreatePackageReferences() { CreateCommand(); TestableProject project = CreateFakeProject("Test"); RunCommandWithProjectCreateInfoAsOwner(project); IPackageRepositoryCache cache = command.PackageRepositoryCachePassedToCreatePackageReferencesForProject; IPackageRepositoryCache expectedCache = command.FakePackageRepositoryCache; Assert.AreEqual(expectedCache, cache); }
public void GetMSBuildProjects_TwoProjectsInOpenSolutionButOneIsNotMSBuildBased_ReturnsOneMSBuildBasedProject() { CreateSolution(); TestableProject project = AddProjectToOpenProjects("A"); AddNonMSBuildBasedProjectToOpenProjects(); IEnumerable <IProject> projects = solution.GetMSBuildProjects(); var expectedProjects = new IProject[] { project }; CollectionAssert.AreEqual(expectedProjects, projects); }
public void GetProject_RepositoryAndProjectNameWithDifferentCasePassed_CreatesProjectUsingFoundProjectMatchingName() { CreateSolution(); TestableProject expectedProject = AddProjectToOpenProjects("Test"); var repository = new FakePackageRepository(); solution.GetProject(repository, "TEST"); MSBuildBasedProject project = fakeProjectFactory.FirstProjectPassedToCreateProject; Assert.AreEqual(expectedProject, project); }
public void GetProject_PackagesRepositoryAndProjectPassed_ReturnsProjectCreatedFromProjectFactory() { CreateSolution(); TestableProject msbuildProject = AddProjectToOpenProjects("Test"); var repository = new FakePackageRepository(); IPackageManagementProject project = solution.GetProject(repository, msbuildProject); FakePackageManagementProject expectedProject = fakeProjectFactory.FirstFakeProjectCreated; Assert.AreEqual(expectedProject, project); }
public void GetProject_PackagesRepositoryAndProjectPassed_CreatesProjectUsingProjectPassed() { CreateSolution(); TestableProject expectedProject = AddProjectToOpenProjects("Test"); var repository = new FakePackageRepository(); solution.GetProject(repository, expectedProject); MSBuildBasedProject project = fakeProjectFactory.FirstProjectPassedToCreateProject; Assert.AreEqual(expectedProject, project); }
public void GetProject_PackagesSourceAndProjectNameWithDifferentCasePassed_CreatesProjectUsingFoundProjectMatchingName() { CreateSolution(); TestableProject expectedProject = AddProjectToOpenProjects("Test"); var source = new PackageSource("http://sharpdevelop.net"); solution.GetProject(source, "TEST"); MSBuildBasedProject project = fakeProjectFactory.FirstProjectPassedToCreateProject; Assert.AreEqual(expectedProject, 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); }