mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-18 05:05:36 +00:00
Based on standard practices, we need to have a copyright and license notice at the top of each source file. Removed existing copyrights and updated/added copyright notices for .h, .cpp, .cs, .ps1, and .psm1 files. Updated module manifests for consistency to have Author = "PowerShell" and Company = "Microsoft Corporation". Removed multiple line breaks. Separate PR coming to update contribution document for new source files: #6140 Manually reviewed each change. Fix #6073
57 lines
1.6 KiB
PowerShell
57 lines
1.6 KiB
PowerShell
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
# Licensed under the MIT License.
|
|
Describe "GetDateFormatUpdates" -Tags "Feature" {
|
|
|
|
It "Verifies that FileDate format works" {
|
|
$date = Get-Date
|
|
$expectedFormat = "{0:yyyyMMdd}" -f $date
|
|
$actualFormat = Get-Date -Date $date -Format FileDate
|
|
|
|
$actualFormat | Should be $expectedFormat
|
|
}
|
|
|
|
It "Verifies that FileDateUniversal format works" {
|
|
$date = (Get-Date).ToUniversalTime()
|
|
$expectedFormat = "{0:yyyyMMddZ}" -f $date
|
|
$actualFormat = Get-Date -Date $date -Format FileDateUniversal
|
|
|
|
$actualFormat | Should be $expectedFormat
|
|
}
|
|
|
|
It "Verifies that FileDateTime format works" {
|
|
$date = Get-Date
|
|
$expectedFormat = "{0:yyyyMMddTHHmmssffff}" -f $date
|
|
$actualFormat = Get-Date -Date $date -Format FileDateTime
|
|
|
|
$actualFormat | Should be $expectedFormat
|
|
}
|
|
|
|
It "Verifies that FileDateTimeUniversal format works" {
|
|
$date = (Get-Date).ToUniversalTime()
|
|
$expectedFormat = "{0:yyyyMMddTHHmmssffffZ}" -f $date
|
|
$actualFormat = Get-Date -Date $date -Format FileDateTimeUniversal
|
|
|
|
$actualFormat | Should be $expectedFormat
|
|
}
|
|
|
|
}
|
|
|
|
Describe "GetRandomMiscTests" -Tags "Feature" {
|
|
It "Shouldn't overflow when using max range" {
|
|
|
|
$hadError = $false
|
|
|
|
try
|
|
{
|
|
## Don't actually need to validate
|
|
Get-Random -Minimum ([Int32]::MinValue) -Maximum ([Int32]::MaxValue) -ErrorAction Stop
|
|
}
|
|
catch
|
|
{
|
|
$hadError = $true
|
|
}
|
|
|
|
$hadError | Should be $false
|
|
}
|
|
}
|