diff --git a/tests/Export-DbatoolsConfig.Tests.ps1 b/tests/Export-DbatoolsConfig.Tests.ps1 new file mode 100644 index 0000000000..ce8056cb4e --- /dev/null +++ b/tests/Export-DbatoolsConfig.Tests.ps1 @@ -0,0 +1,19 @@ +$CommandName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +Write-Host -Object "Running $PSCommandPath" -ForegroundColor Cyan +. "$PSScriptRoot\constants.ps1" + +Describe "$CommandName Unit Tests" -Tag 'UnitTests' { + Context "Validate parameters" { + [object[]]$params = (Get-Command $CommandName).Parameters.Keys | Where-Object {$_ -notin ('whatif', 'confirm')} + [object[]]$knownParameters = 'FullName', 'Module', 'Name', 'Config', 'ModuleName', 'ModuleVersion', 'Scope', 'OutPath', 'SkipUnchanged', 'EnableException' + $knownParameters += [System.Management.Automation.PSCmdlet]::CommonParameters + It "Should only contain our specific parameters" { + (@(Compare-Object -ReferenceObject ($knownParameters | Where-Object {$_}) -DifferenceObject $params).Count ) | Should Be 0 + } + } +} +<# + Integration test are custom to the command you are writing for. + Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests + for more guidence +#> \ No newline at end of file diff --git a/tests/Import-DbatoolsConfig.Tests.ps1 b/tests/Import-DbatoolsConfig.Tests.ps1 new file mode 100644 index 0000000000..41253efd7f --- /dev/null +++ b/tests/Import-DbatoolsConfig.Tests.ps1 @@ -0,0 +1,19 @@ +$CommandName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +Write-Host -Object "Running $PSCommandPath" -ForegroundColor Cyan +. "$PSScriptRoot\constants.ps1" + +Describe "$CommandName Unit Tests" -Tag 'UnitTests' { + Context "Validate parameters" { + [object[]]$params = (Get-Command $CommandName).Parameters.Keys | Where-Object {$_ -notin ('whatif', 'confirm')} + [object[]]$knownParameters = 'Path', 'ModuleName', 'ModuleVersion', 'Scope', 'IncludeFilter', 'ExcludeFilter', 'Peek', 'EnableException' + $knownParameters += [System.Management.Automation.PSCmdlet]::CommonParameters + It "Should only contain our specific parameters" { + (@(Compare-Object -ReferenceObject ($knownParameters | Where-Object {$_}) -DifferenceObject $params).Count ) | Should Be 0 + } + } +} +<# + Integration test are custom to the command you are writing for. + Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests + for more guidence +#> \ No newline at end of file diff --git a/tests/Invoke-DbaAgFailover.Tests.ps1 b/tests/Invoke-DbaAgFailover.Tests.ps1 new file mode 100644 index 0000000000..0634ae2f69 --- /dev/null +++ b/tests/Invoke-DbaAgFailover.Tests.ps1 @@ -0,0 +1,19 @@ +$CommandName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +Write-Host -Object "Running $PSCommandPath" -ForegroundColor Cyan +. "$PSScriptRoot\constants.ps1" + +Describe "$CommandName Unit Tests" -Tag 'UnitTests' { + Context "Validate parameters" { + [object[]]$params = (Get-Command $CommandName).Parameters.Keys | Where-Object {$_ -notin ('whatif', 'confirm')} + [object[]]$knownParameters = 'SqlInstance', 'SqlCredential', 'AvailabilityGroup', 'InputObject', 'Force', 'EnableException' + $knownParameters += [System.Management.Automation.PSCmdlet]::CommonParameters + It "Should only contain our specific parameters" { + (@(Compare-Object -ReferenceObject ($knownParameters | Where-Object {$_}) -DifferenceObject $params).Count ) | Should Be 0 + } + } +} +<# + Integration test are custom to the command you are writing for. + Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests + for more guidence +#> \ No newline at end of file diff --git a/tests/Join-DbaAvailabilityGroup.Tests.ps1 b/tests/Join-DbaAvailabilityGroup.Tests.ps1 new file mode 100644 index 0000000000..4581d22614 --- /dev/null +++ b/tests/Join-DbaAvailabilityGroup.Tests.ps1 @@ -0,0 +1,19 @@ +$CommandName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +Write-Host -Object "Running $PSCommandPath" -ForegroundColor Cyan +. "$PSScriptRoot\constants.ps1" + +Describe "$CommandName Unit Tests" -Tag 'UnitTests' { + Context "Validate parameters" { + [object[]]$params = (Get-Command $CommandName).Parameters.Keys | Where-Object {$_ -notin ('whatif', 'confirm')} + [object[]]$knownParameters = 'SqlInstance', 'SqlCredential', 'AvailabilityGroup', 'ClusterType', 'InputObject', 'EnableException' + $knownParameters += [System.Management.Automation.PSCmdlet]::CommonParameters + It "Should only contain our specific parameters" { + (@(Compare-Object -ReferenceObject ($knownParameters | Where-Object {$_}) -DifferenceObject $params).Count ) | Should Be 0 + } + } +} +<# + Integration test are custom to the command you are writing for. + Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests + for more guidence +#> \ No newline at end of file diff --git a/tests/Remove-DbaDbBackupRestoreHistory.Tests.ps1 b/tests/Remove-DbaDbBackupRestoreHistory.Tests.ps1 new file mode 100644 index 0000000000..00fa67bbba --- /dev/null +++ b/tests/Remove-DbaDbBackupRestoreHistory.Tests.ps1 @@ -0,0 +1,19 @@ +$CommandName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +Write-Host -Object "Running $PSCommandPath" -ForegroundColor Cyan +. "$PSScriptRoot\constants.ps1" + +Describe "$CommandName Unit Tests" -Tag 'UnitTests' { + Context "Validate parameters" { + [object[]]$params = (Get-Command $CommandName).Parameters.Keys | Where-Object {$_ -notin ('whatif', 'confirm')} + [object[]]$knownParameters = 'SqlInstance', 'SqlCredential', 'KeepDays', 'Database', 'InputObject', 'EnableException' + $knownParameters += [System.Management.Automation.PSCmdlet]::CommonParameters + It "Should only contain our specific parameters" { + (@(Compare-Object -ReferenceObject ($knownParameters | Where-Object {$_}) -DifferenceObject $params).Count ) | Should Be 0 + } + } +} +<# + Integration test are custom to the command you are writing for. + Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests + for more guidence +#> \ No newline at end of file diff --git a/tests/Reset-DbatoolsConfig.Tests.ps1 b/tests/Reset-DbatoolsConfig.Tests.ps1 new file mode 100644 index 0000000000..2d8047c7a3 --- /dev/null +++ b/tests/Reset-DbatoolsConfig.Tests.ps1 @@ -0,0 +1,19 @@ +$CommandName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +Write-Host -Object "Running $PSCommandPath" -ForegroundColor Cyan +. "$PSScriptRoot\constants.ps1" + +Describe "$CommandName Unit Tests" -Tag 'UnitTests' { + Context "Validate parameters" { + [object[]]$params = (Get-Command $CommandName).Parameters.Keys | Where-Object {$_ -notin ('whatif', 'confirm')} + [object[]]$knownParameters = 'ConfigurationItem', 'FullName', 'Module', 'Name', 'EnableException' + $knownParameters += [System.Management.Automation.PSCmdlet]::CommonParameters + It "Should only contain our specific parameters" { + (@(Compare-Object -ReferenceObject ($knownParameters | Where-Object {$_}) -DifferenceObject $params).Count ) | Should Be 0 + } + } +} +<# + Integration test are custom to the command you are writing for. + Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests + for more guidence +#> \ No newline at end of file diff --git a/tests/Set-DbaDbCompatibility.Tests.ps1 b/tests/Set-DbaDbCompatibility.Tests.ps1 new file mode 100644 index 0000000000..c4d88cc487 --- /dev/null +++ b/tests/Set-DbaDbCompatibility.Tests.ps1 @@ -0,0 +1,19 @@ +$CommandName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +Write-Host -Object "Running $PSCommandPath" -ForegroundColor Cyan +. "$PSScriptRoot\constants.ps1" + +Describe "$CommandName Unit Tests" -Tag 'UnitTests' { + Context "Validate parameters" { + [object[]]$params = (Get-Command $CommandName).Parameters.Keys | Where-Object {$_ -notin ('whatif', 'confirm')} + [object[]]$knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'TargetCompatibility', 'InputObject', 'EnableException' + $knownParameters += [System.Management.Automation.PSCmdlet]::CommonParameters + It "Should only contain our specific parameters" { + (@(Compare-Object -ReferenceObject ($knownParameters | Where-Object {$_}) -DifferenceObject $params).Count ) | Should Be 0 + } + } +} +<# + Integration test are custom to the command you are writing for. + Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests + for more guidence +#> \ No newline at end of file diff --git a/tests/Sync-DbaAvailabilityGroup.Tests.ps1 b/tests/Sync-DbaAvailabilityGroup.Tests.ps1 new file mode 100644 index 0000000000..50e527cecc --- /dev/null +++ b/tests/Sync-DbaAvailabilityGroup.Tests.ps1 @@ -0,0 +1,19 @@ +$CommandName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +Write-Host -Object "Running $PSCommandPath" -ForegroundColor Cyan +. "$PSScriptRoot\constants.ps1" + +Describe "$CommandName Unit Tests" -Tag 'UnitTests' { + Context "Validate parameters" { + [object[]]$params = (Get-Command $CommandName).Parameters.Keys | Where-Object {$_ -notin ('whatif', 'confirm')} + [object[]]$knownParameters = 'Primary', 'PrimarySqlCredential', 'Secondary', 'SecondarySqlCredential', 'AvailabilityGroup', 'Exclude', 'Login', 'ExcludeLogin', 'Job', 'ExcludeJob', 'InputObject', 'Force', 'EnableException' + $knownParameters += [System.Management.Automation.PSCmdlet]::CommonParameters + It "Should only contain our specific parameters" { + (@(Compare-Object -ReferenceObject ($knownParameters | Where-Object {$_}) -DifferenceObject $params).Count ) | Should Be 0 + } + } +} +<# + Integration test are custom to the command you are writing for. + Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests + for more guidence +#> \ No newline at end of file diff --git a/tests/Unregister-DbatoolsConfig.Tests.ps1 b/tests/Unregister-DbatoolsConfig.Tests.ps1 new file mode 100644 index 0000000000..3848d27959 --- /dev/null +++ b/tests/Unregister-DbatoolsConfig.Tests.ps1 @@ -0,0 +1,19 @@ +$CommandName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +Write-Host -Object "Running $PSCommandPath" -ForegroundColor Cyan +. "$PSScriptRoot\constants.ps1" + +Describe "$CommandName Unit Tests" -Tag 'UnitTests' { + Context "Validate parameters" { + [object[]]$params = (Get-Command $CommandName).Parameters.Keys | Where-Object {$_ -notin ('whatif', 'confirm')} + [object[]]$knownParameters = 'ConfigurationItem', 'FullName', 'Module', 'Name', 'Scope' + $knownParameters += [System.Management.Automation.PSCmdlet]::CommonParameters + It "Should only contain our specific parameters" { + (@(Compare-Object -ReferenceObject ($knownParameters | Where-Object {$_}) -DifferenceObject $params).Count ) | Should Be 0 + } + } +} +<# + Integration test are custom to the command you are writing for. + Read https://github.com/sqlcollaborative/dbatools/blob/development/contributing.md#tests + for more guidence +#> \ No newline at end of file