change: Get-Action Testing

This commit is contained in:
DrIOS
2024-07-07 11:58:16 -05:00
parent ff1162f962
commit fcaebf1db1

View File

@@ -11,6 +11,12 @@ function Get-Action {
[ValidateSet("Admin", "Delegate", "Owner")]
[string]$ActionType,
[Parameter(Position = 2, Mandatory = $true, ParameterSetName = "ConvertActions")]
[Parameter(Position = 2, Mandatory = $true, ParameterSetName = "ReverseActions")]
[Parameter(Position = 1, Mandatory = $true, ParameterSetName = "GetDictionaries")]
[ValidateSet("6.1.2", "6.1.3")]
[string]$Version = "6.1.2",
[Parameter(Position = 0, ParameterSetName = "ReverseActions")]
[string[]]$AbbreviatedActions,
@@ -20,6 +26,52 @@ function Get-Action {
)
$Dictionary = @{
"6.1.2" = @{
AdminActions = @{
ApplyRecord = 'AR'
Copy = 'CP'
Create = 'CR'
FolderBind = 'FB'
HardDelete = 'HD'
Move = 'MV'
MoveToDeletedItems = 'MTDI'
SendAs = 'SA'
SendOnBehalf = 'SOB'
SoftDelete = 'SD'
Update = 'UP'
UpdateCalendarDelegation = 'UCD'
UpdateFolderPermissions = 'UFP'
UpdateInboxRules = 'UIR'
}
DelegateActions = @{
ApplyRecord = 'AR'
Create = 'CR'
FolderBind = 'FB'
HardDelete = 'HD'
Move = 'MV'
MoveToDeletedItems = 'MTDI'
SendAs = 'SA'
SendOnBehalf = 'SOB'
SoftDelete = 'SD'
Update = 'UP'
UpdateFolderPermissions = 'UFP'
UpdateInboxRules = 'UIR'
}
OwnerActions = @{
ApplyRecord = 'AR'
Create = 'CR'
HardDelete = 'HD'
MailboxLogin = 'ML'
Move = 'MV'
MoveToDeletedItems = 'MTDI'
SoftDelete = 'SD'
Update = 'UP'
UpdateCalendarDelegation = 'UCD'
UpdateFolderPermissions = 'UFP'
UpdateInboxRules = 'UIR'
}
}
"6.1.3" = @{
AdminActions = @{
ApplyRecord = 'AR'
Copy = 'CP'
@@ -69,13 +121,15 @@ function Get-Action {
UpdateInboxRules = 'UIR'
}
}
}
switch ($PSCmdlet.ParameterSetName) {
"GetDictionaries" {
return $Dictionary
return $Dictionary[$Version]
}
"ConvertActions" {
try {
$Dictionary = $Dictionary[$Version]
$actionDictionary = switch ($ActionType) {
"Admin" { $Dictionary.AdminActions }
"Delegate" { $Dictionary.DelegateActions }
@@ -97,6 +151,7 @@ function Get-Action {
}
"ReverseActions" {
try {
$Dictionary = $Dictionary[$Version]
$reverseDictionary = @{}
$originalDictionary = switch ($ReverseActionType) {
"Admin" { $Dictionary.AdminActions }