Example #1
0
        void CreateViewModel(
            FakePackageManagementSolution solution,
            IThreadSafePackageManagementEvents packageManagementEvents)
        {
            fakeTaskFactory = new FakeTaskFactory();
            fakeLicenseAcceptanceService = new FakeLicenseAcceptanceService();
            fakeSelectProjectsService    = new FakeSelectProjectsService();
            fakeFileConflictResolver     = MockRepository.GenerateStub <IFileConflictResolver>();
            userPrompts = new ManagePackagesUserPrompts(
                packageManagementEvents,
                fakeLicenseAcceptanceService,
                fakeSelectProjectsService,
                fakeFileConflictResolver);
            fakeActionRunner = new FakePackageActionRunner();

            packagesViewModels = new TestablePackagesViewModels(
                solution,
                fakeRegisteredPackageRepositories,
                packageManagementEvents,
                fakeActionRunner,
                fakeTaskFactory);

            viewTitle = new ManagePackagesViewTitle(solution);

            viewModel = new ManagePackagesViewModel(
                packagesViewModels,
                viewTitle,
                packageManagementEvents,
                userPrompts);
            fakeTaskFactory.ExecuteAllFakeTasks();
        }
 void CreateViewModel(FakePackageManagementSolution fakeSolution)
 {
     viewModel                   = new TestableUpdatedPackageViewModel(fakeSolution);
     fakeProject                 = fakeSolution.FakeProjectToReturnFromGetProject;
     fakeActionRunner            = viewModel.FakeActionRunner;
     fakePackageManagementEvents = viewModel.FakePackageManagementEvents;
 }
Example #3
0
 void CreateSolution()
 {
     packageManagerFactory  = new FakePackageManagerFactory();
     packageRepositoryCache = new FakePackageRepositoryFactory();
     packageEvents          = new PackageManagementEvents();
     solution = new FakePackageManagementSolution();
 }
 void CreateViewModel(FakePackageManagementSolution solution, FakeRegisteredPackageRepositories registeredPackageRepositories)
 {
     packageViewModelFactory = new FakePackageViewModelFactory {
         FakeSolution = solution
     };
     CreateViewModel(solution, registeredPackageRepositories, packageViewModelFactory);
 }
Example #5
0
        void CreateViewModel(FakePackageManagementSolution solution)
        {
            packageManagementEvents = new PackageManagementEvents();
            var threadSafeEvents = new ThreadSafePackageManagementEvents(packageManagementEvents, new FakePackageManagementWorkbench());

            CreateViewModel(fakeSolution, threadSafeEvents);
        }
 void CreateViewModel(FakePackageManagementSolution fakeSolution)
 {
     viewModelParent             = MockRepository.GenerateStub <IPackageViewModelParent>();
     viewModel                   = new TestableUpdatedPackageViewModel(viewModelParent, fakeSolution);
     fakeProject                 = fakeSolution.FakeProjectToReturnFromGetProject;
     fakeActionRunner            = viewModel.FakeActionRunner;
     fakePackageManagementEvents = viewModel.FakePackageManagementEvents;
 }
Example #7
0
 void CreateHost()
 {
     host             = new TestablePackageManagementConsoleHost();
     fakeSolution     = host.FakeSolution;
     scriptingConsole = host.FakeScriptingConsole;
     powerShellHost   = host.FakePowerShellHostFactory.FakePowerShellHost;
     fakeRegisteredPackageRepositories = host.FakeRegisteredPackageRepositories;
 }
        void CreateReinstaller()
        {
            solution         = new FakePackageManagementSolution();
            project          = solution.FakeActiveProject;
            backgroundRunner = new FakeBackgroundPackageActionRunner();

            reinstaller = new PackageReinstaller(solution, backgroundRunner);
        }
        void CreateUpdatePackageInAllProjects(string packageId, SemanticVersion version)
        {
            fakeSolution         = new FakePackageManagementSolution();
            fakeSourceRepository = new FakePackageRepository();
            var packageReference = new PackageReference(packageId, version, null);

            updatePackageInAllProjects = new UpdatePackageInAllProjects(packageReference, fakeSolution, fakeSourceRepository);
        }
