Unify pester test syntax for the arguments of -BeOfType (#11558)

This commit is contained in:
xtqqczze
2020-01-24 11:00:37 -08:00
committed by Dongbo Wang
parent a7a2b12336
commit 920b671fb4
68 changed files with 216 additions and 216 deletions
@@ -293,7 +293,7 @@ Describe "Import-Module should be case insensitive" -Tags 'CI' {
Set-Content -Path "$modulesPath/$modulePath/TESTMODULE.psm1" -Value "function mytest { 'hello' }"
Import-Module testMODULE
$m = Get-Module TESTmodule
$m | Should -BeOfType "System.Management.Automation.PSModuleInfo"
$m | Should -BeOfType System.Management.Automation.PSModuleInfo
$m.Name | Should -BeIn "TESTMODULE"
mytest | Should -BeExactly "hello"
Remove-Module TestModule
@@ -9,11 +9,11 @@ Describe "Job Cmdlet Tests" -Tag "CI" {
Get-Job | Remove-Job -Force
}
It "Start-Job produces a job object" {
$j | Should -BeOfType "System.Management.Automation.Job"
$j | Should -BeOfType System.Management.Automation.Job
$j.Name | Should -BeExactly "My Job"
}
It "Get-Job retrieves a job object" {
(Get-Job -Id $j.Id) | Should -BeOfType "System.Management.Automation.Job"
(Get-Job -Id $j.Id) | Should -BeOfType System.Management.Automation.Job
}
It "Get-Job retrieves an array of job objects" {
Start-Job -ScriptBlock { 2 * 2 }
@@ -21,7 +21,7 @@ Describe "Job Cmdlet Tests" -Tag "CI" {
$jobs.Count | Should -Be 2
foreach ($job in $jobs)
{
$job | Should -BeOfType "System.Management.Automation.Job"
$job | Should -BeOfType System.Management.Automation.Job
}
}
It "Remove-Job can remove a job" {
@@ -630,7 +630,7 @@ namespace PowershellTestConfigNamespace
}
$resultContent = invoke-expression ($result)
$resultContent | Should -BeOfType "System.Collections.Hashtable"
$resultContent | Should -BeOfType System.Collections.Hashtable
# The default created hashtable in the session configuration file would have the
# following keys which we are validating below.
@@ -49,7 +49,7 @@ Describe "Remote module tests" -Tags 'Feature','RequireAdminOnWindows' {
}
$modules = Get-Module @parameters
$modules | Should -Not -BeNullOrEmpty
$modules[0] | Should -BeOfType "System.Management.Automation.PSModuleInfo"
$modules[0] | Should -BeOfType System.Management.Automation.PSModuleInfo
}
It "Get-Module can be called as an API with '<parameter>' = '<value>'" -TestCases @(
@@ -74,7 +74,7 @@ Describe "Remote module tests" -Tags 'Feature','RequireAdminOnWindows' {
$getModuleCommand = [Microsoft.PowerShell.Commands.GetModuleCommand]::new()
$getModuleCommand.$parameter = $value
if ($parameter -eq "FullyQualifiedName") {
$getModuleCommand.FullyQualifiedName | Should -BeOfType "Microsoft.PowerShell.Commands.ModuleSpecification"
$getModuleCommand.FullyQualifiedName | Should -BeOfType Microsoft.PowerShell.Commands.ModuleSpecification
$getModuleCommand.FullyQualifiedName.Name | Should -BeExactly "foo"
$getModuleCommand.FullyQualifiedName.Version | Should -Be "1.2.3"
} else {
@@ -73,7 +73,7 @@ Describe "Remote import-module tests" -Tags 'Feature','RequireAdminOnWindows' {
$importModuleCommand.$parameter = $value
if ($parameter -eq "FullyQualifiedName") {
$importModuleCommand.FullyQualifiedName.Count | Should -BeExactly 2
$importModuleCommand.FullyQualifiedName | Should -BeOfType "Microsoft.PowerShell.Commands.ModuleSpecification"
$importModuleCommand.FullyQualifiedName | Should -BeOfType Microsoft.PowerShell.Commands.ModuleSpecification
$importModuleCommand.FullyQualifiedName[0].Name | Should -BeExactly "foo"
$importModuleCommand.FullyQualifiedName[0].RequiredVersion | Should -Be "0.0"
$importModuleCommand.FullyQualifiedName[1].Name | Should -BeExactly "bar"