32 lines
1.1 KiB
PowerShell
32 lines
1.1 KiB
PowerShell
|
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path)
|
||
|
. "$here.ps1"
|
||
|
|
||
|
Describe "LocalPaths" {
|
||
|
$computerName = "localhost"
|
||
|
Mock -CommandName Compare-StringToLocalMachineIdentifiers -ParameterFilter { $StringToCheck -eq $computerName } -MockWith { return $true }
|
||
|
Mock -CommandName Compare-StringToLocalMachineIdentifiers -ParameterFilter { $StringToCheck -ne $computerName } -MockWith { return $false }
|
||
|
|
||
|
Context "Local path and local computer" {
|
||
|
$result = Get-NormalizedPath -FilePath "C:\abc\123" -ComputerName $computerName
|
||
|
|
||
|
It "matches" {
|
||
|
$result | Should -Be "C:\abc\123"
|
||
|
}
|
||
|
}
|
||
|
|
||
|
Context "Remote path and local computer" {
|
||
|
$result = Get-NormalizedPath -FilePath "\\otherComputer\D$\abc\123" -ComputerName $computerName
|
||
|
|
||
|
It "matches" {
|
||
|
$result | Should -Be "D:\abc\123"
|
||
|
}
|
||
|
}
|
||
|
|
||
|
Context "Remote path and local computer - alternate case accepted" {
|
||
|
$result = Get-NormalizedPath -FilePath "\\otherComputer\D$\abc\123" -ComputerName $computerName
|
||
|
|
||
|
It "matches" {
|
||
|
$result | Should -Be "d:\abc\123"
|
||
|
}
|
||
|
}
|
||
|
}
|