public void NuGetClient_Packages_Search() { NuGetClient.HttpClient = Tests.CommonShared.Http.Client; NuGetClient ngc = new NuGetClient(); IEnumerable <IPackageSearchMetadata> search = null; search = ngc.SearchPackagesByKeywordAsync ( "androidx", new global::NuGet.Protocol.Core.Types.SearchFilter ( includePrerelease: true ), skip: 0, take: 100, psm => { return ( psm.Description.Contains("car") || psm.Description.Contains("androidx.car") ); } ).Result; #if MSTEST Assert.IsNotNull(search); #elif NUNIT Assert.NotNull(search); #elif XUNIT Assert.NotNull(search); #endif Console.WriteLine($"Packages found..."); foreach (IPackageSearchMetadata pm in search) { Console.WriteLine($"----------------------------------------------------------"); Console.WriteLine($"Title : {pm.Title}"); Console.WriteLine($"Summary : {pm.Summary}"); Console.WriteLine($"Tags : {pm.Tags}"); } return; }
public void Test_Search(string search_term) { NuGetClient nc = new NuGetClient(); var results = nc.SearchPackagesByKeywordAsync(search_term).Result; string output = ""; foreach (IPackageSearchMetadata r in results) { output += $"Found package"; output += Environment.NewLine; output += $" Id = {r.Identity.Id}"; output += Environment.NewLine; output += $" Version = {r.Identity.Version}"; output += Environment.NewLine; output += $" Description = {r.Description}"; output += Environment.NewLine; output += $" Summary = {r.Summary}"; output += Environment.NewLine; output += $" Tags = {r.Tags}"; output += Environment.NewLine; output += $" DownloadCount = {r.DownloadCount}"; output += Environment.NewLine; output += $" Authors = {r.Authors}"; output += Environment.NewLine; output += $" Owners = {r.Owners}"; output += Environment.NewLine; output += $" DependencySets = {r.DependencySets.ToJson()}"; output += Environment.NewLine; output += $" IconUrl = {r.IconUrl}"; output += Environment.NewLine; } System.IO.File.WriteAllText($"{search_term}.txt", output); return; }