11[Diagnostics.CodeAnalysis.SuppressMessageAttribute (' PSUseDeclaredVarsMoreThanAssignments' , ' ' , Justification= ' PSSA does not understand Pester scopes well' )]
2- [Diagnostics.CodeAnalysis.SuppressMessageAttribute (' PSUseCmdletCorrectly' , ' ' , Justification= ' PSSA does not like explicitly using InputObject' )]
32param ()
43
54BeforeAll {
@@ -20,7 +19,7 @@ Describe 'basic package search operations' {
2019 Find-Package - Name $package | Where-Object {$_.Name -contains $package } | Should -Not - BeNullOrEmpty
2120 }
2221 It ' searches for all versions of a package' {
23- Find-Package - Name $package - Version $ ([ NuGet.Versioning.VersionRange ] ' [0,]' ) | Where-Object {$_.Name -contains $package } | Should -Not - BeNullOrEmpty
22+ Find-Package - Name $package - Version ' [0,]' | Where-Object {$_.Name -contains $package } | Should -Not - BeNullOrEmpty
2423 }
2524 It ' searches for the latest version of a package with a wildcard pattern' {
2625 Find-Package - Name " $package *" | Where-Object {$_.Name -contains $package } | Should -Not - BeNullOrEmpty
@@ -35,7 +34,7 @@ Describe 'pipeline-based package installation and uninstallation' {
3534 }
3635
3736 It ' searches for and silently installs the latest version of a package' {
38- Find-Package - Name $package | ForEach-Object { Install-Package - PassThru - InputObject $_ } | Where-Object {$_.Name -contains $package } | Should -Not - BeNullOrEmpty
37+ Find-Package - Name $package | Install-Package - PassThru | Where-Object {$_.Name -contains $package } | Should -Not - BeNullOrEmpty
3938 }
4039 It ' finds and silently uninstalls the locally installed package just installed' {
4140 Get-Package - Name $package | Uninstall-Package - PassThru | Where-Object {$_.Name -contains $package } | Should -Not - BeNullOrEmpty
@@ -48,7 +47,7 @@ Describe 'pipeline-based package installation and uninstallation' {
4847 }
4948
5049 It ' searches for and silently installs the latest version of a package' {
51- Find-Package - Name $package | ForEach-Object { Install-Package - PassThru - InputObject $_ } | Where-Object {$_.Name -contains $package } | Should -Not - BeNullOrEmpty
50+ Find-Package - Name $package | Install-Package - PassThru | Where-Object {$_.Name -contains $package } | Should -Not - BeNullOrEmpty
5251 }
5352 It ' finds and silently uninstalls the locally installed package just installed, along with its dependencies' {
5453 Get-Package - Name $package | Uninstall-Package - Provider Chocolatey - RemoveDependencies - PassThru | Should - HaveCount 3
@@ -64,7 +63,7 @@ Describe 'pipeline-based package installation and uninstallation' {
6463 }
6564
6665 It ' silently installs the latest version of a package with explicit parameters' {
67- Find-Package - Name $package | ForEach-Object { Install-Package - PassThru - InputObject $_ - Provider Chocolatey - ParamsGlobal - Parameters $parameters } | Where-Object {$_.Name -contains $package } | Should -Not - BeNullOrEmpty
66+ Find-Package - Name $package | Install-Package - PassThru - Provider Chocolatey - ParamsGlobal - Parameters $parameters | Where-Object {$_.Name -contains $package } | Should -Not - BeNullOrEmpty
6867 }
6968 It ' correctly passed parameters to the package' {
7069 Get-ChildItem - Path $installDir - ErrorAction SilentlyContinue | Should -Not - BeNullOrEmpty
@@ -95,7 +94,7 @@ Describe 'multi-source support' {
9594 Get-PackageSource | Where-Object {$_.Name -eq $altSource } | Should -Not - BeNullOrEmpty
9695 }
9796 It ' searches for and installs the latest version of a package from an alternate source' {
98- Find-Package - Name $package - source $altSource | ForEach-Object { Install-Package - PassThru - InputObject $_ } | Where-Object {$_.Name -contains $package } | Should -Not - BeNullOrEmpty
97+ Find-Package - Name $package - source $altSource | Install-Package - PassThru | Where-Object {$_.Name -contains $package } | Should -Not - BeNullOrEmpty
9998 }
10099 It ' finds and uninstalls a package installed from an alternate source' {
101100 Get-Package - Name $package | Uninstall-Package - PassThru | Where-Object {$_.Name -contains $package } | Should -Not - BeNullOrEmpty
@@ -118,7 +117,7 @@ Describe 'version filters' {
118117
119118 Context ' required version' {
120119 It ' searches for and silently installs a specific package version' {
121- Find-Package - Name $package - Version $ ([ NuGet.Versioning.VersionRange ] " [$version ]" ) | ForEach-Object { Install-Package - PassThru - InputObject $_ } | Where-Object {$_.Name -contains $package -And $_.Version -eq $version } | Should -Not - BeNullOrEmpty
120+ Find-Package - Name $package - Version " [$version ]" | Install-Package - PassThru | Where-Object {$_.Name -contains $package -And $_.Version -eq $version } | Should -Not - BeNullOrEmpty
122121 }
123122 It ' finds and silently uninstalls a specific package version' {
124123 Get-Package - Name $package - Version " [$version ]" | UnInstall-Package - PassThru | Where-Object {$_.Name -contains $package -And $_.Version -eq $version } | Should -Not - BeNullOrEmpty
@@ -127,7 +126,7 @@ Describe 'version filters' {
127126
128127 Context ' minimum version' {
129128 It ' searches for and silently installs a minimum package version' {
130- Find-Package - Name $package - Version $version | ForEach-Object { Install-Package - PassThru - InputObject $_ } | Where-Object {$_.Name -contains $package -And $_.Version -ge $version } | Should -Not - BeNullOrEmpty
129+ Find-Package - Name $package - Version $version | Install-Package - PassThru | Where-Object {$_.Name -contains $package -And $_.Version -ge $version } | Should -Not - BeNullOrEmpty
131130 }
132131 It ' finds and silently uninstalls a minimum package version' {
133132 Get-Package - Name $package - Version $version | UnInstall-Package - PassThru | Where-Object {$_.Name -contains $package -And $_.Version -ge $version } | Should -Not - BeNullOrEmpty
@@ -136,10 +135,10 @@ Describe 'version filters' {
136135
137136 Context ' maximum version' {
138137 It ' searches for and silently installs a maximum package version' {
139- Find-Package - Name $package - Version $ ([ NuGet.Versioning.VersionRange ] " [,$version ]" ) | ForEach-Object { Install-Package - PassThru - InputObject $_ } | Where-Object {$_.Name -contains $package -And $_.Version -le $version } | Should -Not - BeNullOrEmpty
138+ Find-Package - Name $package - Version " [,$version ]" | Install-Package - PassThru | Where-Object {$_.Name -contains $package -And $_.Version -le $version } | Should -Not - BeNullOrEmpty
140139 }
141140 It ' finds and silently uninstalls a maximum package version' {
142- Get-Package - Name $package - Version $ ([ NuGet.Versioning.VersionRange ] " [,$version ]" ) | UnInstall-Package - PassThru | Where-Object {$_.Name -contains $package -And $_.Version -le $version } | Should -Not - BeNullOrEmpty
141+ Get-Package - Name $package - Version " [,$version ]" | UnInstall-Package - PassThru | Where-Object {$_.Name -contains $package -And $_.Version -le $version } | Should -Not - BeNullOrEmpty
143142 }
144143 }
145144}
0 commit comments