Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ protected override void ProcessRecord()
internal static class NativeMethods
{
[StructLayout(LayoutKind.Sequential)]
public class SystemTime
public struct SystemTime
{
public UInt16 Year;
public UInt16 Month;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@ Describe "Set-Date" -Tag "CI" {
}

It "Set-Date should be able to set the date in an elevated context" -Skip:(! $IsElevated) {
{ get-date | set-date } | Should not throw
{ Get-Date | Set-Date } | Should Not Throw
}

It "Set-Date should be able to set the date with -Date parameter" -Skip:(! $IsElevated) {
$target = Get-Date
$expected = $target
Set-Date -Date $target | Should Be $expected
}

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"
{ Get-Date | Set-Date } | ShouldBeErrorId "System.ComponentModel.Win32Exception,Microsoft.PowerShell.Commands.SetDateCommand"
}
}