示例#1
0
        public async Task PackageMetadataReturnsOk()
        {
            var packages = await _client.GetPackageMetadataAsync("DefaultPackage");

            var package = Assert.Single(packages);

            Assert.Equal("DefaultPackage", package.PackageId);
            Assert.Equal("1.2.3", package.Version);
            Assert.Equal("Default package description", package.Description);
            Assert.Equal("Default package author", package.Authors);
            Assert.True(package.Listed);
        }
示例#2
0
        public async Task PackageMetadataReturnsOk()
        {
            await _factory.AddPackageAsync(_packageStream);

            var packages = await _client.GetPackageMetadataAsync("TestData");

            var package = Assert.Single(packages);

            Assert.Equal("TestData", package.PackageId);
            Assert.Equal("1.2.3", package.Version);
            Assert.Equal("Test description", package.Description);
            Assert.Equal("Test author", package.Authors);
            Assert.True(package.Listed);
        }
示例#3
0
        public void NuGetClient_Packages_PackageMetadata()
        {
            NuGetClient ngc = new NuGetClient();

            IEnumerable <IPackageSearchMetadata> package_metadata = null;

            package_metadata = ngc.GetPackageMetadataAsync
                               (
                "Xamarin.AndroidX.Core"
                               ).Result;

            #if MSTEST
            Assert.IsNotNull(package_metadata);
            #elif NUNIT
            Assert.NotNull(package_metadata);
            #elif XUNIT
            Assert.NotNull(package_metadata);
            #endif

            Console.WriteLine($"Package metadata...");
            foreach (IPackageSearchMetadata pm in package_metadata)
            {
                Console.WriteLine($"----------------------------------------------------------");
                Console.WriteLine($"Title   : {pm.Title}");
                Console.WriteLine($"Summary         : {pm.Summary}");
                Console.WriteLine($"Tags            : {pm.Tags}");
            }

            return;
        }
示例#4
0
        public async Task GetPackageMetadata()
        {
            // Find the metadata for a single version of a package.
            var client = new NuGetClient("https://api.nuget.org/v3/index.json");

            var packageId      = "Newtonsoft.Json";
            var packageVersion = new NuGetVersion("12.0.1");

            var registrationItem = await client.GetPackageMetadataAsync(packageId, packageVersion);

            Console.WriteLine($"Listed: {registrationItem.PackageMetadata.Listed}");
            Console.WriteLine($"Tags: {registrationItem.PackageMetadata.Tags}");
            Console.WriteLine($"Description: {registrationItem.PackageMetadata.Description}");
        }
示例#5
0
        public async Task GetAllPackageMetadata()
        {
            // Find the metadata for all versions of a package.
            var client = new NuGetClient("https://api.nuget.org/v3/index.json");

            var items = await client.GetPackageMetadataAsync("Newtonsoft.Json");

            if (!items.Any())
            {
                Console.WriteLine($"Package 'Newtonsoft.Json' does not exist");
                return;
            }

            // There is an item for each version of the package.
            foreach (var item in items)
            {
                Console.WriteLine($"Version: {item.PackageMetadata.Version}");
                Console.WriteLine($"Listed: {item.PackageMetadata.Listed}");
                Console.WriteLine($"Tags: {item.PackageMetadata.Tags}");
                Console.WriteLine($"Description: {item.PackageMetadata.Description}");
            }
        }