示例#1
0
        private void Can_Unpack_Internal(
            NuGetSolutionPackageService packagingService,
            Action <SolutionPackageBase> basePackageAction,
            Action <SolutionPackageBase, SolutionPackageBase> action)
        {
            var solutionPackage = CreateNewSolutionPackage(packagingService);

            if (basePackageAction != null)
            {
                basePackageAction(solutionPackage);
            }

            var nuGetPackage = packagingService.Pack(solutionPackage);

            Assert.IsNotNull(nuGetPackage);
            Assert.IsTrue(nuGetPackage.Length > 0);

            var filePath = GetTempNuGetFilePath();

            packagingService.PackToFile(solutionPackage, filePath);

            // unpacking and checking props
            using (var streamReader = File.OpenRead(filePath))
            {
                var unpackedSolutionPackage = packagingService.Unpack(streamReader) as SolutionPackageBase;
                action(solutionPackage, unpackedSolutionPackage);
            }
        }
示例#2
0
        protected virtual void PushPackageToCIRepository(
            SolutionPackageBase solutionPackage,
            List <SolutionPackageBase> solutionDependencies,
            NuGetSolutionPackageService packagingService,
            bool useLocal
            )
        {
            IPackageRepository repo = null;

            if (solutionDependencies != null)
            {
                foreach (var soutionDependency in solutionDependencies)
                {
                    if (useLocal)
                    {
                        var filePath = Path.Combine(LocalNuGetRepositoryFolderPath,
                                                    String.Format("{0}.{1}.nupkg", soutionDependency.Id, soutionDependency.Version));
                        packagingService.PackToFile(soutionDependency, filePath);
                    }
                    else
                    {
                        WithCINuGetContext((apiUrl, apiKey, repoUrl) =>
                        {
                            packagingService.Push(soutionDependency, apiUrl, apiKey);
                        });
                    }
                }
            }

            if (useLocal)
            {
                var filePath = Path.Combine(LocalNuGetRepositoryFolderPath,
                                            String.Format("{0}.{1}.nupkg", solutionPackage.Id, solutionPackage.Version));
                packagingService.PackToFile(solutionPackage, filePath);
            }
            else
            {
                WithCINuGetContext((apiUrl, apiKey, repoUrl) =>
                {
                    packagingService.Push(solutionPackage, apiUrl, apiKey);
                });
            }
        }
示例#3
0
        private void Can_Pack_Internal(NuGetSolutionPackageService packagingService)
        {
            var solutionPackage = CreateNewSolutionPackage(packagingService);
            var nuGetPackage    = packagingService.Pack(solutionPackage);

            // mem stream
            Assert.IsNotNull(nuGetPackage);
            Assert.IsTrue(nuGetPackage.Length > 0);

            var filePath = GetTempNuGetFilePath();

            packagingService.PackToFile(solutionPackage, filePath);

            Assert.IsTrue(File.Exists(filePath));
        }