示例#1
0
        public void Test_NuGet_NugetPackage_GetPackageMetadataAsync()
        {
            NuGetPackage.NugetClient = new NuGetClient();

            NuGetPackage np = new NuGetPackage()
            {
                PackageId      = "Xamarin.AndroidX.Activity",
                VersionTextual = "1.1.0.4",
            };

            IEnumerable <IPackageSearchMetadata> result = null;

            result = np.GetPackageSearchMetadataAsync()
                     .Result;

            System.IO.Directory.CreateDirectory
            (
                $"nuget-client-api/NugetPackage/"
            );

            string timestamp = System.DateTime.Now.ToString("yyyyMMdd-HHmmssff");
            string json      = null;

            json = Newtonsoft.Json.JsonConvert.SerializeObject
                   (
                result,
                Newtonsoft.Json.Formatting.Indented
                   );
            System.IO.File.WriteAllText
            (
                $"nuget-client-api/NugetPackage/PackageSearchMetadata-{timestamp}.json",
                json
            );

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


            return;
        }