diff --git a/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj b/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj index 013e0fe8ea..505b20f19f 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj +++ b/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj @@ -33,12 +33,10 @@ - - @@ -47,7 +45,6 @@ - diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Update-List.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Update-List.cs index 9ba6c89802..ceac0ad541 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Update-List.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Update-List.cs @@ -18,7 +18,7 @@ namespace Microsoft.PowerShell.Commands /// (multi-valued parameter for a cmdlet), without exposing the list. /// [Cmdlet(VerbsData.Update, "List", DefaultParameterSetName = "AddRemoveSet", - HelpUri = "https://go.microsoft.com/fwlink/?LinkID=113447", RemotingCapability = RemotingCapability.None)] + HelpUri = "https://go.microsoft.com/fwlink/?LinkID=2109383", RemotingCapability = RemotingCapability.None)] public class UpdateListCommand : PSCmdlet { /// diff --git a/src/Modules/Unix/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psd1 b/src/Modules/Unix/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psd1 index d6cf7978b1..da57841b21 100644 --- a/src/Modules/Unix/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psd1 +++ b/src/Modules/Unix/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psd1 @@ -25,7 +25,7 @@ CmdletsToExport = @( 'Get-TraceSource', 'Set-TraceSource', 'Add-Type', 'Get-TypeData', 'Remove-TypeData', 'Update-TypeData', 'Get-UICulture', 'Get-Unique', 'Get-Uptime', 'Clear-Variable', 'Get-Variable', 'New-Variable', 'Remove-Variable', 'Set-Variable', 'Get-Verb', 'Write-Verbose', 'Write-Warning', 'Invoke-WebRequest', - 'Format-Wide', 'ConvertTo-Xml', 'Select-Xml', 'Get-Error' + 'Format-Wide', 'ConvertTo-Xml', 'Select-Xml', 'Get-Error', 'Update-List' ) FunctionsToExport = @() AliasesToExport = @('fhx') diff --git a/src/Modules/Windows/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psd1 b/src/Modules/Windows/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psd1 index c2fb554824..3e7e474b59 100644 --- a/src/Modules/Windows/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psd1 +++ b/src/Modules/Windows/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psd1 @@ -23,7 +23,7 @@ CmdletsToExport = @( 'ConvertFrom-StringData', 'Format-Table', 'New-TemporaryFile', 'New-TimeSpan', 'Get-TraceSource', 'Set-TraceSource', 'Add-Type', 'Get-TypeData', 'Remove-TypeData', 'Update-TypeData', 'Get-UICulture', 'Get-Unique', 'Get-Uptime', 'Clear-Variable', 'Get-Variable', 'New-Variable', 'Remove-Variable', 'Set-Variable', 'Get-Verb', 'Write-Verbose', - 'Write-Warning', 'Invoke-WebRequest', 'Format-Wide', 'ConvertTo-Xml', 'Select-Xml', 'Get-Error' + 'Write-Warning', 'Invoke-WebRequest', 'Format-Wide', 'ConvertTo-Xml', 'Select-Xml', 'Get-Error', 'Update-List' ) FunctionsToExport = @() AliasesToExport = @('fhx') diff --git a/test/powershell/Modules/Microsoft.PowerShell.Utility/Update-List.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Utility/Update-List.Tests.ps1 new file mode 100644 index 0000000000..e79dcc7878 --- /dev/null +++ b/test/powershell/Modules/Microsoft.PowerShell.Utility/Update-List.Tests.ps1 @@ -0,0 +1,29 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +Describe "Update-List Tests" -Tag CI { + BeforeEach { + $testObj = [pscustomobject]@{a = [System.Collections.ArrayList]::new(@(1,2,3))} + } + + + It "-Add works" { + $testObj | Update-List -Property a -Add 4 + $testObj.A | Should -Be 1,2,3,4 + } + + It "-Remove works" { + Update-List -InputObject $testObj -Property a -Remove 2 + $testObj.A | Should -Be 1,3 + } + + It "-Add with -Remove works" { + $testObj | Update-List -Property a -Remove 2 -Add 4 + $testObj.A | Should -Be 1,3,4 + } + + It "-Replace works" { + $testObj | Update-List -Property a -Replace 2,4 + $testObj.A | Should -Be 2,4 + } +} diff --git a/test/powershell/engine/Basic/DefaultCommands.Tests.ps1 b/test/powershell/engine/Basic/DefaultCommands.Tests.ps1 index a576f3b642..33dbdafa9f 100644 --- a/test/powershell/engine/Basic/DefaultCommands.Tests.ps1 +++ b/test/powershell/engine/Basic/DefaultCommands.Tests.ps1 @@ -475,7 +475,7 @@ Describe "Verify approved aliases list" -Tags "CI" { "Cmdlet", "Unregister-PSSessionConfiguration","", $($FullCLR -or $CoreWindows ), "", "", "Low" "Cmdlet", "Update-FormatData", "", $($FullCLR -or $CoreWindows -or $CoreUnix), "", "", "Low" "Cmdlet", "Update-Help", "", $($FullCLR -or $CoreWindows -or $CoreUnix), "", "", "Medium" -"Cmdlet", "Update-List", "", $($FullCLR ), "", "", "" +"Cmdlet", "Update-List", "", $($FullCLR -or $CoreWindows -or $CoreUnix), "", "", "None" "Cmdlet", "Update-TypeData", "", $($FullCLR -or $CoreWindows -or $CoreUnix), "", "", "Low" "Cmdlet", "Use-Transaction", "", $($FullCLR ), "", "", "" "Cmdlet", "Wait-Debugger", "", $($FullCLR -or $CoreWindows -or $CoreUnix), "", "", "None" diff --git a/test/powershell/engine/Help/assets/HelpURI/V2Cmdlets.csv b/test/powershell/engine/Help/assets/HelpURI/V2Cmdlets.csv index d663fb8fcd..7545e9a7e6 100644 --- a/test/powershell/engine/Help/assets/HelpURI/V2Cmdlets.csv +++ b/test/powershell/engine/Help/assets/HelpURI/V2Cmdlets.csv @@ -227,7 +227,7 @@ Undo-Transaction,https://go.microsoft.com/fwlink/?LinkID=135268 Unregister-Event,https://go.microsoft.com/fwlink/?LinkID=135269 Unregister-PSSessionConfiguration,https://go.microsoft.com/fwlink/?LinkID=144308 Update-FormatData,https://go.microsoft.com/fwlink/?LinkID=113420 -Update-List,https://go.microsoft.com/fwlink/?LinkID=113447 +Update-List,https://go.microsoft.com/fwlink/?LinkID=2109383 Update-TypeData,https://go.microsoft.com/fwlink/?LinkID=113421 Use-Transaction,https://go.microsoft.com/fwlink/?LinkID=135271 Wait-Event,https://go.microsoft.com/fwlink/?LinkID=135276