コード例 #1
0
        private static ResolvedFile CreateResolvedFile(
            string packageId,
            string version,
            string filePath,
            string destinationSubDirectory,
            bool preserveStoreLayout,
            AssetType assetType)
        {
            string packageRoot;
            string packageDirectory = new MockPackageResolver()
                                      .GetPackageDirectory(packageId, NuGetVersion.Parse(version), out packageRoot);

            assetType.Should().NotBe(AssetType.None);

            string sourcepath            = Path.Combine(packageDirectory, filePath);
            string sourcedir             = Path.GetDirectoryName(sourcepath);
            string destinationSubDirPath = preserveStoreLayout ? sourcedir.Substring(packageRoot.Length) : destinationSubDirectory;

            if (!String.IsNullOrEmpty(destinationSubDirPath) && !destinationSubDirPath.EndsWith(Path.DirectorySeparatorChar))
            {
                destinationSubDirPath += Path.DirectorySeparatorChar;
            }

            return(new ResolvedFile(
                       sourcepath,
                       destinationSubDirPath,
                       new PackageIdentity(packageId, NuGetVersion.Parse(version)),
                       assetType));
        }
コード例 #2
0
        private static ResolvedFile CreateResolvedFile(
            string packageId,
            string version,
            string filePath,
            string destinationSubDirectory)
        {
            string packageDirectory = new MockPackageResolver()
                                      .GetPackageDirectory(packageId, NuGetVersion.Parse(version));

            return(new ResolvedFile(
                       Path.Combine(packageDirectory, filePath),
                       destinationSubDirectory));
        }
コード例 #3
0
        private ResolvePackageDependencies GetExecutedTask(LockFile lockFile)
        {
            var resolver = new MockPackageResolver(_packageRoot);

            var task = new ResolvePackageDependencies(lockFile, resolver)
            {
                ProjectAssetsFile = lockFile.Path,
                ProjectPath       = _projectPath,
                ProjectLanguage   = null
            };

            task.Execute().Should().BeTrue();

            return(task);
        }
コード例 #4
0
        private static ResolvePackageDependencies GetExecutedTask(LockFile lockFile, bool emitLegacyAssetsFileItems, string target)
        {
            var resolver = new MockPackageResolver(_packageRoot);

            var task = new ResolvePackageDependencies(lockFile, resolver)
            {
                ProjectAssetsFile         = lockFile.Path,
                ProjectPath               = _projectPath,
                ProjectLanguage           = null,
                EmitLegacyAssetsFileItems = emitLegacyAssetsFileItems,
                TargetFrameworkMoniker    = target
            };

            task.Execute().Should().BeTrue();

            return(task);
        }
コード例 #5
0
        private static ResolvedFile CreateResolvedFile(
            string packageId,
            string version,
            string filePath,
            string destinationSubDirectory,
            bool preserveCacheLayout,
            AssetType assetType)
        {
            string packageRoot;
            string packageDirectory = new MockPackageResolver()
                                      .GetPackageDirectory(packageId, NuGetVersion.Parse(version), out packageRoot);

            assetType.Should().NotBe(AssetType.None);

            string sourcepath            = Path.Combine(packageDirectory, filePath);
            string sourcedir             = Path.GetDirectoryName(sourcepath);
            string destinationSubDirPath = preserveCacheLayout ? sourcedir.Substring(packageRoot.Length): destinationSubDirectory;

            return(new ResolvedFile(
                       sourcepath,
                       destinationSubDirPath,
                       assetType));
        }