Skip to content

Commit 05ae37f

Browse files
committed
Integration tests updated to cover all new properties
1 parent 6fa176b commit 05ae37f

1 file changed

Lines changed: 222 additions & 70 deletions

File tree

Lines changed: 222 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,133 +1,285 @@
1-
Configuration xScheduledTask_Add
1+
Configuration xScheduledTaskOnceAdd
22
{
33
Import-DscResource -ModuleName xComputerManagement
4-
node "localhost" {
5-
xScheduledTask xScheduledTask_Add {
6-
TaskName = "Test task"
4+
node "localhost"
5+
{
6+
xScheduledTask xScheduledTaskOnceAdd
7+
{
8+
TaskName = "Test task once"
79
TaskPath = "\xComputerManagement\"
810
ActionExecutable = "C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe"
9-
ScheduleType = "Minutes"
10-
RepeatInterval = 15
11-
}
11+
ScheduleType = 'Once'
12+
RepeatInterval = [datetime]::Today.AddMinutes(15)
13+
RepetitionDuration = [datetime]::Today.AddHours(8)
14+
ActionWorkingPath = (Get-Location).Path
15+
Enable = $true
16+
RandomDelay = [datetime]::Today.AddMinutes(60)
17+
DisallowHardTerminate = $true
18+
RunOnlyIfIdle = $false
19+
Priority = 9
20+
}
1221
}
1322
}
1423

15-
Configuration xScheduledTask_Edit1
24+
Configuration xScheduledTaskDailyAdd
1625
{
1726
Import-DscResource -ModuleName xComputerManagement
18-
node "localhost" {
19-
xScheduledTask xScheduledTask_Edit1 {
20-
TaskName = "Test task"
27+
node "localhost"
28+
{
29+
xScheduledTask xScheduledTaskDailyAdd
30+
{
31+
TaskName = "Test task Daily"
2132
TaskPath = "\xComputerManagement\"
2233
ActionExecutable = "C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe"
23-
ScheduleType = "Minutes"
24-
RepeatInterval = 45
25-
}
34+
ScheduleType = 'Daily'
35+
DaysInterval = 1
36+
RepeatInterval = [datetime]::Today.AddMinutes(15)
37+
RepetitionDuration = [datetime]::Today.AddHours(8)
38+
RestartCount = 2
39+
RestartInterval = [datetime]::Today.AddMinutes(5)
40+
RunOnlyIfNetworkAvailable = $true
41+
WakeToRun = $true
42+
}
2643
}
2744
}
2845

29-
Configuration xScheduledTask_Edit2
46+
Configuration xScheduledTaskWeeklyAdd
3047
{
3148
Import-DscResource -ModuleName xComputerManagement
32-
node "localhost" {
33-
xScheduledTask xScheduledTask_Edit2 {
34-
TaskName = "Test task"
49+
node "localhost"
50+
{
51+
xScheduledTask xScheduledTaskWeeklyAdd
52+
{
53+
TaskName = "Test task Weekly"
3554
TaskPath = "\xComputerManagement\"
3655
ActionExecutable = "C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe"
37-
ScheduleType = "Hourly"
38-
RepeatInterval = 4
39-
}
56+
ScheduleType = 'Weekly'
57+
WeeksInterval = 1
58+
DaysOfWeek = 'Monday','Wednesday','Saturday'
59+
RepeatInterval = [datetime]::Today.AddMinutes(15)
60+
RepetitionDuration = [datetime]::Today.AddHours(8)
61+
AllowStartIfOnBatteries = $true
62+
Compatibility = 'Win8'
63+
Hidden = $true
64+
}
4065
}
4166
}
4267

43-
Configuration xScheduledTask_Edit3
68+
Configuration xScheduledTaskLogonAdd
4469
{
4570
Import-DscResource -ModuleName xComputerManagement
46-
node "localhost" {
47-
xScheduledTask xScheduledTask_Edit3 {
48-
TaskName = "Test task"
71+
node "localhost"
72+
{
73+
xScheduledTask xScheduledTaskOnceAdd
74+
{
75+
TaskName = "Test task Logon"
4976
TaskPath = "\xComputerManagement\"
5077
ActionExecutable = "C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe"
51-
ScheduleType = "Daily"
52-
RepeatInterval = 1
53-
}
78+
ScheduleType = 'AtLogOn'
79+
RepeatInterval = [datetime]::Today.AddMinutes(15)
80+
RepetitionDuration = [datetime]::Today.AddHours(8)
81+
}
5482
}
5583
}
5684

57-
Configuration xScheduledTask_Edit4
85+
Configuration xScheduledTaskStartupAdd
5886
{
5987
Import-DscResource -ModuleName xComputerManagement
60-
node "localhost" {
61-
xScheduledTask xScheduledTask_Edit3 {
62-
TaskName = "Test task"
88+
node "localhost"
89+
{
90+
xScheduledTask xScheduledTaskOnceAdd
91+
{
92+
TaskName = "Test task Startup"
6393
TaskPath = "\xComputerManagement\"
6494
ActionExecutable = "C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe"
65-
ActionWorkingPath = "C:\"
66-
ScheduleType = "Daily"
67-
RepeatInterval = 1
68-
}
95+
ScheduleType = 'AtStartup'
96+
RepeatInterval = [datetime]::Today.AddMinutes(15)
97+
RepetitionDuration = [datetime]::Today.AddHours(8)
98+
}
6999
}
70100
}
71101

72-
Configuration xScheduledTask_Edit5
102+
Configuration xScheduledTaskOnceMod
73103
{
74104
Import-DscResource -ModuleName xComputerManagement
75-
node "localhost" {
76-
xScheduledTask xScheduledTask_Edit5 {
77-
TaskName = "Test task"
105+
node "localhost"
106+
{
107+
xScheduledTask xScheduledTaskOnceMod
108+
{
109+
TaskName = "Test task once"
78110
TaskPath = "\xComputerManagement\"
79111
ActionExecutable = "C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe"
80-
ActionWorkingPath = "C:\"
81-
ActionArguments = "-Command 'Get-ChildItem'"
82-
ScheduleType = "Daily"
83-
RepeatInterval = 1
84-
}
112+
ScheduleType = 'Once'
113+
RepeatInterval = [datetime]::Today.AddMinutes(20)
114+
RepetitionDuration = [datetime]::Today.AddHours(8)
115+
DisallowDemandStart = $true
116+
}
85117
}
86118
}
87119

88-
Configuration xScheduledTask_Remove
120+
Configuration xScheduledTaskDailyMod
89121
{
90122
Import-DscResource -ModuleName xComputerManagement
91-
node "localhost" {
92-
xScheduledTask xScheduledTask_Remove {
93-
TaskName = "Test task"
123+
node "localhost"
124+
{
125+
xScheduledTask xScheduledTaskDailyMod
126+
{
127+
TaskName = "Test task Daily"
94128
TaskPath = "\xComputerManagement\"
95129
ActionExecutable = "C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe"
96-
ScheduleType = "Minutes"
97-
RepeatInterval = 15
98-
Ensure="Absent"
99-
}
130+
ScheduleType = 'Daily'
131+
DaysInterval = 2
132+
RepeatInterval = [datetime]::Today.AddMinutes(30)
133+
RepetitionDuration = [datetime]::Today.AddHours(8)
134+
Enable = $false
135+
}
100136
}
101137
}
102138

103-
Configuration xScheduledTask_Enable
139+
Configuration xScheduledTaskWeeklyMod
104140
{
105141
Import-DscResource -ModuleName xComputerManagement
106-
node "localhost" {
107-
xScheduledTask xScheduledTask_Remove {
108-
TaskName = "Test task"
142+
node "localhost"
143+
{
144+
xScheduledTask xScheduledTaskWeeklyMod
145+
{
146+
TaskName = "Test task Weekly"
109147
TaskPath = "\xComputerManagement\"
110148
ActionExecutable = "C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe"
111-
ScheduleType = "Minutes"
112-
RepeatInterval = 15
113-
Enable = $true
114-
Ensure="Present"
115-
}
149+
ScheduleType = 'Weekly'
150+
WeeksInterval = 1
151+
DaysOfWeek = 'Monday','Thursday','Saturday'
152+
RepeatInterval = [datetime]::Today.AddMinutes(40)
153+
RepetitionDuration = [datetime]::Today.AddHours(8)
154+
}
155+
}
156+
}
157+
158+
Configuration xScheduledTaskLogonMod
159+
{
160+
Import-DscResource -ModuleName xComputerManagement
161+
node "localhost"
162+
{
163+
xScheduledTask xScheduledTaskOnceMod
164+
{
165+
TaskName = "Test task Logon"
166+
TaskPath = "\xComputerManagement\"
167+
ActionExecutable = "C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe"
168+
ScheduleType = 'AtStartup'
169+
RepeatInterval = [datetime]::Today.AddMinutes(12)
170+
RepetitionDuration = [datetime]::Today.AddHours(8)
171+
}
172+
}
173+
}
174+
175+
Configuration xScheduledTaskStartupMod
176+
{
177+
Import-DscResource -ModuleName xComputerManagement
178+
node "localhost"
179+
{
180+
xScheduledTask xScheduledTaskOnceMod
181+
{
182+
TaskName = "Test task Startup"
183+
TaskPath = "\xComputerManagement\"
184+
ActionExecutable = "C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe"
185+
ScheduleType = 'AtLogOn'
186+
RepeatInterval = [datetime]::Today.AddMinutes(10)
187+
RepetitionDuration = [datetime]::Today.AddHours(8)
188+
}
189+
}
190+
}
191+
192+
Configuration xScheduledTaskOnceDel
193+
{
194+
Import-DscResource -ModuleName xComputerManagement
195+
node "localhost"
196+
{
197+
xScheduledTask xScheduledTaskOnceDel
198+
{
199+
TaskName = "Test task once"
200+
TaskPath = "\xComputerManagement\"
201+
ActionExecutable = "C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe"
202+
ScheduleType = 'Once'
203+
RepeatInterval = [datetime]::Today.AddMinutes(20)
204+
RepetitionDuration = [datetime]::Today.AddHours(8)
205+
DisallowDemandStart = $true
206+
Ensure = 'Absent'
207+
}
116208
}
117209
}
118210

119-
Configuration xScheduledTask_Disable
211+
Configuration xScheduledTaskDailyDel
120212
{
121213
Import-DscResource -ModuleName xComputerManagement
122-
node "localhost" {
123-
xScheduledTask xScheduledTask_Remove {
124-
TaskName = "Test task"
214+
node "localhost"
215+
{
216+
xScheduledTask xScheduledTaskDailyDel
217+
{
218+
TaskName = "Test task Daily"
125219
TaskPath = "\xComputerManagement\"
126220
ActionExecutable = "C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe"
127-
ScheduleType = "Minutes"
128-
RepeatInterval = 15
221+
ScheduleType = 'Daily'
222+
DaysInterval = 2
223+
RepeatInterval = [datetime]::Today.AddMinutes(30)
224+
RepetitionDuration = [datetime]::Today.AddHours(8)
129225
Enable = $false
130-
Ensure="Present"
131-
}
226+
Ensure = 'Absent'
227+
}
228+
}
229+
}
230+
231+
Configuration xScheduledTaskWeeklyDel
232+
{
233+
Import-DscResource -ModuleName xComputerManagement
234+
node "localhost"
235+
{
236+
xScheduledTask xScheduledTaskWeeklyDel
237+
{
238+
TaskName = "Test task Weekly"
239+
TaskPath = "\xComputerManagement\"
240+
ActionExecutable = "C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe"
241+
ScheduleType = 'Weekly'
242+
WeeksInterval = 1
243+
DaysOfWeek = 'Monday','Thursday','Saturday'
244+
RepeatInterval = [datetime]::Today.AddMinutes(40)
245+
RepetitionDuration = [datetime]::Today.AddHours(8)
246+
Ensure = 'Absent'
247+
}
248+
}
249+
}
250+
251+
Configuration xScheduledTaskLogonDel
252+
{
253+
Import-DscResource -ModuleName xComputerManagement
254+
node "localhost"
255+
{
256+
xScheduledTask xScheduledTaskLogonDel
257+
{
258+
TaskName = "Test task Logon"
259+
TaskPath = "\xComputerManagement\"
260+
ActionExecutable = "C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe"
261+
ScheduleType = 'AtStartup'
262+
RepeatInterval = [datetime]::Today.AddMinutes(12)
263+
RepetitionDuration = [datetime]::Today.AddHours(8)
264+
Ensure = 'Absent'
265+
}
132266
}
133267
}
268+
269+
Configuration xScheduledTaskStartupDel
270+
{
271+
Import-DscResource -ModuleName xComputerManagement
272+
node "localhost"
273+
{
274+
xScheduledTask xScheduledTaskStartupDel
275+
{
276+
TaskName = "Test task Startup"
277+
TaskPath = "\xComputerManagement\"
278+
ActionExecutable = "C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe"
279+
ScheduleType = 'AtLogOn'
280+
RepeatInterval = [datetime]::Today.AddMinutes(10)
281+
RepetitionDuration = [datetime]::Today.AddHours(8)
282+
Ensure = 'Absent'
283+
}
284+
}
285+
}

0 commit comments

Comments
 (0)