Private/MockWrappers.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# The functions in this file exist solely to allow
# easier mocking in Pester tests.

# this one
function TestData {
    # This one is specifically for mocking so we can more easily
    # pass data to the module scope from where it might be defined
    # in the test-wide BeforeAll section.
}

function Get-DateTimeOffsetNow {
    [System.DateTimeOffset]::Now
}

function Get-ConfigRoot {
    $script:ConfigRoot
}

function Set-ConfigRoot {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory,Position=0)]
        [string]$Path
    )
    $script:ConfigRoot = $Path
}

function Get-DirFolder {
    $script:DirFolder
}

function Set-DirFolder {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory,Position=0)]
        [string]$Path
    )
    $script:DirFolder = $Path
}

function Get-OrderFolder {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory,Position=0,ValueFromPipeline,ValueFromPipelineByPropertyName)]
        [string]$MainDomain
    )

    Process {
        Join-Path $script:AcctFolder $MainDomain.Replace('*','!')
    }
}