Example #10
0
 void CreateViewModel()
 {
     viewModel                   = new TestableInstalledPackageViewModel();
     fakeSolution                = viewModel.FakeSolution;
     fakeActionRunner            = viewModel.FakeActionRunner;
     fakePackage                 = viewModel.FakePackage;
     fakePackageManagementEvents = viewModel.FakePackageManagementEvents;
 }
 void CreateCmdlet()
 {
     cmdlet = new TestableGetProjectCmdlet();
     fakeTerminatingError = cmdlet.FakeCmdletTerminatingError;
     fakeCommandRuntime   = cmdlet.FakeCommandRuntime;
     fakeConsoleHost      = cmdlet.FakePackageManagementConsoleHost;
     fakeSolution         = cmdlet.FakeSolution;
     defaultProject       = base.AddDefaultProjectToConsoleHost();
 }
 void CreateProvider()
 {
     fakeSolution = new FakePackageManagementSolution();
     fakeRegisteredRepositories = new FakeRegisteredPackageRepositories();
     fakePowerShellDetection    = new FakePowerShellDetection();
     provider = new PackageManagementConsoleHostProvider(
         fakeSolution,
         fakeRegisteredRepositories,
         fakePowerShellDetection);
 }
 public TestableUpdatedPackageViewModel(FakePackageManagementSolution solution)
     : this(
         new FakePackage(),
         new SelectedProjectsForUpdatedPackages(solution),
         new FakePackageManagementEvents(),
         new FakePackageActionRunner(),
         new FakeLogger())
 {
     this.FakeSolution = solution;
 }
 void CreateUpdatedPackagesInSolution()
 {
     solution = new FakePackageManagementSolution();
     registeredPackageRepositories = new FakeRegisteredPackageRepositories();
     packageManagementEvents       = new PackageManagementEvents();
     updatedPackagesInSolution     = new TestableUpdatedPackagesInSolution(
         solution,
         registeredPackageRepositories,
         packageManagementEvents);
 }
 void CreateViewModel(FakePackageManagementSolution solution)
 {
     viewModelParent            = CreateViewModelParent(solution);
     viewModel                  = new TestablePackageViewModel(viewModelParent, solution);
     fakePackage                = viewModel.FakePackage;
     this.fakeSolution          = solution;
     packageManagementEvents    = viewModel.PackageManagementEvents;
     fakeLogger                 = viewModel.FakeLogger;
     fakeUninstallPackageAction = solution.FakeProjectToReturnFromGetProject.FakeUninstallPackageAction;
 }
        void CreateViewModel()
        {
            IPackageViewModelParent parent = MockRepository.GenerateStub <IPackageViewModelParent>();

            viewModel                   = new TestableInstalledPackageViewModel(parent);
            fakeSolution                = viewModel.FakeSolution;
            fakeActionRunner            = viewModel.FakeActionRunner;
            fakePackage                 = viewModel.FakePackage;
            fakePackageManagementEvents = viewModel.FakePackageManagementEvents;
        }
Example #17
0
        void CreateCommandLineWithSolution(string fileName, MonoRuntimeInfo monoRuntimeInfo, bool isMonoRuntime)
        {
            var solution = new FakePackageManagementSolution();

            solution.FileName = fileName;
            commandLine       = new NuGetPackageRestoreCommandLine(
                solution,
                monoRuntimeInfo,
                isMonoRuntime);
        }
 public TestableInstalledPackageViewModel(FakePackageManagementSolution solution)
     : this(
         new FakePackage(),
         new SelectedProjectsForInstalledPackages(solution),
         new FakePackageManagementEvents(),
         new FakePackageActionRunner(),
         new FakeLogger())
 {
     this.FakeSolution = solution;
     solution.FakeActiveMSBuildProject = ProjectHelper.CreateTestProject("MyProject");
 }
Example #19
0
 public TestableGetProjectCmdlet(
     FakePackageManagementConsoleHost consoleHost,
     FakeCommandRuntime commandRuntime,
     FakeCmdletTerminatingError cmdletTerminatingError)
     : base(consoleHost, cmdletTerminatingError)
 {
     this.FakePackageManagementConsoleHost = consoleHost;
     this.FakeCommandRuntime         = commandRuntime;
     this.CommandRuntime             = commandRuntime;
     this.FakeCmdletTerminatingError = cmdletTerminatingError;
     this.FakeSolution = consoleHost.FakeSolution;
 }
        void CreateViewModel(FakePackageManagementSolution solution, FakeRegisteredPackageRepositories registeredPackageRepositories)
        {
            taskFactory = new FakeTaskFactory();
            var packageViewModelFactory        = new FakePackageViewModelFactory();
            var updatedPackageViewModelFactory = new UpdatedPackageViewModelFactory(packageViewModelFactory);

            viewModel = new UpdatedPackagesViewModel(
                solution,
                registeredPackageRepositories,
                updatedPackageViewModelFactory,
                taskFactory);
        }
