PowerShell/test/powershell/Get-PSDrive.Tests.ps1
Andrew Schwartzmeyer bbebf2f76a Reorganize tests
- Pester source code moved to `test/Pester`, deleted `ext-src`.
- Pester tests (.ps1 files) moved to `test/powershell`
- xUnit tests (.cs files) moved to `test/csharp`
- Third-party script test moved to `test/shebang`
2016-01-14 17:00:06 -08:00

49 lines
1.4 KiB
PowerShell

Describe "Get-PSDrive" {
$isWindows = [System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform([System.Runtime.InteropServices.OSPlatform]::Windows)
It "Should not throw" {
Get-PSDrive | Should Not BeNullOrEmpty
}
It "Should have a name and a length property" {
(Get-PSDrive).Name | Should Not BeNullOrEmpty
(Get-PSDrive).Root.Length | Should Not BeLessThan 1
}
It "Should be able to be called with the gdr alias" {
{ gdr } | Should Not Throw
gdr | Should Not BeNullOrEmpty
}
It "Should be the same output between Get-PSDrive and gdr" {
$alias = gdr
$actual = Get-PSDrive
$alias | Should Be $actual
}
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
}
}
It "Should be able to access a drive using the PSProvider switch" {
(Get-PSDrive -PSProvider FileSystem).Name.Length | Should BeGreaterThan 0
}
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
}
}