Skip to content

Commit

Permalink
change the way it ensures something is not mandatory
Browse files Browse the repository at this point in the history
  • Loading branch information
potatoqualitee committed Oct 17, 2024
1 parent 94ed0b1 commit 9f6819d
Show file tree
Hide file tree
Showing 330 changed files with 3,250 additions and 3,250 deletions.
24 changes: 12 additions & 12 deletions tests/Add-DbaAgDatabase.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,40 +12,40 @@ Describe "Add-DbaAgDatabase" {
$CommandUnderTest = Get-Command Add-DbaAgDatabase
}
It "Should have SqlInstance as a non-mandatory parameter of type DbaInstanceParameter" {
$CommandUnderTest | Should -HaveParameter SqlInstance -Type DbaInstanceParameter -Not -Mandatory
$CommandUnderTest | Should -HaveParameter SqlInstance -Type DbaInstanceParameter -Mandatory:$false
}
It "Should have SqlCredential as a non-mandatory parameter of type PSCredential" {
$CommandUnderTest | Should -HaveParameter SqlCredential -Type PSCredential -Not -Mandatory
$CommandUnderTest | Should -HaveParameter SqlCredential -Type PSCredential -Mandatory:$false
}
It "Should have AvailabilityGroup as a non-mandatory parameter of type String" {
$CommandUnderTest | Should -HaveParameter AvailabilityGroup -Type String -Not -Mandatory
$CommandUnderTest | Should -HaveParameter AvailabilityGroup -Type String -Mandatory:$false
}
It "Should have Database as a non-mandatory parameter of type String[]" {
$CommandUnderTest | Should -HaveParameter Database -Type String[] -Not -Mandatory
$CommandUnderTest | Should -HaveParameter Database -Type String[] -Mandatory:$false
}
It "Should have Secondary as a non-mandatory parameter of type DbaInstanceParameter[]" {
$CommandUnderTest | Should -HaveParameter Secondary -Type DbaInstanceParameter[] -Not -Mandatory
$CommandUnderTest | Should -HaveParameter Secondary -Type DbaInstanceParameter[] -Mandatory:$false
}
It "Should have SecondarySqlCredential as a non-mandatory parameter of type PSCredential" {
$CommandUnderTest | Should -HaveParameter SecondarySqlCredential -Type PSCredential -Not -Mandatory
$CommandUnderTest | Should -HaveParameter SecondarySqlCredential -Type PSCredential -Mandatory:$false
}
It "Should have InputObject as a non-mandatory parameter of type Database[]" {
$CommandUnderTest | Should -HaveParameter InputObject -Type Database[] -Not -Mandatory
$CommandUnderTest | Should -HaveParameter InputObject -Type Database[] -Mandatory:$false
}
It "Should have SeedingMode as a non-mandatory parameter of type String" {
$CommandUnderTest | Should -HaveParameter SeedingMode -Type String -Not -Mandatory
$CommandUnderTest | Should -HaveParameter SeedingMode -Type String -Mandatory:$false
}
It "Should have SharedPath as a non-mandatory parameter of type String" {
$CommandUnderTest | Should -HaveParameter SharedPath -Type String -Not -Mandatory
$CommandUnderTest | Should -HaveParameter SharedPath -Type String -Mandatory:$false
}
It "Should have UseLastBackup as a non-mandatory switch parameter" {
$CommandUnderTest | Should -HaveParameter UseLastBackup -Type Switch -Not -Mandatory
$CommandUnderTest | Should -HaveParameter UseLastBackup -Type Switch -Mandatory:$false
}
It "Should have AdvancedBackupParams as a non-mandatory parameter of type Hashtable" {
$CommandUnderTest | Should -HaveParameter AdvancedBackupParams -Type Hashtable -Not -Mandatory
$CommandUnderTest | Should -HaveParameter AdvancedBackupParams -Type Hashtable -Mandatory:$false
}
It "Should have EnableException as a non-mandatory switch parameter" {
$CommandUnderTest | Should -HaveParameter EnableException -Type Switch -Not -Mandatory
$CommandUnderTest | Should -HaveParameter EnableException -Type Switch -Mandatory:$false
}
}