Example #21
0
 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;
 }
        void CreateCmdlet()
        {
            cmdlet       = new TestableGetPackageCmdlet();
            fakeSolution = new FakePackageManagementSolution();
            fakeRegisteredPackageRepositories = cmdlet.FakeRegisteredPackageRepositories;
            fakeConsoleHost             = cmdlet.FakePackageManagementConsoleHost;
            fakeConsoleHost.FakeProject = fakeSolution.FakeActiveProject;
            fakeCommandRuntime          = cmdlet.FakeCommandRuntime;
            fakeTerminatingError        = cmdlet.FakeCmdletTerminatingError;

            AddDefaultProjectToConsoleHost();
        }
 public TestablePackageViewModel(
     IPackageViewModelParent parent,
     FakePackageManagementSolution solution)
     : this(
         parent,
         new FakePackage("Test"),
         new PackageManagementSelectedProjects(solution),
         new FakePackageManagementEvents(),
         new FakePackageActionRunner(),
         new FakeLogger())
 {
     this.FakeSolution = solution;
 }
        AvailablePackagesViewModel CreateViewModelParent(FakePackageManagementSolution solution)
        {
            var taskFactory = new FakeTaskFactory();
            var registeredPackageRepositories = new FakeRegisteredPackageRepositories();
            var packageViewModelFactory       = new FakePackageViewModelFactory();
            var recentPackageRepository       = new FakeRecentPackageRepository();

            return(new AvailablePackagesViewModel(
                       solution,
                       registeredPackageRepositories,
                       recentPackageRepository,
                       packageViewModelFactory,
                       taskFactory));
        }
 void CreateUpdatedPackagesInSolution()
 {
     solution = new FakePackageManagementSolution();
     registeredPackageRepositories = new FakeRegisteredPackageRepositories();
     packageManagementEvents       = new PackageManagementEvents();
     taskFactory = new FakeTaskFactory();
     taskFactory.RunTasksSynchronously = true;
     progressMonitorFactory            = new FakeProgressMonitorFactory();
     checkForUpdatesTaskRunner         = new TestableCheckForUpdatesTaskRunner(taskFactory);
     updatedPackagesInSolution         = new TestableUpdatedPackagesInSolution(
         solution,
         registeredPackageRepositories,
         packageManagementEvents,
         checkForUpdatesTaskRunner);
 }
 public TestablePackageManagementConsoleHost(
     FakePackageManagementSolution solution,
     FakeRegisteredPackageRepositories registeredPackageRepositories,
     FakeScriptingConsoleWithLinesToRead scriptingConsole,
     FakePowerShellHostFactory powerShellHostFactory,
     FakePackageManagementAddInPath addinPath)
     : base(solution, registeredPackageRepositories, powerShellHostFactory, addinPath)
 {
     this.FakeSolution                      = solution;
     this.FakeScriptingConsole              = scriptingConsole;
     this.ScriptingConsole                  = scriptingConsole;
     this.FakePowerShellHostFactory         = powerShellHostFactory;
     this.FakeRegisteredPackageRepositories = registeredPackageRepositories;
     this.FakePackageManagementAddInPath    = addinPath;
 }
 void CreateViewModel(
     FakePackageManagementSolution solution,
     FakeRegisteredPackageRepositories registeredPackageRepositories,
     FakePackageViewModelFactory packageViewModelFactory)
 {
     taskFactory = new FakeTaskFactory();
     this.packageViewModelFactory   = packageViewModelFactory;
     fakePackageManagementEvents    = packageViewModelFactory.FakePackageManagementEvents;
     updatedPackageViewModelFactory = new UpdatedPackageViewModelFactory(packageViewModelFactory);
     viewModel = new UpdatedPackagesViewModel(
         solution,
         registeredPackageRepositories,
         updatedPackageViewModelFactory,
         taskFactory);
 }
        void CreateViewModel(FakePackageManagementSolution solution)
        {
            registeredPackageRepositories = new FakeRegisteredPackageRepositories();
            var packageViewModelFactory          = new FakePackageViewModelFactory();
            var installedPackageViewModelFactory = new InstalledPackageViewModelFactory(packageViewModelFactory);

            taskFactory             = new FakeTaskFactory();
            packageManagementEvents = new PackageManagementEvents();

            viewModel = new InstalledPackagesViewModel(
                solution,
                packageManagementEvents,
                registeredPackageRepositories,
                installedPackageViewModelFactory,
                taskFactory);
        }
        void CreateRunner()
        {
            project      = new FakeDotNetProject(@"d:\projects\MyProject\MyProject.csproj");
            project.Name = "MyProject";
            project.TargetFrameworkMoniker = new TargetFrameworkMoniker("4.5");
            solution = new FakePackageManagementSolution();
            registeredRepositories  = new FakeRegisteredPackageRepositories();
            progressMonitorFactory  = new FakeProgressMonitorFactory();
            progressMonitor         = progressMonitorFactory.ProgressMonitor;
            packageManagementEvents = new PackageManagementEvents();

            repositoryFactoryEvents = new FakePackageRepositoryFactoryEvents();
            progressProvider        = new PackageManagementProgressProvider(repositoryFactoryEvents, handler => {
                handler.Invoke();
            });

            runner = new TestablePackageCompatibilityRunner(
                project,
                solution,
                registeredRepositories,
                progressMonitorFactory,
                packageManagementEvents,
                progressProvider);
        }
Example #30
0
 void CreateFakeSolution()
 {
     fakeSolution = new FakePackageManagementSolution();
 }