void CreateCmdletWithoutActiveProject()
		{
			cmdlet = new TestableInstallPackageCmdlet();
			fakeTerminatingError = cmdlet.FakeCmdletTerminatingError;
			fakeConsoleHost = cmdlet.FakePackageManagementConsoleHost;
			fakeProject = fakeConsoleHost.FakeProject;
		}
Ejemplo n.º 2
0
		void CreateInstallActionWithNoPowerShellScripts()
		{
			var fakeProject = new FakePackageManagementProject();
			fakeAction = new FakeInstallPackageAction(fakeProject);
			fakeAction.Operations = new PackageOperation[0];
			fakeActions.Add(fakeAction);
		}
		void CreateViewModel(FakePackageManagementSolution fakeSolution)
		{
			viewModel = new TestableUpdatedPackageViewModel(fakeSolution);
			fakeProject = fakeSolution.FakeProjectToReturnFromGetProject;
			fakeActionRunner = viewModel.FakeActionRunner;
			fakePackageManagementEvents = viewModel.FakePackageManagementEvents;
		}
		void CreateAction()
		{
			fakePackageManagementEvents = new FakePackageManagementEvents();
			fakeProject = new FakePackageManagementProject();
			action = new InstallPackageAction(fakeProject, fakePackageManagementEvents);
			installPackageHelper = new InstallPackageHelper(action);
		}
		FakeInstallPackageAction CreateInstallAction()
		{
			var project = new FakePackageManagementProject();
			var action = new FakeInstallPackageAction(project);
			action.Operations = new PackageOperation[0];
			return action;
		}
		FakeInstallPackageAction AddInstallAction()
		{
			var project = new FakePackageManagementProject();
			var action = new FakeInstallPackageAction(project);
			actionsToRun.AddAction(action);
			return action;
		}
		void CreateSolution()
		{
			fakePackageManagementEvents = new FakePackageManagementEvents();
			fakeProject = new FakePackageManagementProject();
			action = new UpdatePackageAction(fakeProject, fakePackageManagementEvents);
			updatePackageHelper = new UpdatePackageHelper(action);
		}
		void CreateAction()
		{
			fakeProject = new FakePackageManagementProject();
			fakeScriptFactory = new FakePackageScriptFactory();
			fakeScriptRunner = new FakePackageScriptRunner();
			action = new RunPackageScriptsAction(fakeProject, fakeScriptRunner, fakeScriptFactory);
		}
Ejemplo n.º 9
0
		InstallPackageAction AddAction()
		{
			var project = new FakePackageManagementProject();
			var events = new FakePackageManagementEvents();
			var action = new InstallPackageAction(project, events);
			actions.AddAction(action);
			return action;
		}
		void CreateViewModel(FakePackageManagementSolution fakeSolution)
		{
			viewModelParent = MockRepository.GenerateStub<IPackageViewModelParent>();
			viewModel = new TestableUpdatedPackageViewModel(viewModelParent, fakeSolution);
			fakeProject = fakeSolution.FakeProjectToReturnFromGetProject;
			fakeActionRunner = viewModel.FakeActionRunner;
			fakePackageManagementEvents = viewModel.FakePackageManagementEvents;
		}
		void CreateViewModel()
		{
			viewModel = new TestableUpdatedPackageViewModel();
			fakeSolution = viewModel.FakeSolution;
			fakeProject = fakeSolution.FakeActiveProject;
			updatePackageAction = fakeProject.FakeUpdatePackageAction;
			fakeActionRunner = viewModel.FakeActionRunner;
		}
		public TestableProcessPackageAction(
			FakePackageManagementProject project,
			FakePackageManagementEvents packageManagementEvents)
			: base(project, packageManagementEvents)
		{
			FakeProject = project;
			FakePackageManagementEvents = packageManagementEvents;
			this.Package = FakePackage;
		}
		public FakePackageManagementProjectFactory()
		{
			CreatePackageManagementProject = (sourceRepository, project) => {
				RepositoriesPassedToCreateProject.Add(sourceRepository);
				ProjectsPassedToCreateProject.Add(project);
				
				var fakeProject = new FakePackageManagementProject();
				FakeProjectsCreated.Add(fakeProject);
				return fakeProject;
			};
		}
