Ejemplo n.º 1
0
 void CreateCodeModel()
 {
     helper         = new ProjectContentHelper();
     msbuildProject = ProjectHelper.CreateTestProject();
     helper.SetProjectForProjectContent(msbuildProject);
     codeModel = new CodeModel(helper.ProjectContent);
 }
        public void Init()
        {
            project = ProjectHelper.CreateTestProject();

            AddService <IWorkbench>();
            AddService <IFileService>();

            IProjectService            projectService            = MockRepository.GenerateMock <IProjectService, IProjectServiceRaiseEvents>();
            IProjectServiceRaiseEvents projectServiceRaiseEvents = (IProjectServiceRaiseEvents)projectService;

            SD.Services.AddService(typeof(IProjectService), projectService);
            SD.Services.AddService(typeof(IProjectServiceRaiseEvents), projectServiceRaiseEvents);

            projectServiceRaiseEvents
            .Stub(service => service.RaiseProjectItemAdded(Arg <ProjectItemEventArgs> .Is.Anything))
            .WhenCalled(methodInvocation => projectService.Raise(p => p.ProjectItemAdded += null, null, methodInvocation.Arguments[0]));

            IWinFormsService winFormsService = AddService <IWinFormsService>();

            bitmap = new Bitmap(32, 32);
            winFormsService
            .Stub(service => service.GetResourceServiceBitmap(Arg <string> .Is.Anything))
            .Return(bitmap);

            AddDefaultDotNetNodeBuilderToAddinTree();
        }
Ejemplo n.º 3
0
        TestableProject AddProjectToProjectContent()
        {
            TestableProject project = ProjectHelper.CreateTestProject();

            helper.ProjectContentHelper.SetProjectForProjectContent(project);
            return(project);
        }
Ejemplo n.º 4
0
        void AddProjectToMSBuildSolution(string fileName)
        {
            TestableProject project = ProjectHelper.CreateTestProject();

            project.FileName = fileName;
            fakeProjectService.AddFakeProject(project);
        }
        void AddProjectToMSBuildSolution(string fileName)
        {
            TestableProject project = ProjectHelper.CreateTestProject(fakeProjectService.OpenSolution, "Test", fileName);

            project.SetProperty("ProjectTypeGuids", null);
            fakeProjectService.AddProject(project);
        }
Ejemplo n.º 6
0
        TestableProject AddProjectToSolution(Solution solution)
        {
            var project = ProjectHelper.CreateTestProject();

            solution.AddFolder(project);
            return(project);
        }
        TestableProject AddFakeProject(string name)
        {
            var project = ProjectHelper.CreateTestProject(name);

            fakeSolution.FakeMSBuildProjects.Add(project);
            return(project);
        }
Ejemplo n.º 8
0
        TestableProject AddProjectToOpenProjects(string projectName)
        {
            TestableProject project = ProjectHelper.CreateTestProject(projectName);

            fakeProjectService.FakeOpenProjects.Add(project);
            return(project);
        }
        public void ReadPackages_SolutionInitiallySelectedWithOneNewerPackageAndProjectSelectedBeforeSecondReadOfPackages_NewerPackageVersionDisplayed()
        {
            CreateSolution();
            NoProjectsSelected();
            CreateViewModel(solution);
            AddPackageToSolution("Test", "1.0.0.0");
            FakePackage newerPackage = AddPackageToActiveRepository("Test", "1.1.0.0");

            viewModel.ReadPackages();
            CompleteReadPackagesTask();

            TestableProject msbuildProject = ProjectHelper.CreateTestProject("Test");

            solution.FakeActiveMSBuildProject = msbuildProject;
            solution.FakeActiveProject        = new FakePackageManagementProject("Test");

            viewModel.ReadPackages();
            CompleteReadPackagesTask();

            var expectedPackages = new FakePackage[] {
                newerPackage
            };

            PackageCollectionAssert.AreEqual(expectedPackages, viewModel.PackageViewModels);
        }
Ejemplo n.º 10
0
        FakeDotNetProject AddProjectWithShortName(string projectName)
        {
            var project = ProjectHelper.CreateTestProject(projectName);

            openProjects.Add(project);
            return(project);
        }
Ejemplo n.º 11
0
        TestableProject AddProjectToSolution(string projectName)
        {
            TestableProject project = ProjectHelper.CreateTestProject(projectName);

            fakeProjectService.AddFakeProject(project);
            return(project);
        }
        TestableProject AddProjectWithShortName(string projectName)
        {
            TestableProject project = ProjectHelper.CreateTestProject(projectName);

            openProjects.Add(project);
            return(project);
        }
        void AddFileToUnknownProject(string fileName)
        {
            TestableProject unknownProject  = ProjectHelper.CreateTestProject();
            var             fileProjectItem = new FileProjectItem(unknownProject, ItemType.Compile);

            fileProjectItem.FileName = fileName;
            ProjectService.AddProjectItem(unknownProject, fileProjectItem);
        }
Ejemplo n.º 14
0
        List <IProject> AddSolutionWithOneProjectToProjectService()
        {
            TestableProject project = ProjectHelper.CreateTestProject("Test1");

            fakeSolution.FakeMSBuildProjects.Add(project);

            return(fakeSolution.FakeMSBuildProjects);
        }
Ejemplo n.º 15
0
 void CreateProject()
 {
     fakeMSBuildProject = ProjectHelper.CreateTestProject();
     fakeMSBuildProject.SetProperty("TargetFrameworkIdentifier", null);
     fakeMSBuildProject.SetProperty("TargetFrameworkVersion", "v4.0");
     fakeMSBuildProject.SetProperty("TargetFrameworkProfile", null);
     CreateProject(fakeMSBuildProject);
 }
