Test/test006.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
# this test ensures that the cmdlets that should be here are here
BEGIN
{
    # the definition of Out-TestLog
    . ./Common.ps1
    $TESTNAME = $MyInvocation.MyCommand
    $name = "Microsoft.windows.computer"
    $STARTTIME = [datetime]::Now
}
END
{

    try
    {
        $o = get-scsmclass $name$|get-scsmobject -ea stop -max 1
        if ( $null -ne $o ) { Out-TestLog ("PASS: " + [datetime]::Now + ":${TESTNAME}a" ) }
    }
    catch 
    {
        Out-TestLog ("FAIL: " + [datetime]::Now + ":${TESTNAME}a" )
        $error | %{ Out-TestLog (" DETAIL: " + $_ ) }
        return 1
    }

    try
    {
        $o = get-scsmtypeprojection $name|get-scsmobjectprojection -ea stop -max 1
        if ( $null -ne $o ) { Out-TestLog ("PASS: " + [datetime]::Now + ":${TESTNAME}b" ) }
    }
    catch 
    {
        Out-TestLog ("FAIL: " + [datetime]::Now + ":${TESTNAME}b" )
        $error | %{ Out-TestLog (" DETAIL: " + $_ ) }
        return 1
    }
    return 0

}