PowerShell/src/pester-tests/Test-Get-PSDrive.Tests.ps1

32 lines
1 KiB
PowerShell
Raw Normal View History

2015-07-24 19:38:51 +02:00
Describe "Test-Get-PSDrive" {
2015-07-21 19:08:09 +02:00
It "Should not throw" {
2015-09-23 20:33:33 +02:00
Get-PSDrive | Should Not BeNullOrEmpty
}
It "Should have a name and a length property" {
2015-07-24 19:38:51 +02:00
(Get-PSDrive).Name | Should Not BeNullOrEmpty
2015-07-21 19:08:09 +02:00
(Get-PSDrive).Root.Length | Should Not BeLessThan 1
2015-09-23 20:33:33 +02:00
}
2015-07-21 19:08:09 +02:00
2015-09-23 20:33:33 +02:00
It "Should be able to be called with the gdr alias" {
{ gdr } | Should Not Throw
gdr | Should Not BeNullOrEmpty
2015-07-21 19:08:09 +02:00
}
It "Should return drive info"{
2015-07-24 19:38:51 +02:00
(Get-PSDrive Env).Name | Should Be Env
(Get-PSDrive /).Root | Should Be /
2015-07-21 19:34:12 +02:00
(Get-PSDrive /).Provider.Name | Should Be FileSystem
2015-07-21 19:08:09 +02:00
}
2015-09-23 20:33:33 +02:00
It "Should be able to access a drive using the PSProvider switch" {
2015-07-21 19:08:09 +02:00
(Get-PSDrive -PSProvider FileSystem).Name.Length | Should BeGreaterThan 0
}
2015-09-23 20:33:33 +02:00
It "Should return true that a drive that does not exist"{
2015-07-21 19:08:09 +02:00
!(Get-PSDrive fake -ErrorAction SilentlyContinue) | Should Be $True
2015-09-23 20:33:33 +02:00
Get-PSDrive fake -ErrorAction SilentlyContinue | Should BeNullOrEmpty
2015-07-21 19:08:09 +02:00
}
2015-07-21 19:34:12 +02:00
}