Ejemplo n.º 16
0
        List <FakeDotNetProject> AddSolutionWithOneProjectToProjectService()
        {
            FakeDotNetProject project = ProjectHelper.CreateTestProject("Test1");

            fakeSolution.FakeDotNetProjects.Add(project);

            return(fakeSolution.FakeDotNetProjects);
        }
Ejemplo n.º 17
0
        void CreateTestProject()
        {
            testProject = ProjectHelper.CreateTestProject();
            var solution = new FakeSolution {
                BaseDirectory = @"c:\projects\MyProject\".ToNativePath()
            };

            testProject.ParentSolution = solution;
        }
Ejemplo n.º 18
0
        Solution CreateSolutionWithOneProject()
        {
            TestableProject project  = ProjectHelper.CreateTestProject();
            Solution        solution = project.ParentSolution;

            solution.AddFolder(project);

            return(solution);
        }
Ejemplo n.º 19
0
 void CreateInstaller()
 {
     project             = ProjectHelper.CreateTestProject();
     packageReferences   = new List <PackageReference>();
     fakeActionRunner    = new FakePackageActionRunner();
     fakeProjectFactory  = new FakePackageManagementProjectFactory();
     fakeRepositoryCache = new FakePackageRepositoryFactory();
     installer           = new PackageReferenceInstaller(fakeRepositoryCache, fakeActionRunner, fakeProjectFactory);
 }
        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);
        }
Ejemplo n.º 21
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);
        }
Ejemplo n.º 22
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);
        }
Ejemplo n.º 23
0
        public void HasMultipleProjects_OneProjectInSolution_ReturnsFalse()
        {
            CreateSolution();
            TestableProject project = ProjectHelper.CreateTestProject();

            fakeProjectService.AddFakeProject(project);

            bool hasMultipleProjects = solution.HasMultipleProjects();

            Assert.IsFalse(hasMultipleProjects);
        }
Ejemplo n.º 24
0
        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);
        }
Ejemplo n.º 25
0
        public void GetProject_NullProjectNameAndNonNullRepositoryPassed_UsesDefaultProjectNameToCreateProject()
        {
            CreateHost();
            host.DefaultProject = ProjectHelper.CreateTestProject("MyProject");
            var repository = new FakePackageRepository();

            IPackageManagementProject project = host.GetProject(repository, null);

            string projectName = fakeSolution.ProjectNamePassedToGetProject;

            Assert.AreEqual("MyProject", projectName);
        }
        public void InstallPackage_PackageAndPackageRepositoryPassed_CreatesPackageManagerWithCurrentlyActiveProject()
        {
            CreatePackageManagementService();
            IProject expectedProject = ProjectHelper.CreateTestProject();

            fakeProjectService.CurrentProject = expectedProject;

            installPackageHelper.InstallTestPackage();

            IProject actualProject = fakePackageManagerFactory.ProjectPassedToCreateRepository;

            Assert.AreEqual(expectedProject, actualProject);
        }
Ejemplo n.º 27
0
        public void TargetFramework_TargetFrameworkVersion40DefinedInProject_ReturnsFullDotNetFramework40()
        {
            fakeMSBuildProject = ProjectHelper.CreateTestProject();
            fakeMSBuildProject.SetProperty("TargetFrameworkIdentifier", null);
            fakeMSBuildProject.SetProperty("TargetFrameworkVersion", "v4.0");
            fakeMSBuildProject.SetProperty("TargetFrameworkProfile", null);
            CreateProject(fakeMSBuildProject);
            var expectedName = new FrameworkName(".NETFramework, Version=v4.0");

            FrameworkName targetFramework = project.TargetFramework;

            Assert.AreEqual(expectedName, targetFramework);
        }
Ejemplo n.º 28
0
        List <IProject> AddSolutionWithTwoProjectsToProjectService()
        {
            TestableProject project1 = ProjectHelper.CreateTestProject("Test1");
            TestableProject project2 = ProjectHelper.CreateTestProject("Test2");

            Solution solution = project1.ParentSolution;

            project2.Parent = solution;

            fakeSolution.FakeMSBuildProjects.Add(project1);
            fakeSolution.FakeMSBuildProjects.Add(project2);

            return(fakeSolution.FakeMSBuildProjects);
        }
Ejemplo n.º 29
0
        public void HasMultipleProjects_TwoProjectsInSolution_ReturnsTrue()
        {
            CreateSolution();
            TestableProject project1 = ProjectHelper.CreateTestProject();

            fakeProjectService.AddFakeProject(project1);
            TestableProject project2 = ProjectHelper.CreateTestProject();

            fakeProjectService.AddFakeProject(project2);

            bool hasMultipleProjects = solution.HasMultipleProjects();

            Assert.IsTrue(hasMultipleProjects);
        }
Ejemplo n.º 30
0
        public void GetActiveProject_RepositoryPassed_CreatesProjectUsingCurrentActiveProject()
        {
            CreateSolution();
            var             expectedRepository = new FakePackageRepository();
            TestableProject expectedProject    = ProjectHelper.CreateTestProject();

            fakeProjectService.CurrentProject = expectedProject;

            solution.GetActiveProject(expectedRepository);

            MSBuildBasedProject project = fakeProjectFactory.FirstProjectPassedToCreateProject;

            Assert.AreEqual(expectedProject, project);
        }