Ejemplo n.º 14
0
		public void Execute_MethodCalled_RunPackageScriptsActionCreatedUsingProject()
		{
			CreateAction();
			var expectedProject = new FakePackageManagementProject();
			action.Project = expectedProject;
			action.PackageScriptRunner = new FakePackageScriptRunner();
			action.Execute();
			
			var actualProject = action.ProjectPassedToCreateRunPackageScriptsAction;
			
			Assert.AreEqual(expectedProject, actualProject);
		}
		void CreateAction()
		{
			fakeProject = new FakePackageManagementProject();
			fakeScriptFactory = new FakePackageScriptFactory();
			fakeScriptRunner = new FakePackageScriptRunner();
			globalMSBuildProjectCollection = MockRepository.GenerateStub<IGlobalMSBuildProjectCollection>();
			action = new RunPackageScriptsAction(
				fakeProject,
				fakeScriptRunner,
				fakeScriptFactory,
				globalMSBuildProjectCollection);
		}
		void CreateCmdletWithoutActiveProject()
		{
			cmdlet = new TestableUpdatePackageCmdlet();
			fakeTerminatingError = cmdlet.FakeCmdletTerminatingError;
			fakeConsoleHost = cmdlet.FakePackageManagementConsoleHost;
			fakeSolution = fakeConsoleHost.FakeSolution;
			fakeProject = fakeConsoleHost.FakeProject;
			fakeUpdateActionsFactory = cmdlet.FakeUpdatePackageActionsFactory;
			fakeUpdateAllPackagesInProject = fakeUpdateActionsFactory.FakeUpdateAllPackagesInProject;
			fakeUpdateAllPackagesInSolution = fakeUpdateActionsFactory.FakeUpdateAllPackagesInSolution;
			fakeUpdatePackageInAllProjects = fakeUpdateActionsFactory.FakeUpdatePackageInAllProjects;
		}
        public void Execute_PackageInstallDirectoryIsSet_ProjectSessionVariableIsSet()
        {
            CreateScript();
            var expectedProject = new TestableDTEProject();
            var project = new FakePackageManagementProject();
            project.DTEProject = expectedProject;
            script.Project = project;
            ExecuteScript();

            var projectVariable = fakeSession.VariablesAdded["__project"];

            Assert.AreEqual(expectedProject, projectVariable);
        }
