File tree Expand file tree Collapse file tree
src/NuGet.Core/NuGet.CommandLine.XPlat/Commands/PackageReferenceCommands/ListPackage
test/NuGet.Core.Tests/NuGet.CommandLine.Xplat.Tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -406,7 +406,7 @@ private static IEnumerable<InstalledPackageReference> GetInstalledPackageReferen
406406 /// <param name="targetFrameworks">A <see cref="FrameworkPackages"/> per project target framework</param>
407407 /// <param name="listPackageArgs">List command args</param>
408408 /// <returns>A dictionary where the key is the package id, and the value is a list of <see cref="IPackageSearchMetadata"/>.</returns>
409- private async Task < Dictionary < string , List < IPackageSearchMetadata > > > GetPackageMetadataAsync (
409+ internal async Task < Dictionary < string , List < IPackageSearchMetadata > > > GetPackageMetadataAsync (
410410 List < FrameworkPackages > targetFrameworks ,
411411 ListPackageArgs listPackageArgs )
412412 {
Original file line number Diff line number Diff line change 55using System . Collections . Generic ;
66using System . IO ;
77using System . Linq ;
8- using System . Reflection ;
98using System . Text ;
109using System . Threading ;
1110using System . Threading . Tasks ;
@@ -403,18 +402,10 @@ public async Task GetPackageMetadataAsync_WithEmptyPackageSources_DoesNotThrowDi
403402
404403 var listPackageRunner = new ListPackageCommandRunner ( ) ;
405404
406- // Act & Assert - Test the private method using reflection
407- var getPackageMetadataAsyncMethod = typeof ( ListPackageCommandRunner )
408- . GetMethod ( "GetPackageMetadataAsync" , BindingFlags . NonPublic | BindingFlags . Instance ) ;
409-
410- Assert . NotNull ( getPackageMetadataAsyncMethod ) ;
411-
412- // This should not throw DivideByZeroException
405+ // Act & Assert - Call the method directly since it's now internal
413406 Exception exception = await Record . ExceptionAsync ( async ( ) =>
414407 {
415- var task = ( Task < Dictionary < string , List < IPackageSearchMetadata > > > ) getPackageMetadataAsyncMethod . Invoke (
416- listPackageRunner , new object [ ] { allPackages , listPackageArgs } ) ;
417- await task ;
408+ await listPackageRunner . GetPackageMetadataAsync ( allPackages , listPackageArgs ) ;
418409 } ) ;
419410
420411 Assert . Null ( exception ) ;
You can’t perform that action at this time.
0 commit comments