Expand Down
24 changes: 12 additions & 12 deletions tests/Add-DbaAgListener.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,40 +12,40 @@ Describe "Add-DbaAgListener" {
$CommandUnderTest = Get-Command Add-DbaAgListener
}
It "Should have SqlInstance as a non-mandatory parameter of type DbaInstanceParameter[]" {
$CommandUnderTest | Should -HaveParameter SqlInstance -Type DbaInstanceParameter[] -Not -Mandatory
$CommandUnderTest | Should -HaveParameter SqlInstance -Type DbaInstanceParameter[] -Mandatory:$false
}
It "Should have SqlCredential as a non-mandatory parameter of type PSCredential" {
$CommandUnderTest | Should -HaveParameter SqlCredential -Type PSCredential -Not -Mandatory
$CommandUnderTest | Should -HaveParameter SqlCredential -Type PSCredential -Mandatory:$false
}
It "Should have AvailabilityGroup as a non-mandatory parameter of type String[]" {
$CommandUnderTest | Should -HaveParameter AvailabilityGroup -Type String[] -Not -Mandatory
$CommandUnderTest | Should -HaveParameter AvailabilityGroup -Type String[] -Mandatory:$false
}
It "Should have Name as a non-mandatory parameter of type String" {
$CommandUnderTest | Should -HaveParameter Name -Type String -Not -Mandatory
$CommandUnderTest | Should -HaveParameter Name -Type String -Mandatory:$false
}
It "Should have IPAddress as a non-mandatory parameter of type IPAddress[]" {
$CommandUnderTest | Should -HaveParameter IPAddress -Type IPAddress[] -Not -Mandatory
$CommandUnderTest | Should -HaveParameter IPAddress -Type IPAddress[] -Mandatory:$false
}
It "Should have SubnetIP as a non-mandatory parameter of type IPAddress[]" {
$CommandUnderTest | Should -HaveParameter SubnetIP -Type IPAddress[] -Not -Mandatory
$CommandUnderTest | Should -HaveParameter SubnetIP -Type IPAddress[] -Mandatory:$false
}
It "Should have SubnetMask as a non-mandatory parameter of type IPAddress[]" {
$CommandUnderTest | Should -HaveParameter SubnetMask -Type IPAddress[] -Not -Mandatory
$CommandUnderTest | Should -HaveParameter SubnetMask -Type IPAddress[] -Mandatory:$false
}
It "Should have Port as a non-mandatory parameter of type Int32" {
$CommandUnderTest | Should -HaveParameter Port -Type Int32 -Not -Mandatory
$CommandUnderTest | Should -HaveParameter Port -Type Int32 -Mandatory:$false
}
It "Should have Dhcp as a non-mandatory switch parameter" {
$CommandUnderTest | Should -HaveParameter Dhcp -Type Switch -Not -Mandatory
$CommandUnderTest | Should -HaveParameter Dhcp -Type Switch -Mandatory:$false
}
It "Should have Passthru as a non-mandatory switch parameter" {
$CommandUnderTest | Should -HaveParameter Passthru -Type Switch -Not -Mandatory
$CommandUnderTest | Should -HaveParameter Passthru -Type Switch -Mandatory:$false
}
It "Should have InputObject as a non-mandatory parameter of type AvailabilityGroup[]" {
$CommandUnderTest | Should -HaveParameter InputObject -Type AvailabilityGroup[] -Not -Mandatory
$CommandUnderTest | Should -HaveParameter InputObject -Type AvailabilityGroup[] -Mandatory:$false
}
It "Should have EnableException as a non-mandatory switch parameter" {
$CommandUnderTest | Should -HaveParameter EnableException -Type Switch -Not -Mandatory
$CommandUnderTest | Should -HaveParameter EnableException -Type Switch -Mandatory:$false
}
}

Expand Down
14 changes: 7 additions & 7 deletions tests/Add-DbaExtendedProperty.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@ Describe "Add-DbaExtendedProperty" {
$CommandUnderTest = Get-Command Add-DbaExtendedProperty
}
It "Should have SqlInstance as a parameter" {
$CommandUnderTest | Should -HaveParameter SqlInstance -Type DbaInstanceParameter[] -Not -Mandatory
$CommandUnderTest | Should -HaveParameter SqlInstance -Type DbaInstanceParameter[] -Mandatory:$false
}
It "Should have SqlCredential as a parameter" {
$CommandUnderTest | Should -HaveParameter SqlCredential -Type PSCredential -Not -Mandatory
$CommandUnderTest | Should -HaveParameter SqlCredential -Type PSCredential -Mandatory:$false
}
It "Should have Database as a parameter" {
$CommandUnderTest | Should -HaveParameter Database -Type String[] -Not -Mandatory
$CommandUnderTest | Should -HaveParameter Database -Type String[] -Mandatory:$false
}
It "Should have Name as a parameter" {
$CommandUnderTest | Should -HaveParameter Name -Type String -Not -Mandatory
$CommandUnderTest | Should -HaveParameter Name -Type String -Mandatory:$false
}
It "Should have Value as a parameter" {
$CommandUnderTest | Should -HaveParameter Value -Type String -Not -Mandatory
$CommandUnderTest | Should -HaveParameter Value -Type String -Mandatory:$false
}
It "Should have InputObject as a parameter" {
$CommandUnderTest | Should -HaveParameter InputObject -Type PSObject[] -Not -Mandatory
$CommandUnderTest | Should -HaveParameter InputObject -Type PSObject[] -Mandatory:$false
}
It "Should have EnableException as a parameter" {
$CommandUnderTest | Should -HaveParameter EnableException -Type Switch -Not -Mandatory
$CommandUnderTest | Should -HaveParameter EnableException -Type Switch -Mandatory:$false
}
}

