mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 20:56:02 +00:00
And use a bunch of unsafe code because of concerns about stack size.
19 lines
812 B
PowerShell
19 lines
812 B
PowerShell
# first check to see which platform we're on. If we're on windows we should be able
|
|
# to be sure whether we're running elevated. If we're on Linux, we can use whoami to
|
|
# determine whether we're elevated
|
|
Describe "Set-Date" -Tag "CI" {
|
|
BeforeAll {
|
|
Import-Module (join-path $psscriptroot "../../Common/Test.Helpers.psm1")
|
|
$IsElevated = Test-IsElevated
|
|
}
|
|
|
|
It "Set-Date should be able to set the date in an elevated context" -Skip:(! $IsElevated) {
|
|
{ get-date | set-date } | Should not throw
|
|
}
|
|
|
|
It "Set-Date should produce an error in a non-elevated context" -Skip:($IsElevated) {
|
|
{ get-date | set-date} | should throw
|
|
$Error[0].FullyQualifiedErrorId | should be "System.ComponentModel.Win32Exception,Microsoft.PowerShell.Commands.SetDateCommand"
|
|
}
|
|
}
|