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));
        }
        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));
        }
        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);
        }
Beispiel #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);
        }
        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));
        }