Expand Down
14 changes: 7 additions & 7 deletions tests/Add-DbaPfDataCollectorCounter.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@ Describe "Add-DbaPfDataCollectorCounter" {
$CommandUnderTest = Get-Command Add-DbaPfDataCollectorCounter
}
It "Should have ComputerName as a non-mandatory DbaInstanceParameter[] parameter" {
$CommandUnderTest | Should -HaveParameter ComputerName -Type DbaInstanceParameter[] -Not -Mandatory
$CommandUnderTest | Should -HaveParameter ComputerName -Type DbaInstanceParameter[] -Mandatory:$false
}
It "Should have Credential as a non-mandatory PSCredential parameter" {
$CommandUnderTest | Should -HaveParameter Credential -Type PSCredential -Not -Mandatory
$CommandUnderTest | Should -HaveParameter Credential -Type PSCredential -Mandatory:$false
}
It "Should have CollectorSet as a non-mandatory String[] parameter" {
$CommandUnderTest | Should -HaveParameter CollectorSet -Type String[] -Not -Mandatory
$CommandUnderTest | Should -HaveParameter CollectorSet -Type String[] -Mandatory:$false
}
It "Should have Collector as a non-mandatory String[] parameter" {
$CommandUnderTest | Should -HaveParameter Collector -Type String[] -Not -Mandatory
$CommandUnderTest | Should -HaveParameter Collector -Type String[] -Mandatory:$false
}
It "Should have Counter as a non-mandatory Object[] parameter" {
$CommandUnderTest | Should -HaveParameter Counter -Type Object[] -Not -Mandatory
$CommandUnderTest | Should -HaveParameter Counter -Type Object[] -Mandatory:$false
}
It "Should have InputObject as a non-mandatory Object[] parameter" {
$CommandUnderTest | Should -HaveParameter InputObject -Type Object[] -Not -Mandatory
$CommandUnderTest | Should -HaveParameter InputObject -Type Object[] -Mandatory:$false
}
It "Should have EnableException as a non-mandatory Switch" {
$CommandUnderTest | Should -HaveParameter EnableException -Type Switch -Not -Mandatory
$CommandUnderTest | Should -HaveParameter EnableException -Type Switch -Mandatory:$false
}
}
}
Expand Down
26 changes: 13 additions & 13 deletions tests/Add-DbaRegServer.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,43 +6,43 @@ Describe "Add-DbaRegServer" {
$CommandUnderTest = Get-Command Add-DbaRegServer
}
It "Should have SqlInstance as a non-mandatory parameter of type DbaInstanceParameter[]" {
$CommandUnderTest | Should -HaveParameter SqlInstance -Type DbaInstanceParameter[] -Not -Mandatory
$CommandUnderTest | Should -HaveParameter SqlInstance -Type DbaInstanceParameter[] -Mandatory:$false
}
It "Should have SqlCredential as a non-mandatory parameter of type PSCredential" {
$CommandUnderTest | Should -HaveParameter SqlCredential -Type PSCredential -Not -Mandatory
$CommandUnderTest | Should -HaveParameter SqlCredential -Type PSCredential -Mandatory:$false
}
It "Should have ServerName as a non-mandatory parameter of type String" {
$CommandUnderTest | Should -HaveParameter ServerName -Type String -Not -Mandatory
$CommandUnderTest | Should -HaveParameter ServerName -Type String -Mandatory:$false
}
It "Should have Name as a non-mandatory parameter of type String" {
$CommandUnderTest | Should -HaveParameter Name -Type String -Not -Mandatory
$CommandUnderTest | Should -HaveParameter Name -Type String -Mandatory:$false
}
It "Should have Description as a non-mandatory parameter of type String" {
$CommandUnderTest | Should -HaveParameter Description -Type String -Not -Mandatory
$CommandUnderTest | Should -HaveParameter Description -Type String -Mandatory:$false
}
It "Should have Group as a non-mandatory parameter of type Object" {
$CommandUnderTest | Should -HaveParameter Group -Type Object -Not -Mandatory
$CommandUnderTest | Should -HaveParameter Group -Type Object -Mandatory:$false
}
It "Should have ActiveDirectoryTenant as a non-mandatory parameter of type String" {
$CommandUnderTest | Should -HaveParameter ActiveDirectoryTenant -Type String -Not -Mandatory
$CommandUnderTest | Should -HaveParameter ActiveDirectoryTenant -Type String -Mandatory:$false
}
It "Should have ActiveDirectoryUserId as a non-mandatory parameter of type String" {
$CommandUnderTest | Should -HaveParameter ActiveDirectoryUserId -Type String -Not -Mandatory
$CommandUnderTest | Should -HaveParameter ActiveDirectoryUserId -Type String -Mandatory:$false
}
It "Should have ConnectionString as a non-mandatory parameter of type String" {
$CommandUnderTest | Should -HaveParameter ConnectionString -Type String -Not -Mandatory
$CommandUnderTest | Should -HaveParameter ConnectionString -Type String -Mandatory:$false
}
It "Should have OtherParams as a non-mandatory parameter of type String" {
$CommandUnderTest | Should -HaveParameter OtherParams -Type String -Not -Mandatory
$CommandUnderTest | Should -HaveParameter OtherParams -Type String -Mandatory:$false
}
It "Should have InputObject as a non-mandatory parameter of type ServerGroup[]" {
$CommandUnderTest | Should -HaveParameter InputObject -Type ServerGroup[] -Not -Mandatory
$CommandUnderTest | Should -HaveParameter InputObject -Type ServerGroup[] -Mandatory:$false
}
It "Should have ServerObject as a non-mandatory parameter of type Server[]" {
$CommandUnderTest | Should -HaveParameter ServerObject -Type Server[] -Not -Mandatory
$CommandUnderTest | Should -HaveParameter ServerObject -Type Server[] -Mandatory:$false
}
It "Should have EnableException as a non-mandatory switch parameter" {
$CommandUnderTest | Should -HaveParameter EnableException -Type Switch -Not -Mandatory
$CommandUnderTest | Should -HaveParameter EnableException -Type Switch -Mandatory:$false
}
}

