void CreateAction(string projectName = "MyProject", params ProjectReference[] projectReferences)
        {
            project      = new FakeDotNetProject(@"d:\projects\MyProject\MyProject.csproj");
            project.Name = projectName;
            project.References.AddRange(projectReferences);
            solutionManager = new FakeSolutionManager();
            nugetProject    = new FakeNuGetProject(project);
            solutionManager.NuGetProjects[project] = nugetProject;

            var metadataResourceProvider = new FakePackageMetadataResourceProvider();

            packageMetadataResource = metadataResourceProvider.PackageMetadataResource;
            var source    = new PackageSource("http://test.com");
            var providers = new INuGetResourceProvider[] {
                metadataResourceProvider
            };
            var sourceRepository = new SourceRepository(source, providers);

            primaryRepositories = new [] {
                sourceRepository
            }.ToList();
            solutionManager.SourceRepositoryProvider.Repositories.AddRange(primaryRepositories);

            action = new TestableUpdateAllNuGetPackagesInProjectAction(
                solutionManager,
                project);

            packageManager          = action.PackageManager;
            packageManagementEvents = action.PackageManagementEvents;
            fileRemover             = action.FileRemover;
            restoreManager          = action.RestoreManager;
        }
Example #2
0
        void CreateAction(
            string packageId = "Test",
            string version   = "2.1")
        {
            project         = new FakeDotNetProject(@"d:\projects\MyProject\MyProject.csproj");
            solutionManager = new FakeSolutionManager();
            nugetProject    = new FakeNuGetProject(project);
            solutionManager.NuGetProjects[project] = nugetProject;

            var metadataResourceProvider = new FakePackageMetadataResourceProvider();

            packageMetadataResource = metadataResourceProvider.PackageMetadataResource;
            var source    = new PackageSource("http://test.com");
            var providers = new INuGetResourceProvider[] {
                metadataResourceProvider
            };
            var sourceRepository = new SourceRepository(source, providers);

            primaryRepositories = new [] {
                sourceRepository
            }.ToList();

            action = new TestableInstallNuGetPackageAction(
                primaryRepositories,
                solutionManager,
                project);

            packageManager          = action.PackageManager;
            packageManagementEvents = action.PackageManagementEvents;
            fileRemover             = action.FileRemover;

            action.PackageId = packageId;
            action.Version   = new NuGetVersion(version);
        }
Example #3
0
        void CreateAction(
            string packageId = "Test",
            string version   = "2.1")
        {
            project         = new FakeDotNetProject(@"d:\projects\MyProject\MyProject.csproj");
            solutionManager = new FakeSolutionManager();
            nugetProject    = new FakeNuGetProject(project);
            solutionManager.NuGetProjects[project] = nugetProject;

            var repositoryProvider = solutionManager.SourceRepositoryProvider;
            var source             = new PackageSource("http://test.com");

            repositoryProvider.AddRepository(source);
            primaryRepositories = repositoryProvider.Repositories;

            action = new TestableReinstallNuGetPackageAction(
                project,
                solutionManager);

            packageManagementEvents = action.PackageManagementEvents;
            fileRemover             = action.FileRemover;

            action.PackageId = packageId;
            action.Version   = new NuGetVersion(version);

            uninstallPackageManager = action.UninstallAction.PackageManager;
            installPackageManager   = action.InstallAction.PackageManager;
        }
Example #4
0
 void CreateSolution()
 {
     packageManagementEvents = new PackageManagementEvents();
     fakeProject             = new FakePackageManagementProject();
     fileRemover             = new FakeFileRemover();
     action = new TestableUpdatePackageAction(fakeProject, packageManagementEvents, fileRemover);
     updatePackageHelper = new UpdatePackageHelper(action);
 }
Example #5
0
 void CreateAction()
 {
     packageManagementEvents = new PackageManagementEvents();
     fakeProject             = new FakePackageManagementProject();
     fileRemover             = new FakeFileRemover();
     action = new TestableInstallPackageAction(fakeProject, packageManagementEvents, fileRemover);
     installPackageHelper = new InstallPackageHelper(action);
 }
Example #6
0
        void CreateAction(string packageId = "MyPackage", string packageVersion = "1.2.3.4")
        {
            project = new FakePackageManagementProject();
            project.AddFakeInstallOperation();

            packageManagementEvents = new PackageManagementEvents();

            fileRemover = new FakeFileRemover();

            action                = new ReinstallPackageAction(project, packageManagementEvents, fileRemover);
            action.PackageId      = packageId;
            action.PackageVersion = new SemanticVersion(packageVersion);
        }
Example #7
0
        void CreateAction(
            List <FakeDotNetProject> projects,
            List <SourceRepository> secondarySources = null)
        {
            solutionManager = new FakeSolutionManager();
            foreach (var currentProject in projects)
            {
                project      = currentProject;
                nugetProject = new FakeNuGetProject(currentProject);
                solutionManager.NuGetProjects [project] = nugetProject;
            }

            var metadataResourceProvider = new FakePackageMetadataResourceProvider();

            packageMetadataResource = metadataResourceProvider.PackageMetadataResource;
            var source    = new PackageSource("http://test.com");
            var providers = new INuGetResourceProvider [] {
                metadataResourceProvider
            };
            var sourceRepository = new SourceRepository(source, providers);

            primaryRepositories = new [] {
                sourceRepository
            }.ToList();

            solutionManager.SourceRepositoryProvider.Repositories.AddRange(secondarySources ?? primaryRepositories);

            action = new TestableUpdateMultipleNuGetPackagesAction(
                primaryRepositories,
                solutionManager);

            foreach (var currentProject in projects)
            {
                action.AddProject(currentProject);
            }

            packageManager          = action.PackageManager;
            packageManagementEvents = action.PackageManagementEvents;
            fileRemover             = action.FileRemover;
            restoreManager          = action.RestoreManager;
        }