Private/New-OperationValidationInfo.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

function New-OperationValidationInfo {
    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '', Scope='Function', Target='*')]
    param (
        [Parameter(Mandatory)]
        [string]$File,

        [Parameter(Mandatory)]
        [string]$FilePath,

        [Parameter(Mandatory)]
        [string[]]$Name,

        [string[]]$TestCases,

        [Parameter(Mandatory)]
        [ValidateSet('None', 'Simple', 'Comprehensive')]
        [string]$Type,

        [string]$Modulename,

        [string[]]$Tags,

        [Version]$Version,

        [hashtable]$Parameters
    )

    $o = [pscustomobject]@{
        PSTypeName       = 'OperationValidationInfo'
        File             = $File
        FilePath         = $FilePath
        Name             = $Name
        TestCases        = $testCases
        Type             = $type
        ModuleName       = $Modulename
        Tags             = $Tags
        Version          = $Version
        ScriptParameters = $Parameters
    }
    $toString = { return ('{0} ({1}): {2}' -f $this.testFile, $this.Type, ($this.TestCases -join ',')) }
    Add-Member -InputObject $o -MemberType ScriptMethod -Name ToString -Value $toString -Force
    $o
}