Expand Down
12 changes: 6 additions & 6 deletions tests/Backup-DbaComputerCertificate.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@ Describe "Backup-DbaComputerCertificate" {
$CommandUnderTest = Get-Command Backup-DbaComputerCertificate
}
It "Should have SecurePassword as a non-mandatory SecureString parameter" {
$CommandUnderTest | Should -HaveParameter SecurePassword -Type SecureString -Not -Mandatory
$CommandUnderTest | Should -HaveParameter SecurePassword -Type SecureString -Mandatory:$false
}
It "Should have InputObject as a non-mandatory Object[] parameter" {
$CommandUnderTest | Should -HaveParameter InputObject -Type Object[] -Not -Mandatory
$CommandUnderTest | Should -HaveParameter InputObject -Type Object[] -Mandatory:$false
}
It "Should have Path as a non-mandatory String parameter" {
$CommandUnderTest | Should -HaveParameter Path -Type String -Not -Mandatory
$CommandUnderTest | Should -HaveParameter Path -Type String -Mandatory:$false
}
It "Should have FilePath as a non-mandatory String parameter" {
$CommandUnderTest | Should -HaveParameter FilePath -Type String -Not -Mandatory
$CommandUnderTest | Should -HaveParameter FilePath -Type String -Mandatory:$false
}
It "Should have Type as a non-mandatory String parameter" {
$CommandUnderTest | Should -HaveParameter Type -Type String -Not -Mandatory
$CommandUnderTest | Should -HaveParameter Type -Type String -Mandatory:$false
}
It "Should have EnableException as a non-mandatory Switch" {
$CommandUnderTest | Should -HaveParameter EnableException -Type Switch -Not -Mandatory
$CommandUnderTest | Should -HaveParameter EnableException -Type Switch -Mandatory:$false
}
}

Expand Down
Loading

0 comments on commit 9f6819d

Please sign in to comment.