2016-03-04 23:48:30 +01:00
|
|
|
Describe "Get-Item" {
|
2015-07-15 19:15:39 +02:00
|
|
|
It "Should list all the items in the current working directory when asterisk is used" {
|
2016-03-04 23:52:27 +01:00
|
|
|
(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 19:15:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
It "Should return the name of the current working directory when a dot is used" {
|
2016-03-04 23:52:27 +01:00
|
|
|
(Get-Item $PSScriptRoot).GetType().BaseType | Should Be 'System.IO.FileSystemInfo'
|
|
|
|
(Get-Item $PSScriptRoot).Name | Should Be (Split-Path $PSScriptRoot -Leaf)
|
2015-07-15 19:15:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
It "Should return the proper Name and BaseType for directory objects vs file system objects" {
|
2016-03-04 23:52:27 +01:00
|
|
|
(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 19:15:39 +02:00
|
|
|
}
|
2015-08-06 16:35:06 +02:00
|
|
|
|
|
|
|
It "Should have mode flags set" {
|
2016-03-04 23:52:27 +01:00
|
|
|
ls $PSScriptRoot | foreach-object { $_.Mode | Should Not BeNullOrEmpty }
|
2015-08-06 16:35:06 +02:00
|
|
|
}
|
2015-07-17 00:52:42 +02:00
|
|
|
}
|