PowerShell/test/powershell/Get-PSDrive.Tests.ps1

48 lines
1.2 KiB
PowerShell
Raw Normal View History

Describe "Get-PSDrive" {
2015-07-21 19:08:09 +02:00
It "Should not throw" {
Get-PSDrive | Should Not BeNullOrEmpty
2015-09-23 20:33:33 +02:00
}
It "Should have a name and a length property" {
(Get-PSDrive).Name | Should Not BeNullOrEmpty
(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
2015-09-23 20:33:33 +02:00
gdr | Should Not BeNullOrEmpty
2015-07-21 19:08:09 +02:00
}
It "Should be the same output between Get-PSDrive and gdr" {
$alias = gdr
$actual = Get-PSDrive
$alias | Should Be $actual
}
2015-07-21 19:08:09 +02:00
It "Should return drive info"{
(Get-PSDrive Env).Name | Should Be Env
(Get-PSDrive Cert).Root | Should Be \
if ($IsWindows)
{
(Get-PSDrive C).Provider.Name | Should Be FileSystem
}
else
{
(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" {
(Get-PSDrive -PSProvider FileSystem).Name.Length | Should BeGreaterThan 0
2015-07-21 19:08:09 +02:00
}
2015-09-23 20:33:33 +02:00
It "Should return true that a drive that does not exist"{
!(Get-PSDrive fake -ErrorAction SilentlyContinue) | Should Be $True
Get-PSDrive fake -ErrorAction SilentlyContinue | Should BeNullOrEmpty
2015-07-21 19:08:09 +02:00
}
2015-07-21 19:34:12 +02:00
}