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

22 lines
1009 B
PowerShell
Raw Normal View History

2015-10-30 17:10:19 -07:00
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
Describe "Get-Item" {
2015-07-15 10:15:39 -07:00
It "Should list all the items in the current working directory when asterisk is used" {
2016-02-05 08:53:44 -08:00
(Get-Item (Join-Path -Path $here -ChildPath "*")).GetType().BaseType | Should Be 'array'
(Get-Item (Join-Path -Path $here -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" {
2015-10-30 17:10:19 -07:00
(Get-Item $here).GetType().BaseType | Should Be 'System.IO.FileSystemInfo'
2016-01-15 14:31:52 -08:00
(Get-Item $here).Name | Should Be 'powershell'
2015-07-15 10:15:39 -07:00
}
It "Should return the proper Name and BaseType for directory objects vs file system objects" {
2015-10-30 17:10:19 -07:00
(Get-Item $here).GetType().Name | Should Be 'DirectoryInfo'
2016-02-05 08:53:44 -08:00
(Get-Item (Join-Path -Path $here -ChildPath Get-Item.Tests.ps1)).GetType().Name | Should Be 'FileInfo'
2015-07-15 10:15:39 -07:00
}
It "Should have mode flags set" {
2015-10-30 17:10:19 -07:00
ls $here | foreach-object { $_.Mode | Should Not BeNullOrEmpty }
}
}