Example #1
0
        public void AddPackageAddsFileToFileSystem()
        {
            // Arrange
            var mockFileSystem = new MockProjectSystem();
            var repository     = new LocalPackageRepository(new DefaultPackagePathResolver(mockFileSystem),
                                                            mockFileSystem);
            IPackage package = PackageUtility.CreatePackage("A", "1.0");

            // Act
            repository.AddPackage(package);

            // Assert
            Assert.True(mockFileSystem.FileExists(@"A.1.0\A.1.0.nupkg"));
        }
        public void AddPackageAddsFileToFileSystem()
        {
            // Arrange
            var mockFileSystem = new MockProjectSystem();
            var repository = new LocalPackageRepository(new DefaultPackagePathResolver(mockFileSystem),
                                                        mockFileSystem);
            IPackage package = PackageUtility.CreatePackage("A", "1.0");

            // Act
            repository.AddPackage(package);

            // Assert
            Assert.IsTrue(mockFileSystem.FileExists(@"A.1.0\A.1.0.nupkg"));
        }
Example #3
0
        private static void DownloadPackage(IPackage package, string fullPathToDownloadTo, PackageDownloader directDownloader)
        {
            Log.VerboseFormat("Found package {0} v{1}", package.Id, package.Version);
            Log.Verbose("Downloading to: " + fullPathToDownloadTo);

            if (package is DataServicePackage dsp && directDownloader != null)
            {
                Log.Verbose("A direct download is possible; bypassing the NuGet machine cache");
                using (var targetFile = new FileStream(fullPathToDownloadTo, FileMode.CreateNew))
                    directDownloader.DownloadPackage(dsp.DownloadUrl, dsp, targetFile);
                return;
            }

            var physical = new PhysicalFileSystem(Path.GetDirectoryName(fullPathToDownloadTo));
            var local    = new LocalPackageRepository(new FixedFilePathResolver(package.Id, fullPathToDownloadTo), physical);

            local.AddPackage(package);
        }
Example #4
0
 public void Push(string zipPackagePath)
 {
     _repo.AddPackage(new ZipPackage(zipPackagePath));
 }