Update indent for Get-Variable Pester unit test

This commit is contained in:
JumpingYang001 2016-04-13 01:43:27 -07:00 committed by Andrew Schwartzmeyer
parent 191f232519
commit d0c759f10e

View File

@ -54,88 +54,88 @@ Describe "Get-Variable DRT Unit Tests" -Tags DRT{
Describe "Get-Variable" {
It "Should be able to call with no parameters without error" {
{ Get-Variable } | Should Not Throw
{ Get-Variable } | Should Not Throw
}
It "Should return environment variables when called with no parameters" {
(Get-Variable).Name -contains "$" | Should Be $true
(Get-Variable).Name -contains "?" | Should Be $true
(Get-Variable).Name -contains "HOST" | Should Be $true
(Get-Variable).Name -contains "PWD" | Should Be $true
(Get-Variable).Name -contains "PID" | Should Be $true
(Get-Variable).Name -contains "^" | Should Be $true
(Get-Variable).Name -contains "$" | Should Be $true
(Get-Variable).Name -contains "?" | Should Be $true
(Get-Variable).Name -contains "HOST" | Should Be $true
(Get-Variable).Name -contains "PWD" | Should Be $true
(Get-Variable).Name -contains "PID" | Should Be $true
(Get-Variable).Name -contains "^" | Should Be $true
}
It "Should return the value of an object" {
New-Variable -Name tempVar -Value 1
(Get-Variable tempVar).Value | Should Be (1)
New-Variable -Name tempVar -Value 1
(Get-Variable tempVar).Value | Should Be (1)
}
It "Should be able to call using the gv alias" {
(get-alias gv).Definition | Should be "Get-Variable"
(get-alias gv).Definition | Should be "Get-Variable"
}
It "Should be able to call using the Name switch" {
New-Variable -Name var1 -Value 4
New-Variable -Name var1 -Value 4
{ Get-Variable -Name var1 } | Should Not Throw
{ Get-Variable -Name var1 } | Should Not Throw
(Get-Variable -Name var1).Value | Should Be 4
(Get-Variable -Name var1).Value | Should Be 4
Remove-Variable var1
Remove-Variable var1
}
It "Should be able to use wildcard characters in the Name field" {
New-Variable -Name var1 -Value 4
New-Variable -Name var2 -Value "test"
New-Variable -Name var1 -Value 4
New-Variable -Name var2 -Value "test"
(Get-Variable -Name var*).Value[0] | Should be 4
(Get-Variable -Name var*).Value[1] | Should be "test"
(Get-Variable -Name var*).Value[0] | Should be 4
(Get-Variable -Name var*).Value[1] | Should be "test"
Remove-Variable var1
Remove-Variable var2
Remove-Variable var1
Remove-Variable var2
}
It "Should return only the value if the value switch is used" {
New-Variable -Name var1 -Value 4
New-Variable -Name var1 -Value 4
Get-Variable -Name var1 -ValueOnly | Should be 4
Get-Variable -Name var1 -ValueOnly | Should be 4
Remove-Variable var1
Remove-Variable var1
}
It "Should pipe string to the name field without the Name field being specified"{
New-Variable -Name var1 -Value 3
New-Variable -Name var1 -Value 3
("var1" | Get-Variable ).Value | Should Be 3
("var1" | Get-Variable ).Value | Should Be 3
Remove-Variable var1
Remove-Variable var1
}
It "Should be able to include a set of variables to get" {
New-Variable -Name var1 -Value 4
New-Variable -Name var2 -Value 2
New-Variable -Name var1 -Value 4
New-Variable -Name var2 -Value 2
$actual = Get-Variable -Include var1, var2
$actual = Get-Variable -Include var1, var2
$actual[0].Name | Should Be var1
$actual[1].Name | Should Be var2
$actual[0].Name | Should Be var1
$actual[1].Name | Should Be var2
$actual[0].Value | Should Be 4
$actual[1].Value | Should Be 2
$actual[0].Value | Should Be 4
$actual[1].Value | Should Be 2
Remove-Variable var1
Remove-Variable var2
Remove-Variable var1
Remove-Variable var2
}
It "Should be able to exclude a set of variables to get" {
New-Variable -Name var1 -Value 4
New-Variable -Name var2 -Value 2
New-Variable -Name var3 -Value "test"
New-Variable -Name var1 -Value 4
New-Variable -Name var2 -Value 2
New-Variable -Name var3 -Value "test"
$actual = Get-Variable -Exclude var1, var2
$actual = Get-Variable -Exclude var1, var2
$actual.Name -contains "var3" | Should Be $true
$actual.Name -contains "var3" | Should Be $true
}
Context "Scope Tests" {