public async Task It_installs_nuget_package()
        {
            var packageId      = "Humanizer";
            var packageVersion = "2.6.2";
            var logger         = new NuGetTestLogger();
            var installer      = new NuGetPackageInstaller(Directory.GetCurrentDirectory(), logger);
            var packagePath    = await installer.InstallPackageAsync(new PackageId(packageId), new NuGetVersion(packageVersion));

            logger.Errors.Should().Be(0);
            logger.Warnings.Should().Be(0);
            packagePath.Should().ContainEquivalentOf(packageId);
            packagePath.Should().Contain(packageVersion);
            File.Exists(packagePath).Should().BeTrue();
        }
Esempio n. 2
0
        public async Task It_extracts_nuget_package()
        {
            var packageId      = "Newtonsoft.Json";
            var packageVersion = "12.0.3";
            var logger         = new NuGetTestLogger();
            var installer      = new NuGetPackageDownloader(Directory.GetCurrentDirectory(), logger: logger);
            var packagePath    = await installer.DownloadPackageAsync(new PackageId(packageId), new NuGetVersion(packageVersion));

            var targetPath = Path.Combine(Directory.GetCurrentDirectory(), "ExtractedPackage");
            var result     = await installer.ExtractPackageAsync(packagePath, targetPath);

            Directory.Exists(targetPath).Should().BeTrue();
            var extractedFiles = Directory.GetFiles(targetPath, "*", SearchOption.AllDirectories);

            extractedFiles.Should().Contain(Path.Combine(targetPath, $"{packageId}.nuspec"));
            extractedFiles.Should().BeEquivalentTo(result);
        }