Test/test001.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# this test ensures that the cmdlets that should be here are here
BEGIN
{
    # the definition of Out-TestLog
    . ./Common.ps1
    $TESTNAME = $MyInvocation.MyCommand
    $STARTTIME = [datetime]::Now
}


END
{
    $Expected = "Add-SCSMEnumeration",
    "Add-SCSMRequestOffering",
"Export-SCManagementPack",
"Get-SCSMRelationshipClass",
"Get-SCSMRelatedObject",
    "Get-SCSMResource",
"Get-SCSMRelationshipObject",
"Get-SCSMObject",
"Get-SCSMIncident",
    "Get-SCSMObjectTemplate",
"Get-SCSMObjectProjection",
"Get-SCSMRule",
"Get-SCSMTopLevelEnumeration",
    "Get-SCSMTaskResult",
"Get-SCSMUserRole",
"Get-SCSMTypeProjection",
"Get-SCSMSession",
    "Get-SCSMRunAsAccount",
"Get-SCSMTask",
"Get-SCSMSubscription",
"Get-SCDWRelationshipFactTypes",
    "Get-SCDWOutriggerTypes",
"Get-SCGroup",
"Get-SCDWWarehouseModuleTypes",
"Get-SCDWDimensionTypes",
    "Get-DataWarehouseConfiguration",
"Get-SCDWMeasureTypes",
"Get-SCDWFactTypes",
"Get-SCManagementPack",
    "Get-SCSMClass",
"Get-SCSMChildEnumeration",
"Get-SCSMEnumeration",
"Get-SCSMConfigItem",
    "Get-SCQueue",
"Get-SCSMManagementPackReference",
"Get-SCManagementPackElement",
"Get-SCSMCategory",
"Get-SCSMAnnouncement",
    "Get-SCSMObjectHistory",
    "Get-SCSMRequestOffering",
    "Get-SCSMRequestOfferingQuestion",
    "Get-SCSMServiceOffering",
    "Import-SCManagementPack",
"New-SCSMColumn",
"New-SCSMObjectProjection",
"New-SCSMObject",
"New-SCSMRelationshipObject",
    "New-SCSMView",
"New-SCSMSession",
"New-SCSMIncident",
"New-SCManagementPack",
    "New-SCGroup",
"New-SCQueue",
"New-SCSMAnnouncement",
"New-SCSMManagementPackReference",
"New-SCSealedManagementPack",
    "New-SCSMRequestOffering",
    "New-SCSMRequestOfferingQuestion",
    "New-SCSMServiceOffering",
    "New-SCSMServiceRequest",
    "Remove-SCSMRequestOffering",
    "Remove-SCSMServiceOffering",
    "Remove-SCSMRelationshipObject",
"Remove-SCSMSession",
"Remove-SCSMSubscription",
"Remove-SCSMObject",
"Remove-SCSMUserRole",
    "Remove-SCGroup",
"Remove-SCManagementPack",
"Remove-SCQueue",
"Set-SCSMObjectProjection",
    "Set-SCSMObjectTemplate",
"Set-SCSMRunAsAccount",
"Set-SCSMAnnouncement",
"Set-SCSMIncident",
    "Set-SCSMObject",
"Get-SCSMConnectedUser", 
"Get-SCSMConsoleTask",
    "Get-SCSMFolder", 
"Get-SCSMFolderHierarchy", 
"Get-SCSMForm", 
"Get-SCSMImage",
    "Get-SCSMLanguagePackCulture", 
"Get-SCSMPage", 
"Get-SCSMPageSet", 
"Get-SCSMStringResource",
    "Get-SCSMView", 
"Get-SCSMViewSetting", 
"Get-SCSMViewType", 
"Get-SCSMWhoAmI", 
"Remove-SCSMView", 
"Remove-SCSMEnumeration",
"Get-SCSMUserRoleProfile",
"New-SCSMNotificationSubscription",
"New-SCSMUserRole",
"New-SCSMFolder",
    "Get-SMLetsVersion"
            
    $ModuleName = "SMLets"
    if ( ! (get-module -list $ModuleName))
    {
        Out-TestLog ("FAIL:" + [datetime]::Now + ":${TESTNAME}:Module $ModuleName not found")
        # don't continue if the module is not present
        return 1
    }
    if ( ! (get-module $ModuleName))
    {
        Out-TestLog ("FAIL:" + [datetime]::Now + ":${TESTNAME}:Module $ModuleName not imported")
        # don't continue if the module is not installed
        return 1
    }
    $cmdletlist = get-command -type cmdlet -module $ModuleName|sort name|%{$_.name}
    $results = compare-object $Expected $cmdletList
    if ( $results )
    {
        Out-TestLog ("FAIL:" + [datetime]::Now + ":${TESTNAME}:Cmdlet list not correct")
        $results | %{ Out-TestLog (" DETAIL:" + [datetime]::Now + ":$TESTNAME:$_") }
        return 1
    }
    Out-TestLog ("PASS: " + [datetime]::Now + ":$TESTNAME")
    return 0
}