Files
PowerShell/test/powershell/Modules/Microsoft.PowerShell.Management/Get-Item.Tests.ps1
T

20 lines
998 B
PowerShell
Raw Normal View History

2016-07-25 14:01:41 -07:00
Describe "Get-Item" -Tags "CI" {
2015-07-15 10:15:39 -07:00
It "Should list all the items in the current working directory when asterisk is used" {
(Get-Item (Join-Path -Path $PSScriptRoot -ChildPath "*")).GetType().BaseType | Should Be 'array'
(Get-Item (Join-Path -Path $PSScriptRoot -ChildPath "*")).GetType().Name | Should Be 'Object[]'
2015-07-15 10:15:39 -07:00
}
It "Should return the name of the current working directory when a dot is used" {
(Get-Item $PSScriptRoot).GetType().BaseType | Should Be 'System.IO.FileSystemInfo'
(Get-Item $PSScriptRoot).Name | Should Be (Split-Path $PSScriptRoot -Leaf)
2015-07-15 10:15:39 -07:00
}
It "Should return the proper Name and BaseType for directory objects vs file system objects" {
(Get-Item $PSScriptRoot).GetType().Name | Should Be 'DirectoryInfo'
(Get-Item (Join-Path -Path $PSScriptRoot -ChildPath Get-Item.Tests.ps1)).GetType().Name | Should Be 'FileInfo'
2015-07-15 10:15:39 -07:00
}
It "Should have mode flags set" {
2016-04-08 13:36:54 -07:00
Get-ChildItem $PSScriptRoot | foreach-object { $_.Mode | Should Not BeNullOrEmpty }
}
}