void CreateFactory() { options = new TestablePackageManagementOptions(); fakePackageRepositoryFactory = new FakePackageRepositoryFactory(); fakeProjectSystemFactory = new FakeProjectSystemFactory(); factory = new SharpDevelopPackageManagerFactory(fakePackageRepositoryFactory, fakeProjectSystemFactory, options); }
void AddNuGetPackageReference(IDotNetProject project,string packageId) { var packageRepoFactory = new SharpDevelopPackageRepositoryFactory(); var packageRepo = packageRepoFactory.CreateRepository ("http://www.nuget.org/api/v2/"); var packageManagementProjectFactory = new PackageManagementProjectFactory (PackageManagementServices.PackageManagementEvents); var packageManagementProject = packageManagementProjectFactory.CreateProject (packageRepo, project); var package = packageRepo.FindPackagesById (packageId).FirstOrDefault (x => x.IsLatestVersion); var packageManagerFactory = new SharpDevelopPackageManagerFactory (); var packageManager = packageManagerFactory.CreatePackageManager (packageRepo, project); packageManager.InstallPackage (package, false, false); packageManagementProject.AddPackageReference (package); }