/Tests/Get-EscapedString.Tests.ps1
https://github.com/pspete/psPAS · Powershell · 52 lines · 26 code · 22 blank · 4 comment · 1 complexity · 5d0a356bc51e7f420660c57e70bb95da MD5 · raw file
- Describe $($PSCommandPath -Replace ".Tests.ps1") {
- BeforeAll {
- #Get Current Directory
- $Here = Split-Path -Parent $PSCommandPath
- #Assume ModuleName from Repository Root folder
- $ModuleName = Split-Path (Split-Path $Here -Parent) -Leaf
- #Resolve Path to Module Directory
- $ModulePath = Resolve-Path "$Here\..\$ModuleName"
- #Define Path to Module Manifest
- $ManifestPath = Join-Path "$ModulePath" "$ModuleName.psd1"
- if ( -not (Get-Module -Name $ModuleName -All)) {
- Import-Module -Name "$ManifestPath" -ArgumentList $true -Force -ErrorAction Stop
- }
- $Script:RequestBody = $null
- $Script:BaseURI = "https://SomeURL/SomeApp"
- $Script:ExternalVersion = "0.0"
- $Script:WebSession = New-Object Microsoft.PowerShell.Commands.WebRequestSession
- }
- AfterAll {
- $Script:RequestBody = $null
- }
- InModuleScope $(Split-Path (Split-Path (Split-Path -Parent $PSCommandPath) -Parent) -Leaf ) {
- It 'outputs a string' {
- "+ & %" | Get-EscapedString | Should -BeOfType System.String
- }
- It 'outputs an escaped string' {
- "+ & %" | Get-EscapedString | Should -BeExactly "%2B%20%26%20%25"
- }
- }
- }