|
65 | 65 | ) |
66 | 66 | } |
67 | 67 |
|
| 68 | + # Function to allow mocking pipeline input |
| 69 | + function Set-ScheduledTask |
| 70 | + { |
| 71 | + param |
| 72 | + ( |
| 73 | + [Parameter()] |
| 74 | + [switch] |
| 75 | + $Force, |
| 76 | + |
| 77 | + [Parameter(ValueFromPipeline = $true)] |
| 78 | + $InputObject, |
| 79 | + |
| 80 | + [Parameter()] |
| 81 | + [System.String] |
| 82 | + $Password, |
| 83 | + |
| 84 | + [Parameter()] |
| 85 | + [System.String] |
| 86 | + $User |
| 87 | + ) |
| 88 | + } |
| 89 | + |
68 | 90 | Describe $script:DSCResourceName { |
69 | 91 | BeforeAll { |
70 | 92 | Mock -CommandName Register-ScheduledTask |
|
312 | 334 |
|
313 | 335 | It 'Should update the scheduled task in the set method' { |
314 | 336 | Set-TargetResource @testParameters |
315 | | - Assert-MockCalled -CommandName Unregister-ScheduledTask -Exactly -Times 1 |
316 | | - Assert-Mockcalled -CommandName Register-ScheduledTask -Exactly -Times 1 |
| 337 | + Assert-MockCalled -CommandName Set-ScheduledTask -Exactly -Times 1 |
317 | 338 | } |
318 | 339 | } |
319 | 340 |
|
|
412 | 433 |
|
413 | 434 | It 'Should update the scheduled task in the set method' { |
414 | 435 | Set-TargetResource @testParameters |
415 | | - Assert-MockCalled -CommandName Unregister-ScheduledTask -Exactly -Times 1 |
416 | | - Assert-Mockcalled -CommandName Register-ScheduledTask -Exactly -Times 1 |
| 436 | + Assert-MockCalled -CommandName Set-ScheduledTask -Exactly -Times 1 |
417 | 437 | } |
418 | 438 | } |
419 | 439 |
|
|
511 | 531 |
|
512 | 532 | It 'Should update the scheduled task in the set method' { |
513 | 533 | Set-TargetResource @testParameters |
514 | | - Assert-MockCalled -CommandName Unregister-ScheduledTask -Exactly -Times 1 |
515 | | - Assert-Mockcalled -CommandName Register-ScheduledTask -Exactly -Times 1 |
| 534 | + Assert-MockCalled -CommandName Set-ScheduledTask -Exactly -Times 1 |
516 | 535 | } |
517 | 536 | } |
518 | 537 |
|
|
608 | 627 |
|
609 | 628 | It 'Should update the scheduled task in the set method' { |
610 | 629 | Set-TargetResource @testParameters |
611 | | - Assert-MockCalled -CommandName Unregister-ScheduledTask -Exactly -Times 1 |
612 | | - Assert-Mockcalled -CommandName Register-ScheduledTask -Exactly -Times 1 |
| 630 | + Assert-MockCalled -CommandName Set-ScheduledTask -Exactly -Times 1 |
613 | 631 | } |
614 | 632 | } |
615 | 633 |
|
|
665 | 683 |
|
666 | 684 | It 'Should update the scheduled task in the set method' { |
667 | 685 | Set-TargetResource @testParameters |
668 | | - Assert-MockCalled -CommandName Unregister-ScheduledTask -Exactly -Times 1 |
669 | | - Assert-Mockcalled -CommandName Register-ScheduledTask -Exactly -Times 1 |
| 686 | + Assert-MockCalled -CommandName Set-ScheduledTask -Exactly -Times 1 |
670 | 687 | } |
671 | 688 | } |
672 | 689 |
|
|
722 | 739 |
|
723 | 740 | It 'Should update the scheduled task in the set method' { |
724 | 741 | Set-TargetResource @testParameters |
725 | | - Assert-MockCalled -CommandName Unregister-ScheduledTask -Exactly -Times 1 |
726 | | - Assert-Mockcalled -CommandName Register-ScheduledTask -Exactly -Times 1 |
| 742 | + Assert-MockCalled -CommandName Set-ScheduledTask -Exactly -Times 1 |
727 | 743 | } |
728 | 744 | } |
729 | 745 |
|
|
777 | 793 |
|
778 | 794 | It 'Should update the scheduled task in the set method' { |
779 | 795 | Set-TargetResource @testParameters |
780 | | - Assert-MockCalled -CommandName Unregister-ScheduledTask -Exactly -Times 1 |
781 | | - Assert-Mockcalled -CommandName Register-ScheduledTask -Exactly -Times 1 |
| 796 | + Assert-MockCalled -CommandName Set-ScheduledTask -Exactly -Times 1 |
782 | 797 | } |
783 | 798 | } |
784 | 799 |
|
|
832 | 847 |
|
833 | 848 | It 'Should update the scheduled task in the set method' { |
834 | 849 | Set-TargetResource @testParameters |
835 | | - Assert-MockCalled -CommandName Unregister-ScheduledTask -Exactly -Times 1 |
836 | | - Assert-Mockcalled -CommandName Register-ScheduledTask -Exactly -Times 1 |
| 850 | + Assert-MockCalled -CommandName Set-ScheduledTask -Exactly -Times 1 |
837 | 851 | } |
838 | 852 | } |
839 | 853 |
|
|
890 | 904 |
|
891 | 905 | It 'Should update the scheduled task in the set method' { |
892 | 906 | Set-TargetResource @testParameters |
893 | | - Assert-MockCalled -CommandName Unregister-ScheduledTask -Exactly -Times 1 |
894 | | - Assert-Mockcalled -CommandName Register-ScheduledTask -Exactly -Times 1 |
| 907 | + Assert-MockCalled -CommandName Set-ScheduledTask -Exactly -Times 1 |
895 | 908 | } |
896 | 909 |
|
897 | 910 | } |
|
951 | 964 |
|
952 | 965 | It 'Should update the scheduled task in the set method' { |
953 | 966 | Set-TargetResource @testParameters |
954 | | - Assert-MockCalled -CommandName Unregister-ScheduledTask -Exactly -Times 1 |
955 | | - Assert-Mockcalled -CommandName Register-ScheduledTask -Exactly -Times 1 |
| 967 | + Assert-MockCalled -CommandName Set-ScheduledTask -Exactly -Times 1 |
956 | 968 | } |
957 | 969 | } |
958 | 970 |
|
@@ -1125,8 +1137,7 @@ try |
1125 | 1137 |
|
1126 | 1138 | It 'Should update the scheduled task in the set method' { |
1127 | 1139 | Set-TargetResource @testParameters |
1128 | | - Assert-MockCalled -CommandName Unregister-ScheduledTask -Exactly -Times 1 |
1129 | | - Assert-Mockcalled -CommandName Register-ScheduledTask -Exactly -Times 1 |
| 1140 | + Assert-MockCalled -CommandName Set-ScheduledTask -Exactly -Times 1 |
1130 | 1141 | } |
1131 | 1142 | } |
1132 | 1143 |
|
@@ -1266,9 +1277,7 @@ try |
1266 | 1277 |
|
1267 | 1278 | It 'Should update the scheduled task in the set method' { |
1268 | 1279 | Set-TargetResource @testParameters |
1269 | | - Assert-MockCalled -CommandName Unregister-ScheduledTask -Exactly -Times 1 |
1270 | | - Assert-Mockcalled -CommandName Register-ScheduledTask -Exactly -Times 1 |
1271 | | - } |
| 1280 | + Assert-MockCalled -CommandName Set-ScheduledTask -Exactly -Times 1 } |
1272 | 1281 | } |
1273 | 1282 |
|
1274 | 1283 | Context 'A scheduled task exists and is configured with the wrong idle timeout & idle duration parameters' { |
@@ -1334,8 +1343,7 @@ try |
1334 | 1343 |
|
1335 | 1344 | It 'Should update the scheduled task in the set method' { |
1336 | 1345 | Set-TargetResource @testParameters |
1337 | | - Assert-MockCalled -CommandName Unregister-ScheduledTask -Exactly -Times 1 |
1338 | | - Assert-Mockcalled -CommandName Register-ScheduledTask -Exactly -Times 1 |
| 1346 | + Assert-MockCalled -CommandName Set-ScheduledTask -Exactly -Times 1 |
1339 | 1347 | } |
1340 | 1348 | } |
1341 | 1349 |
|
@@ -1388,8 +1396,7 @@ try |
1388 | 1396 |
|
1389 | 1397 | It 'Should update the scheduled task in the set method' { |
1390 | 1398 | Set-TargetResource @testParameters |
1391 | | - Assert-MockCalled -CommandName Unregister-ScheduledTask -Exactly -Times 1 |
1392 | | - Assert-Mockcalled -CommandName Register-ScheduledTask -Exactly -Times 1 |
| 1399 | + Assert-MockCalled -CommandName Set-ScheduledTask -Exactly -Times 1 |
1393 | 1400 | } |
1394 | 1401 | } |
1395 | 1402 |
|
@@ -1442,8 +1449,7 @@ try |
1442 | 1449 |
|
1443 | 1450 | It 'Should update the scheduled task in the set method' { |
1444 | 1451 | Set-TargetResource @testParameters |
1445 | | - Assert-MockCalled -CommandName Unregister-ScheduledTask -Exactly -Times 1 |
1446 | | - Assert-Mockcalled -CommandName Register-ScheduledTask -Exactly -Times 1 |
| 1452 | + Assert-MockCalled -CommandName Set-ScheduledTask -Exactly -Times 1 |
1447 | 1453 | } |
1448 | 1454 | } |
1449 | 1455 |
|
|
0 commit comments