Ejemplo n.º 18
0
        public virtual IPackageManagementProject GetProject(IPackageRepository sourceRepository, IProject project)
        {
            RepositoryPassedToGetProject = sourceRepository;
            ProjectPassedToGetProject    = project;
            ProjectsPassedToGetProject.Add(project);
            FakePackageManagementProject fakeProject = null;

            if (FakeProjectsToReturnFromGetProject.TryGetValue(project.Name, out fakeProject))
            {
                return(fakeProject);
            }
            return(FakeProjectToReturnFromGetProject);
        }
        void CreateScript()
        {
            fakeFileSystem = new FakeFileSystem();
            fakeFileSystem.FileExistsReturnValue = true;
            fakeFileSystem.DirectoryExistsReturnValue = true;
            scriptFileName = new PackageUninstallScriptFileName(fakeFileSystem);

            fakeSession = new FakePackageScriptSession();
            fakePackage = new FakePackage();

            fakeProject = new FakePackageManagementProject();

            script = new PackageUninstallScript(fakePackage, scriptFileName);
            script.Project = fakeProject;
        }
        public void GetInstalledPackages_PackageInstalledInProjectAndProjectIsSelected_ReturnsPackageInstalledInProject()
        {
            CreateFakeSolution();
            List<IProject> projectsAddedToSolution = AddSolutionWithTwoProjectsToProjectService();
            fakeSolution.FakeActiveMSBuildProject = projectsAddedToSolution[0];
            fakeSolution.FakeActiveMSBuildProject.Name = "MyProject";

            var package = new FakePackage("Test");
            var project = new FakePackageManagementProject("MyProject");
            project.FakePackages.Add(package);
            fakeSolution.FakeProjectsToReturnFromGetProject.Add("MyProject", project);
            CreateSelectedProjects();

            var repository = new FakePackageRepository();
            IQueryable<IPackage> packages = selectedProjects.GetPackages(repository);

            var expectedPackages = new FakePackage[] {
                package
            };

            PackageCollectionAssert.AreEqual(expectedPackages, packages);
        }
 static FakePackage ProjectHasPackageInstalled(FakePackageManagementProject project, string packageId, string version)
 {
     FakePackage package = project.FakeLocalRepository.AddFakePackageWithVersion(packageId, version);
     project.FakePackages.Add(package);
     return package;
 }
		public void NoProjectsSelected()
		{
			FakeActiveProject = null;
			FakeActiveMSBuildProject = null;
		}
        public void IsProjectEnabled_PackageIdNotInstalledInProject_ReturnsFalse()
        {
            CreateFakeSolution();
            CreateSelectedProjects();

            var oldPackage = new FakePackage("Foo", "1.0");
            var newPackage = new FakePackage("Bar", "1.3");

            var project = new FakePackageManagementProject();
            project.FakePackages.Add(oldPackage);

            bool enabled = selectedProjects.CallIsProjectEnabled(project, newPackage);

            Assert.IsFalse(enabled);
        }
        public void IsProjectSelected_PackageSameVersionAsPackageIntalledInProject_ReturnsFalse()
        {
            CreateFakeSolution();
            CreateSelectedProjects();

            var oldPackage = new FakePackage("Test", "1.0");
            var newPackage = new FakePackage("Test", "1.0");

            var project = new FakePackageManagementProject();
            project.FakePackages.Add(newPackage);

            bool selected = selectedProjects.CallIsProjectSelected(project, oldPackage);

            Assert.IsFalse(selected);
        }
        public void IsProjectEnabled_PackageNewerThanPackageIntalledInProject_ReturnsTrue()
        {
            CreateFakeSolution();
            CreateSelectedProjects();

            var oldPackage = new FakePackage("Test", "1.0");
            var newPackage = new FakePackage("Test", "1.3");

            var project = new FakePackageManagementProject();
            project.FakePackages.Add(oldPackage);

            bool enabled = selectedProjects.CallIsProjectEnabled(project, newPackage);

            Assert.IsTrue(enabled);
        }
Ejemplo n.º 26
0
		void CreateAction()
		{
			action = new TestableProcessPackageAction();
			fakeProject = action.FakeProject;
		}
        void CreateAction(string packageId = "MyPackage", string packageVersion = "1.2.3.4")
        {
            project = new FakePackageManagementProject();
            project.AddFakeInstallOperation();

            packageManagementEvents = new PackageManagementEvents();

            action = new ReinstallPackageAction(project, packageManagementEvents);
            action.PackageId = packageId;
            action.PackageVersion = new SemanticVersion(packageVersion);
        }
		public FakePackageManagementProject AddFakeProjectToReturnFromGetProject(string name)
		{
			var project = new FakePackageManagementProject(name);
			FakeProjectsToReturnFromGetProject.Add(name, project);
			return project;
		}
Ejemplo n.º 29
0
 public void NoProjectsSelected()
 {
     FakeActiveProject        = null;
     FakeActiveMSBuildProject = null;
 }
		public FakePackageManagementProject AddFakeProject(string projectName)
		{
			var project = new FakePackageManagementProject(projectName);
			FakeProjects.Add(project);
			return project;
		}
Ejemplo n.º 31
0
 void CreateProject()
 {
     project = new FakePackageManagementProject();
 }
Ejemplo n.º 32
0
		public FakeUpdatePackageAction(IPackageManagementProject project)
			: base(project, null)
		{
			FakeProject = project as FakePackageManagementProject;
		}
 public FakeUpdatePackageAction(IPackageManagementProject project)
     : base(project, null)
 {
     FakeProject = project as FakePackageManagementProject;
 }