$here = (Split-Path -Parent $MyInvocation.MyCommand.Path) . "$here.ps1" Describe "NetworkPaths" { $remoteComputerName = "RemoteComputer" Mock -CommandName Compare-StringToLocalMachineIdentifiers -ParameterFilter { $StringToCheck -eq $remoteComputerName } -MockWith { return $false } Mock -CommandName Compare-StringToLocalMachineIdentifiers -ParameterFilter { $StringToCheck -ne $remoteComputerName } -MockWith { return $true } Context "Local path and remote computer" { $result = Get-NormalizedPath -FilePath "C:\abc\123" -ComputerName $remoteComputerName It "matches" { $result | Should -Be "\\$remoteComputerName\C$\abc\123" } } Context "Remote path and remote computer" { $result = Get-NormalizedPath -FilePath "\\otherComputer\D$\abc\123" -ComputerName $remoteComputerName It "matches" { $result | Should -Be "\\$remoteComputerName\D$\abc\123" } } }