@@ -43,7 +43,7 @@ Describe "Cdxml cmdlets are supported" -Tag CI,RequireAdminOnWindows {
43
43
if ( Test-CimTestInstance ) {
44
44
Get-CimInstance @CimCmdletArgs | Remove-CimInstance
45
45
}
46
- # if there's a failure with mofcomp then we will have trouble
46
+ # if there's a failure with mofcomp then we will have trouble
47
47
# executing the tests. Keep track of the exit code
48
48
$result = MofComp.exe $deleteMof
49
49
$script :MofCompReturnCode = $LASTEXITCODE
@@ -55,7 +55,14 @@ Describe "Cdxml cmdlets are supported" -Tag CI,RequireAdminOnWindows {
55
55
# create the class and instances
56
56
# and track the exitcode for the compilation of the mof file
57
57
# if there's a problem, there's no reason to keep going
58
- $result = MofComp.exe ${script :createMof}
58
+ $testMof = Get-Content - Path ${script :createmof} - Raw
59
+ $currentTimeZone = [System.TimeZoneInfo ]::Local
60
+
61
+ # this date is simply the same one used in the test mof
62
+ $UTCOffset = ($currentTimeZone.GetUtcOffset ([datetime ]::new(2008 , 01 , 01 , 0 , 0 , 0 ))).TotalMinutes.ToString()
63
+ $testMof = $testMof.Replace (" <UTCOffSet>" , $UTCOffset )
64
+ Set-Content - Path $testDrive \testmof.mof - Value $testMof
65
+ $result = MofComp.exe $testDrive \testmof.mof
59
66
$script :MofCompReturnCode = $LASTEXITCODE
60
67
if ( $script :MofCompReturnCode -ne 0 ) {
61
68
return
@@ -119,6 +126,12 @@ Describe "Cdxml cmdlets are supported" -Tag CI,RequireAdminOnWindows {
119
126
( $result.id | sort-object ) -join " ," | Should be " 1,2,4"
120
127
}
121
128
129
+ It " The Get-CimTest cmdlet should retrieve an object by datetime" @ItSkipOrPending {
130
+ $result = Get-CimTest - DateTime ([datetime ]::new(2008 , 01 , 01 , 0 , 0 , 0 ))
131
+ @ ($result ).Count | Should Be 1
132
+ $result.field1 | Should Be " instance 1"
133
+ }
134
+
122
135
It " The Get-CimTest cmdlet should return the proper error if the instance does not exist" @ItSkipOrPending {
123
136
{ Get-CimTest - ea stop - id " ThisIdDoesNotExist" } | ShouldBeErrorId " CmdletizationQuery_NotFound_Id,Get-CimTest"
124
137
}
0 commit comments