Exemple #1
0
        public NugetAnalyzedPackage AnalyzePackage(string xml, Dictionary <string, INugetPackage> packagesOnConfig, params string[] relativePaths)
        {
            var nugetPackage = new NugetPackage()
            {
                Id = "TestPkg", Version = "1.999"
            };

            var paths = new List <RelativePath>();

            paths.Add(RelativePath.Create(m_context.StringTable, nugetPackage.Id + ".nuspec"));
            foreach (var relativePath in relativePaths)
            {
                paths.Add(RelativePath.Create(m_context.StringTable, relativePath));
            }

            var packageOnDisk = new PackageOnDisk(
                m_context.PathTable,
                nugetPackage,
                PackageDownloadResult.FromRemote(
                    new PackageIdentity("nuget", nugetPackage.Id, nugetPackage.Version, nugetPackage.Alias),
                    AbsolutePath.Create(m_context.PathTable, A("X", "Pkgs", "TestPkg", "1.999", "TestPkg.nuspec")),
                    paths));

            return(NugetAnalyzedPackage.TryAnalyzeNugetPackage(m_context, m_monikers, XDocument.Parse(xml), packageOnDisk, packagesOnConfig, false));
        }
Exemple #2
0
        public NugetAnalyzedPackage AnalyzePackageStub(Dictionary <string, INugetPackage> packagesOnConfig)
        {
            var nugetPackage = new NugetPackage()
            {
                Id = "TestPkgStub", Version = "1.999"
            };
            var packageOnDisk = new PackageOnDisk(
                m_context.PathTable,
                nugetPackage,
                PackageDownloadResult.EmptyStub(
                    "testPackageStubHash",
                    new PackageIdentity("nuget", nugetPackage.Id, nugetPackage.Version, nugetPackage.Alias),
                    packageFolder: AbsolutePath.Create(m_context.PathTable, X("/X/Pkgs/TestPkgStub/1.999"))));

            return(NugetAnalyzedPackage.TryAnalyzeNugetPackage(m_context, m_monikers, nuSpec: null, packageOnDisk, packagesOnConfig, false));
        }